Important Formulas in This Chapter

The important formulas in this chapter are those for 3D perspective, coordinate rotation, and distance.

Basic perspective:

 scale = fl / (fl + z); mc._xscale = mc._yscale = scale * 100; mc._alpha = scale * 100;     // optional mc._x = vanishingPointX + x * scale; mc._y = vanishingPointY + y * scale; mc.swapDepths(-z);     // optional 

Coordinate rotation:

 x1 = cos(angleZ) * x  sin(angleZ) * y; y1 = cos(angleZ) * y + sin(angleZ) * x; x1 = cos(angleY) * x  sin(angleY) * z; z1 = cos(angleY) * z + sin(angleY) * x; y1 = cos(angleX) * y  sin(angleX) * z; z1 = cos(angleX) * z + sin(angleX) * y; 

3D distance:

 dist = Math.sqrt(dx * dx + dy * dy + dz * dz); 


Foundation ActionScript. Animation. Making Things Move
Foundation Actionscript 3.0 Animation: Making Things Move!
ISBN: 1590597915
EAN: 2147483647
Year: 2005
Pages: 137
Authors: Keith Peters

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net