flash on 2013-4-1
/**
* Copyright J.J ( http://wonderfl.net/user/J.J )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/a8Og
*/
package {
import flash.geom.Point;
import flash.events.Event;
import flash.display.Sprite;
public class FlashTest extends Sprite {
private var lights:Vector.<Sprite>;
private var n:Number=0
private var w:uint,h:uint;
public function FlashTest() {
stage.frameRate=60;
w=stage.stageWidth;
h=stage.stageHeight;
this.graphics.beginFill(0)
this.graphics.drawRect(0,0,w,h)
lights=new Vector.<Sprite>();
for(var i:int;i<100;i++){
var light:Light=new Light(0xffffff*Math.random())
light.x=w/2;
light.y=h/2
light.z=(i*-90)+50
addChild(light);
lights.push(light);
}
addEventListener('enterFrame',loop);
// write as3 code here..
}
private function loop(e:Event=null):void{
n+=.1;
var p:Point=new Point;
p.x=Math.sin(n)*40+w/2;
p.y=Math.cos(n)*10+h/2
for each(var l:Sprite in lights){
l.x+=(p.x-l.x)*.3;
l.y+=(p.y-l.y)*.3;
p.x=l.x
p.y=l.y
}
}
}
}
import flash.display.BlendMode;
import flash.filters.BlurFilter;
import flash.display.Sprite;
class Light extends Sprite{
public function Light(c:uint=0):void{
this.blendMode=BlendMode.ADD
this.graphics.beginFill(c)
this.graphics.drawCircle(0, 0, 20)
this.graphics.endFill()
this.filters=[new BlurFilter(20,20)]
}
}