25 lines source code

In the last post, I put up my entry to one of the 25 lines of actionscript competitions. In case you missed it, here it is again.
[kml_flashembed
fversion=”8.0.0″ movie=”flash-content/25lines/25lines.swf” targetclass=”flashmovie” publishmethod=”static” width=”400″ height=”400″]

Get Adobe Flash player

[/kml_flashembed]
And here is the AS3 that makes it – for a stage size of 400 x 400, and a frame rate of about 50.

stage.quality = StageQuality.LOW;
var stageSin = 0.1;
var bmd:BitmapData = new BitmapData(400, 400, true, 0x000000);
var bm:Bitmap = new Bitmap(bmd);
addChild(bm);

for(var i=1;i<=360;i++){
     var circle:Shape = new Shape( );
     circle.graphics.beginFill( ((0xFFFFFF*i)/360) , 1 );
     circle.graphics.drawCircle( 0 ,  0 , i/(i/2) );
     var holder:MovieClip = new(MovieClip);
     holder.x = holder. y = 200;
     addChild(holder);
     holder.addChild(circle)
     circle.y=-10;
     holder.myNum= i;
     holder.addEventListener(Event.ENTER_FRAME, spinCircle);
}
function spinCircle(e:Event):void{
     e.currentTarget.rotation+=((mouseY-200)/100)*(Math.PI*(e.currentTarget.myNum/2))/150;
     e.currentTarget.alpha = Math.abs(1-(mouseX/200));
     e.currentTarget.scaleX = e.currentTarget.scaleY = ((Math.PI*(e.currentTarget.myNum/2))+(Math.sin(stageSin)*350))/15;
}

addEventListener(Event.ENTER_FRAME, drawAndSin);

function drawAndSin(e:Event):void{
     bmd.draw(this);
     bmd.applyFilter(bmd, bmd.rect, new Point(0,0), new BlurFilter(2, 2, 1));
     stageSin+=0.02;
}

Leave a Reply

Your email address will not be published.