◯と○
1個目 とりあえず 線を引いてみたい
// forked from gurumi's forked from: forked from: forked from: forked from: flash on 2009-5-9
// 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=2;
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(0xFF5500);
drawCircle(0,0,10);
endFill();
beginFill(0xFF9900);
drawCircle(80,0,10 );
endFill();
beginFill(0xFFFF99);
drawCircle(160,0,10 );
endFill();
beginFill(0xFFFFCC);
drawCircle(240,0,10 );
endFill();
beginFill(0x99EE11);
drawCircle(320,0,10 );
endFill();
}
//フィルタ
dot.filters = [blur];
}
private var blur:BlurFilter=new BlurFilter(8,8);
private var colorTransform:ColorTransform = new ColorTransform( 1,1,1, 1, -7, -6,-4);
private function drawline(e:Event):void
{
//ちょっとづつ暗くする
bmpd.colorTransform( bmpd.rect, colorTransform );
bmpd.draw(container);
//くるくるさせる
//rd=Math.PI/180*angle;
//radius = Math.sin(rd)*6;
//dot.x+=radius*Math.cos(rd)+2;
//dot.y+=radius*Math.sin(rd)+1;
//dot.rotation = angle;
dot.x +=70;
dot.y -=50;
angle+=15;
// はみ出たら位置を戻してループさせる
var left:int = -500, top:int = -50;
var right:int = stage.stageWidth+50, bottom:int = stage.stageHeight+ 50;
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"});
}
}
}