flash on 2010-2-28
/**
* Copyright drpt ( http://wonderfl.net/user/drpt )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/1RQm
*/
package
{
import flash.display.*;
import flash.events.*;
import flash.geom.*;
import flash.filters.BlurFilter;
[SWF(frameRate="60", backgroundColor="#ffffff")]
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 = 50;
public function line_01()
{
init();
addEventListener(Event.ENTER_FRAME, drawline);
}
private function init():void
{
bmpd = new BitmapData(stage.stageWidth, stage.stageHeight, false, 0xffffff );
container = new Sprite();
dot = new Sprite();
addChild(new Bitmap(bmpd));
container.addChild(dot);
with(dot.graphics)
{
for (var i= 0; i<170; i++){
beginFill(Math.random()*0x00FFFFFF);
drawCircle(i,-50,3);
endFill();
}
}
dot.filters = [blur];
}
private var blur:BlurFilter = new BlurFilter(8,8);
private var colorTransform:ColorTransform = new ColorTransform( 1,1,1, 1, -1, -1,-1);
private function drawline(e:Event):void
{
bmpd.colorTransform( bmpd.rect, colorTransform );
bmpd.draw(container);
rd=Math.PI/160*angle;
radius = Math.sin(rd)*4;
dot.x+=radius*Math.cos(rd)+3;
dot.y += radius * Math.sin(rd) +4;
dot.rotation = angle;
angle+=3;
var left:int = -200, top:int = -200;
var right:int = stage.stageWidth+230,
bottom:int = stage.stageHeight+230;
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;
}
}
}