flash on 2009-12-28
/**
* Copyright h_ike ( http://wonderfl.net/user/h_ike )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/csMg
*/
package {
import flash.display.*;
import flash.events.*;
import flash.geom.*;
import flash.filters.*;
public class FlashTest extends Sprite {
private var bmd:BitmapData;
private var sprite:Sprite;
private var mtrx:Matrix;
private var ct:ColorTransform;
private var ct2:ColorTransform;
private var bf:BlurFilter;
public function FlashTest(){
bmd = new BitmapData(465,465,false,0);
addChild(new Bitmap(bmd));
mtrx = new Matrix();
ct = new ColorTransform(0.99,0.99,0.99);
ct2 = new ColorTransform();
bf = new BlurFilter(3,3,2);
//
sprite = new Sprite();
sprite.graphics.beginFill(0x000000);
sprite.graphics.drawRect(-10,-10,20,20);
addEventListener(Event.ENTER_FRAME,loop);
}
private function loop(e:Event):void{
mtrx.identity();
var s:Number = Math.random()*4;
mtrx.scale(s,s);
mtrx.rotate(Math.PI*Math.random());
mtrx.translate(mouseX,mouseY);
//
ct2.redOffset = Math.random()*255;
ct2.greenOffset = Math.random()*255
ct2.blueOffset = Math.random()*255;
bmd.draw(sprite,mtrx,ct2,BlendMode.ADD);
bmd.colorTransform(bmd.rect,ct);
bmd.applyFilter(bmd,bmd.rect,bmd.rect.topLeft,bf);
}
}
}