Matrix3DTransformsExample bradsedito forked:0favorite:0lines:49license : MIT License modified : 2012-04-10 10:21:08 Embed Tweet package { import flash.display.Sprite; import flash.display.Shape; import flash.display.Graphics; import flash.geom.*; public class Matrix3DTransformsExample extends Sprite { private var rect1:Shape; private var rect2:Shape; public function Matrix3DTransformsExample():void { var pp:PerspectiveProjection = this.transform.perspectiveProjection; pp.projectionCenter = new Point(275,200); this.transform.perspectiveProjection = pp; rect1 = new Shape(); rect1.x = -70; rect1.y = -40; rect1.z = 0; rect1.graphics.beginFill(0xFF8800); rect1.graphics.drawRect(0,0,50,80); rect1.graphics.endFill(); rect2 = new Shape(); rect2.x = 20; rect2.y = -40; rect2.z = 0; rect2.graphics.beginFill(0xFF0088); rect2.graphics.drawRect(0,0,50,80); rect2.graphics.endFill(); addChild(rect1); addChild(rect2); doTransforms(); } private function doTransforms():void { rect1.rotationX = 15; rect1.scaleX = 1.2; rect1.x += 100; rect1.y += 50; rect1.rotationZ += 10; var rec2_mtx3d:Matrix3D = rect2.transform.matrix3D; rec2_mtx3d.appendRotation(15, Vector3D.X_AXIS); rec2_mtx3d.appendScale(1.2, 1, 1); rec2_mtx3d.appendTranslation(100, 50, 0); rec2_mtx3d.appendRotation(10, Vector3D.Z_AXIS); rect2.transform.matrix3D = rec2_mtx3d; } } } Code Fullscreen Preview Fullscreen Example Matrix3D Transform matrix3D perspectiveProjection appendRotation appendScale projectionCenter Vector3D.Z_AXIS appendTranslation Vector3D.X_AXIS PerspectiveProjection Matrix3D drawRect endFill beginFill Point