矩阵基础知识(二)
import flash.events.Event;
import flash.geom.Matrix;
var angle:Number=0;
var cameraM:Matrix =new Matrix();
var mcM:Matrix=mc.transform.matrix;
this.addEventListener (Event.ENTER_FRAME,loop);
function loop(e:Event):void
{
angle++;
var tempM:Matrix=mcM.clone();
cameraM.identity();
cameraM.createBox(1,1,angle*Math.PI/180,100*Math.cos(angle*Math.PI/180)+275,100*Math.sin(angle*Math.PI/180)+200);
camera.transform.matrix=cameraM;
cameraM.invert();
tempM.concat(cameraM);
mc.transform.matrix=tempM;
if(!camera.contains(mc))camera.addChild(mc);
}
import flash.geom.Matrix;
var angle:Number=0;
var cameraM:Matrix =new Matrix();
var mcM:Matrix=mc.transform.matrix;
this.addEventListener (Event.ENTER_FRAME,loop);
function loop(e:Event):void
{
angle++;
var tempM:Matrix=mcM.clone();
cameraM.identity();
cameraM.createBox(1,1,angle*Math.PI/180,100*Math.cos(angle*Math.PI/180)+275,100*Math.sin(angle*Math.PI/180)+200);
camera.transform.matrix=cameraM;
cameraM.invert();
tempM.concat(cameraM);
mc.transform.matrix=tempM;
if(!camera.contains(mc))camera.addChild(mc);
}