Flash Player 10’s 3D capabilities are pretty light, but they have opened up many possibilities in UI design. Getting the perspective just right will take some tweaks, so here’s a demo to show some of the inner workings, like focal length and field of view.
Using the PerspectiveProjection class is the key to getting 3D in Flash looking just right, it is also very easy to use.
//new PerspectiveProjection var pers:PerspectiveProjection = new PerspectiveProjection(); //set the field of view - doesn't really do much pers.fieldOfView = 55;//Default: 55, Range: 1 - 180 //set the focal length pers.focalLength = 663;//Default: 663 //get stage center for a straight view, if you want a straight view. var centerX:Number = stage.stageWidth * 0.5; var centerY:Number = stage.stageHeight * 0.5; //set the projection center pers.projectionCenter = new Point(centerX, centerY); //assign to root/stage //root.transform.perspectiveProjection = pers; //assign to target/DisplayObject triImage.transform.perspectiveProjection = pers; |
See demo below.
| 2 Comments » | facebook:
RSS feed for comments on this post. TrackBack URL
Just as a side note:
Both focalLength and fieldOfView adjusts the perspective distortion in a way that setting one of the values will override the other one!
Thanks for the post!
Comment by Paulo Amorim — September 23, 2010 @ 5:02 am
Wow! This really is a single of the most effective blogs I’ve at any time appear throughout on this subject. Basically Magnificent
Comment by Flv Player — November 3, 2010 @ 12:44 am