forked from: forked from: flash on 2009-5-9
1個目 とりあえず 線を引いてみたい
// forked from yd_niku's forked from: flash on 2009-5-9
// forked from qurumi's flash on 2009-5-9
// write as3 code here..
//1個目 とりあえず 線を引いてみたい
package
{
import flash.display.*;
import flash.events.*;
import flash.geom.*;
import flash.filters.BlurFilter;
import caurina.transitions.Tweener;
[SWF(frameRate="24", backgroundColor="#000000")]
public class line_01 extends Sprite
{
private var container:Sprite;
private var dot:Sprite;
private var bmpd:BitmapData;
public function line_01()
{
init();
addEventListener(Event.ENTER_FRAME, drawline);
}
private function init():void
{
bmpd = new BitmapData(stage.stageWidth, stage.stageHeight, true, 0x00FFFFFF);
container = new Sprite();
dot = new Sprite();
addChild(new Bitmap(bmpd));
container.addChild(dot);
with(dot.graphics)
{
beginFill(0x0066CC);
drawCircle(0,0,1);
endFill();
}
}
private var colorTransform:ColorTransform = new ColorTransform(1,1,1,1,-1,-1,-1, 0);
private function drawline(e:Event):void
{
//ちょっとづつ暗くする
bmpd.colorTransform( bmpd.rect, colorTransform );
bmpd.draw(container);
dot.x += Math.random() * 70;
dot.y += Math.random() * 70;
// はみ出たら位置を戻してループさせる
if( dot.x > stage.stageWidth ) dot.x = 0;
if( dot.y > stage.stageHeight ) dot.y = 0;
var blur:BlurFilter=new BlurFilter(10,10);
var filters:Array =new Array();
filters.push(blur);
dot.filters = filters;
Tweener.addTween(dot, {scaleX:5, scaleY:5,x:500, y:500, time:10, transition:"easeOutSine"});
}
}
}