forked from: forked from: flash on 2009-7-2
/**
* Copyright gencha ( http://wonderfl.net/user/gencha )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/frJy
*/
// forked from ep91ckok's forked from: flash on 2009-7-2
package {
import flash.display.Sprite;
import flash.filters.BlurFilter;
import frocessing.display.*;
import flash.geom.*;
import flash.text.*;
public class Main3 extends F5MovieClip2DBmp{
private var p:Point = new Point();
private var v:Point = new Point();
private var a:Point = new Point();
private var pn:Point = new Point();
private var vn:Point = new Point();
private var c:uint = 0;
private var blur:BlurFilter = new BlurFilter( 1.05, 1.05 );
public function setup():void {
p.x = stage.width/2;
p.y = stage.height/2;
pn.x = p.x;
pn.y = p.y;
background( 0 );
}
public function draw():void {
for (var i:int = 0; i < 1000; ++i )
draw_();
bitmapData.applyFilter(bitmapData, bitmapData.rect, new Point(0,0), blur);
}
public function draw_():void {
v.x = vn.x;
v.y = vn.y;
p.x = pn.x;
p.y = pn.y;
var n:Number = Math.random();
var t:Number = Math.random()*2*Math.PI;
a.x = n*Math.cos(t);
a.y = n*Math.sin(t);
vn.x += a.x - v.x*0.05;
vn.y += a.y - v.y*0.05;
pn.x += v.x;
pn.y += v.y;
var W:int = stage.width;
var H:int = stage.height;
while(p.x < 0) p.x += W;
while(p.x >= W) p.x -= W;
while(p.y < 0) p.y += H;
while(p.y >= H) p.y -= H;
var color:int = 255-Math.abs( ( p.x - W / 2 ) / W * 512 );
color = Math.max( 0, color-Math.abs( ( p.y - H / 2 ) / H * 512 ) );
fill( color, color * 0.5, color * 0.7, 255 );
circle( p.x, p.y, Math.sin( ++c / 1000 ) * 20.0 );
}
}
}