forked from: flash on 2009-11-19
/**
* Copyright berian ( http://wonderfl.net/user/berian )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/eSI2
*/
// forked from blings's flash on 2009-11-19
package {
import flash.display.*;
import flash.events.*;
import flash.geom.*;
import flash.filters.*;
[SWF(frameRate=60, backgroundColor=0x000000, width=400, height=400)]
public class FlashTest extends Sprite {
private var bit:Bitmap;
private var bitData:BitmapData;
private var noiseData:BitmapData;
private var noiseSeed:int;
private var bitMatrix:Matrix;
private var noiseMatrix:Matrix;
private var colorTransform:ColorTransform;
public function FlashTest() {
bitData=new BitmapData(400, 400, true, 0x000000);
noiseData=new BitmapData(400, 400, true, 0x000000);
bit=new Bitmap(bitData);
noiseSeed=(Math.random()*2-1)*int.MAX_VALUE
bitMatrix=new Matrix();
noiseMatrix=new Matrix();
noiseMatrix.scale(20, 20);
colorTransform=new ColorTransform(1.05, 1.05, 1.05);
colorTransform.alphaOffset=-100;
addEventListener(Event.ENTER_FRAME, onFrame);
addChild(bit);
}
private function onFrame(e:Event):void {
bitMatrix.identity();
bitMatrix.translate(-200, -200);
bitMatrix.rotate(5/180*Math.PI);
bitMatrix.scale(0.95, 0.95);
bitMatrix.translate(200, 200);
noiseData.noise(noiseSeed);
noiseSeed++;
bitData.lock();
bitData.draw(noiseData, noiseMatrix, null, null, new Rectangle(Math.random()*400,Math.random()*400, Math.random()*50,Math.random()*50));
bitData.applyFilter(bitData, new Rectangle(0,0,400,400), new Point(), new BlurFilter(5,5));
bitData.draw(bitData, bitMatrix, colorTransform);
bitData.unlock();
}
}
}