Ice Radar
Jason Smith 2010
♥2 |
Line 57 |
Modified 2010-07-24 08:32:14 |
MIT License
archived:2017-03-20 07:25:27
ActionScript3 source code
/**
* Copyright Venom ( http://wonderfl.net/user/Venom )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/klDx
*/
/**
* Jason Smith 2010
*/
package {
import flash.display.Sprite;
import flash.display.Bitmap;
import flash.display.BitmapData;
import flash.display.BlendMode;
import flash.geom.Point;
import flash.geom.Rectangle;
import flash.filters.BlurFilter;
import flash.events.Event;
[SWF(frameRate=31)]
final public class IceNRadar extends Sprite {
private const CENTRE:Number = 232.5;
private const RADIUS:uint = 50;
private var blur:BlurFilter = new BlurFilter(3,3,1);
private var blur2:BlurFilter = new BlurFilter(2,2,1);
private var bmd:BitmapData;
private var bmd2:BitmapData;
private var bmd3:BitmapData;
private var canvas:Bitmap;
private var canvas2:Bitmap;
private var canvas3:Bitmap;
public function IceNRadar() {
init();
}
private function init():void {
bmd = new BitmapData(stage.stageWidth,stage.stageHeight,false,0x000000);
canvas = new Bitmap(bmd);
addChild(canvas);
bmd2 = new BitmapData(stage.stageWidth,stage.stageHeight,false,0xFFFFFF);
canvas2 = new Bitmap(bmd2);
addChild(canvas2);
canvas2.blendMode = BlendMode.ADD;
bmd3 = new BitmapData(stage.stageWidth,stage.stageHeight,false,0xFFFFFF);
canvas3 = new Bitmap(bmd3);
addChild(canvas3);
canvas3.blendMode = BlendMode.ADD;
addEventListener("enterFrame",loop,false,0,true);
}
private var omega:Number = 0;
private function loop(evt:Event):void {
for (var i:uint = 0; i<100; i++) {
for (var j:uint = 0; j<100; j++) {
var x:Number = CENTRE + Math.sin(omega)*RADIUS*i;
var y:Number = CENTRE + Math.cos(omega)*RADIUS*j;
bmd.setPixel(x,y,Math.random()*0xFFA9);
bmd2.setPixel(x,y,Math.random()*0xFFA9);
var x2:Number = CENTRE + Math.cos(omega)*RADIUS;
bmd3.setPixel(x2,y,Math.random()*0xFFA9);
}
}
bmd.applyFilter(bmd,bmd.rect,new Point(0,0),blur);
bmd2.applyFilter(bmd2,bmd2.rect,new Point(0,0),blur2);
bmd3.applyFilter(bmd2,bmd3.rect,new Point(0,0),blur2);
omega++;
}
}
}