Actionscript:
-
[SWF(width=600,height=650)]
-
var canvas:BitmapData=Bitmap(addChild(new Bitmap(new BitmapData(600,300,false,0xCCCCCC),"auto",true))).bitmapData;
-
var stills:BitmapData=Bitmap(addChild(new Bitmap(new BitmapData(600,380,false,0xAAAAAA),"auto",true))).bitmapData;
-
getChildAt(1).y=300;
-
-
var c:Shape = new Shape();
-
var m:Matrix = new Matrix();
-
m.createGradientBox(40, 40, 0, 0, 0);
-
c.graphics.beginGradientFill(GradientType.RADIAL, [0xCC0000, 0xCC0000], [1, 0], [0, 255], m);
-
c.graphics.drawCircle(20,20,20);
-
-
addEventListener(Event.ENTER_FRAME, onLoop);
-
function onLoop(evt:Event):void {
-
c.x=mouseX-c.width/2;
-
c.y=mouseY-c.height/2;
-
canvas.draw(c, c.transform.matrix);
-
}
-
-
var spacing:Number = 10;
-
var cols:Number = 4;
-
var max:Number = cols * cols;
-
var size:Number = 1/(canvas.width/((canvas.width / cols) - spacing));
-
var st:Matrix = new Matrix();
-
st.scale(size, size);
-
var w:Number = canvas.width * st.d + spacing;
-
var h:Number = canvas.height * st.d + spacing;
-
var timer:Timer=new Timer(500);
-
timer.start();
-
timer.addEventListener(TimerEvent.TIMER, onCapture);
-
function onCapture(evt:TimerEvent):void {
-
var inc:int = timer.currentCount - 1;
-
st.tx = (inc% cols) * w+ spacing / 2;
-
st.ty = int(inc / cols) * h + spacing;
-
stills.draw(canvas, st);
-
if (timer.currentCount==max) {
-
timer.reset();
-
timer.start();
-
}
-
}
Take snapshots of a given BitmapData and arrange them in a grid. I wrote this snippet quickly in response to a question so it could probably use a little clean up...
You'll need to move your mouse over the large canvas bitmap (drawing to it) to see anything...