flash on 2010-2-9
/**
* Copyright 0xABCDEF ( http://wonderfl.net/user/0xABCDEF )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/ndlg
*/
package {
import flash.display.*;
import flash.events.*;
[SWF(width=465,height=465,backgroundColor=0xFFFFFF,frameRate=60)]
public class Quake extends Sprite {
public function Quake() {
var s:Shape = new Shape();
var a:Array = new Array();
stage.addChild(s);
stage.addEventListener(Event.ENTER_FRAME,ef);
function ef(e:Event):void{
a.push({x:stage.mouseX,y:stage.mouseY,r:Math.random()*30,a:1,c:Math.random()*0xFFFFFF});
s.graphics.clear();
for(var i:int=0;i<a.length;i++){
s.graphics.beginFill(a[i].c,a[i].a);
s.graphics.drawCircle(a[i].x,a[i].y,a[i].r);
s.graphics.endFill();
a[i].x += Math.random()*10-5;
a[i].y += Math.random()*10-5;
a[i].r -= 0.1;
a[i].a -= 0.01;
if((a[i].x<0)||(a[i].x>stage.stageWidth)||(a[i].y<0)||(a[i].y>stage.stageHeight)||(a[i].a<=0)||(a[i].r<=0)){
a.splice(i,1);
}
}
}
}
}
}