/**
* Copyright mutantleg ( http://wonderfl.net/user/mutantleg )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/9NVD
*/
package {
import flash.text.TextField;
import flash.geom.ColorTransform;
import flash.geom.Matrix;
import flash.geom.Rectangle;
import flash.display.BitmapData;
import flash.events.Event;
import flash.display.Sprite;
public class FlashTest extends Sprite {
public function FlashTest() {
deb = new TextField();
deb.width=320;deb.height=240;
deb.mouseEnabled=false;
addChild(deb);
stage.quality = "LOW";
vec = new Vector.<Number>(0,false);
var i:int;
for (i = 0; i < 64; i+=1)
{
vec.push(Math.random()*512);
vec.push(Math.random()*512);
}
stage.addEventListener(Event.ENTER_FRAME, onEnter);
}//ctor
public var deb:TextField;
public var canvas:BitmapData = new BitmapData(465,465, true, 0);
public var canvas2:BitmapData = new BitmapData(465,465, false, 0);
public var vec:Vector.<Number>;
public var rect:Rectangle = new Rectangle(0,0, 32,32);
public var mat:Matrix = new Matrix();
public var ct:ColorTransform = new ColorTransform(1,1,1);
public var gt:int = 0;
public function onEnter(e:Event):void
{
canvas.fillRect(canvas.rect, 0);
canvas2.fillRect(canvas2.rect, 0x808080);
var mx:Number; var my:Number;
mx=stage.mouseX; my=stage.mouseY;
gt += 1;
var sx:Number; var sy:Number;
sx=0;sy=0;
//sx=gt;
sx= mx-230;
sy = my-230;
var i:int; var num:int;
num = vec.length;
for (i = 0; i < num; i+= 2)
{
rect.x = vec[i] -sx;
rect.y = vec[i+1] -sy;
canvas.fillRect(rect, 0x88000000);
}
canvas2.draw(canvas);
ct.redMultiplier=0.5;
// canvas2.colorTransform(canvas2.rect, ct);
var tx:Number; var ty:Number;
for (i = 0; i < 7; i+=1)
{
mat.identity();
tx = 1+(i*0.025);
ty = 1+(i*0.025);
mat.a = tx;
mat.d = ty;
mat.tx = (tx-1)*465*-0.5;
mat.ty = (ty-1)*465*-0.5;
// mat.rotate(i * 0.01);
canvas2.draw(canvas, mat);
}
deb.text = ""+mat.tx;
canvas2.unlock();
canvas2.lock();
graphics.clear();
graphics.beginBitmapFill(canvas2, null,false,false);
graphics.drawRect(0,0,465,465);
graphics.endFill();
}//onenter
}//classend
}