I was looking at the Leo Burnett Big Ideas come out of Big Pencils site and its use of a 3D camera and realised a whole year had gone by since I last posted 3D camera zooming and panning scripts. I also realised that my code had changed throughout the year to better reflect the 3D reality. This post is a word out to the 3D zoom menu, the 3D perscpective and pull trhrough posts.
What has changed in the code is the way I interpret 3D. As you can see, I have added a clip property called ._z which represent the current position on the z axis, whereas the .z property is the original position of the clip. Here is the new 3D pull & camera Zoom core equations :
// Calculating actual scale values according to scale = fl/(z+fl) formula
var scale = focalLength/(focalLength+this._z);
// Position
this._x = centerX + scale*(oCamera.dx - this.x);
this._y = centerY + scale*(oCamera.dy - this.y);
this._z = centerZ + (oCamera.dz - this.z);
// x|y scale
this._xscale = scale * 100 ;
this._yscale = scale * 100 ;
// transparency
this._alpha = scale * 100 ;

Jeremy said...
What if you wanted to make the selected MovieClip's scale exactly 100 percent when clicked on?
Is there a special value for the focalLength?
I see that clip._z needs to become zero somehow, so that focalLength/(focalLength+this._z) will be 1, and the scale will truly be 100.
Thanks so much for all the hard work. I'm going to donate :)
paul said...
I see you already figured it out. Thanks
Jarrod said...
Hi Paul,
Thanks for the great flash work you do!
Quick question.... if the particles where rotated photos like (http://www.matthewmahon.com/) how would you rotate the camera based on the particles rotation?
Thanks again for your work! :)