forked from: flash on 2013-4-1
forked from flash on 2013-4-1 (diff: 53)
ActionScript3 source code
/**
* Copyright bradsedito ( http://wonderfl.net/user/bradsedito )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/qXtL
*/
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 = 90
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)
}
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) * 0.3;
l.y += (p.y-l.y) * 0.3;
l.z == (l.z) // * 0.3;
p.x = l.x
p.y = l.y
//p.z = 0
}
}
}
}
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,60 )
this.graphics.endFill()
this.filters = [ new BlurFilter( 25,25,4 ) ]
}
}