forked from: Spiral doodad 2
/**
* Copyright webpqw ( http://wonderfl.net/user/webpqw )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/pAbd
*/
// forked from keeganbrown's Spiral doodad 2
// forked from keeganbrown's forked from: closure graphics
// forked from clockmaker's closure graphics
// forked from Altschuler's flash on 2010-1-29
package {
import flash.display.Sprite;
import frocessing.color.ColorHSV;
import flash.display.Bitmap;
import flash.display.BitmapData;
import flash.filters.BlurFilter;
import flash.geom.Point;
import flash.display.BlendMode;
import flash.display.*;
import flash.events.TimerEvent;
[SWF( backgroundColor=0, frameRate=120 )]
import flash.utils.Timer;
public class FlashTest extends Sprite {
public var blur1:BlurFilter = new BlurFilter(7, 7, 1);
public var traceMap:Bitmap;
public var mapData:BitmapData;
private var capPoint:Point = new Point(0, 0);
public var capObj:Sprite = new Sprite();
public var overlay:Sprite = new Sprite();
public function FlashTest() {
// one line
var sw:Number = this.stage.stageWidth;
var sh:Number = this.stage.stageHeight;
var bg:Sprite = new Sprite();
bg.graphics.beginFill(0x00000, 1);
bg.graphics.drawRect(0,0,sw,sh);
this.addChild(bg);
mapData = new BitmapData(sw, sh, true, 0x000000);
traceMap = new Bitmap(mapData);
var rect = traceMap.getRect(this);
overlay.graphics.beginFill(0x000000, 0.05);
overlay.graphics.drawRect(0,0,sw,sh);
this.addChild(traceMap);
this.addChild(capObj);
capObj.addChild(overlay);
var timSpir:Timer = new Timer(1,0);
timSpir.addEventListener(TimerEvent.TIMER,function(n){
return function() {
var r=235, m=Math, h=new ColorHSV();
with(capObj.graphics) {
clear();
moveTo(r, r);
for(var i=0; i<r; i++){
h.h = i/r * 135 + n * -4000;
lineStyle(1, h.value32, 1 - i/r);
lineTo(
r + (i * m.cos(i + (i * n))),
r + (i * m.sin(i + (i * n))));
}
}
mapData.draw(capObj, null, null, BlendMode.NORMAL, null, false);
mapData.applyFilter(mapData, rect, capPoint, blur1 );
n+=.001; }}(0));
timSpir.start();
}
}
}