りんかく
直線で輪郭をえがく。
/**
* Copyright kenji_special ( http://wonderfl.net/user/kenji_special )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/58k9
*/
package {
import flash.events.MouseEvent;
import flash.events.Event;
import flash.display.Shader;
import flash.display.Shape;
import flash.display.Sprite;
import flash.display.Stage;
[SWF(backgroundColor="#000000", height="465", width="465")]
public class FlashTest extends Sprite {
private var Num:int = 100;
private var W:int = 500;
private var count:int = 0;
public function FlashTest() {
this.graphics.beginFill(0x0, 1);
this.graphics.drawRect(0, 0, 465, 465);
stage.addEventListener(Event.ENTER_FRAME, loop);
}
private function loop(e:Event):void
{
if(count <= 10 * Num)
{
count++
var i:int = count % Num;
var dim01:Shape = new Shape();
dim01.graphics.lineStyle(1, 0xffffff, 0.05);
dim01.graphics.moveTo(0, 0.9 *W*0.5*(Num - i )/Num);
dim01.graphics.lineTo(0.9 * W*0.5 * i/Num, 0);
dim01.x = stage.stageWidth * 0.05;
dim01.y = stage.stageHeight * 0.05;
stage.addChild(dim01);
var dim02:Shape = new Shape();
dim02.graphics.lineStyle(1, 0xffffff, 0.05);
dim02.graphics.moveTo(0, 0.9 * stage.stageHeight*(0.5*i/Num+ 0.5));
dim02.graphics.lineTo(0.9 * stage.stageWidth*i/Num*0.5, 0.9 * stage.stageHeight);
dim02.x = stage.stageWidth * 0.05;
dim02.y = stage.stageHeight * 0.05;
stage.addChild(dim02);
var dim03:Shape = new Shape();
dim03.graphics.lineStyle(1, 0xffffff, 0.05);
dim03.graphics.moveTo(0.9 * stage.stageWidth*0.5*(1 + i/Num), 0);
dim03.graphics.lineTo(0.9 * stage.stageWidth, 0.9 * stage.stageHeight * 0.5 * i/Num);
dim03.x = stage.stageWidth * 0.05;
dim03.y = stage.stageHeight * 0.05;
stage.addChild(dim03);
var dim04:Shape = new Shape();
dim04.graphics.lineStyle(1, 0xffffff, 0.05);
dim04.graphics.moveTo(0.9 * stage.stageWidth*0.5*(1 + i/Num), 0.9 * stage.stageHeight);
dim04.graphics.lineTo(0.9 * stage.stageWidth, 0.9 * stage.stageHeight*0.5 *(2- i/Num));
dim04.x = stage.stageWidth * 0.05;
dim04.y = stage.stageHeight * 0.05;
stage.addChild(dim04);
}else
{
stage.addEventListener(Event.ENTER_FRAME, loop);
}
}
}
}