forked from: forked from: forked from: forked from: flash on 2009-5-9
1個目 とりあえず 線を引いてみたい
// forked from yd_niku's forked from: forked from: forked from: flash on 2009-5-9
// forked from gurumi's forked from: forked from: flash on 2009-5-9
// 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="60", backgroundColor="#000000")]
public class line_01 extends Sprite
{
private var container:Sprite;
private var dot:Sprite;
private var bmpd:BitmapData;
private var angle:int;
private var rd:Number;
private var radius:int=25;
public function line_01()
{
init();
addEventListener(Event.ENTER_FRAME, drawline);
}
private function init():void
{
bmpd = new BitmapData(stage.stageWidth, stage.stageHeight, false, 0xFF000000 );
container = new Sprite();
dot = new Sprite();
addChild(new Bitmap(bmpd));
container.addChild(dot);
with(dot.graphics)
{
beginFill(0xFF9900);
drawCircle(0,70,10);
endFill();
beginFill(0xFFCC00);
drawCircle(40,20,10);
endFill();
beginFill(0xFFFF00);
drawCircle(60,90,10);
endFill();
beginFill(0xFFFFCC);
drawCircle(90,40,10);
drawCircle(150,100,10);
endFill();
beginFill(0x99EE11);
drawCircle(120,100,10);
endFill();
}
//フィルタ
dot.filters = [blur];
}
private var blur:BlurFilter=new BlurFilter(25,25);
private var colorTransform:ColorTransform = new ColorTransform( 1,1,1, 1, -3.5, -2.5,-2.5);
private function drawline(e:Event):void
{
//ちょっとづつ暗くする
bmpd.colorTransform( bmpd.rect, colorTransform );
bmpd.draw(container);
//くるくるさせる
rd=Math.PI/180*angle;
radius = Math.sin(rd)*2;
dot.x+=radius*Math.cos(rd) +5;
dot.y+=radius*Math.sin(rd) +3;
dot.rotation = angle;
angle+=2;
// はみ出たら位置を戻してループさせる
var left:int = -100, top:int = -100;
var right:int = stage.stageWidth+100, bottom:int = stage.stageHeight+ 100;
if( dot.x < left ) dot.x = right;
else if( dot.x > right ) dot.x = left;
if( dot.y < top ) dot.y = bottom;
if( dot.y > bottom ) dot.y = top;
//bmpd.applyFilter( bmpd, bmpd.rect, new Point, blur );
//Tweener.addTween(dot, {scaleX:2, scaleY:2, x:stage.stageWidth+100, y:stage.stageHeight+100, time:30, transition:"easeOutSine"});
}
}
}