Thank you so much!!! I will try this.

2010/4/22 Olivier Besson <[email protected]>:
> Perhaps this formula will help:
>
> function applyPerspective(pMC:MovieClip, x:Number, y:Number):Void
> {
>   var centerX:Number = 200; // center of 2D-scene (X)
>   var centerY:Number = 200; // center of 2D-scene (Y)
>   var distCenter:Number = 60; // distance of the perspective plan to the
> center of 3D world
>   var lensFocal:Number = 200; // perspective focal
>   var cameraAngle:Number = -45; // x-angle of camera
>   // 3D coordinates
>   cameraAngle *= Math.PI/180; // convert to radians
>   var z:Number = distCenter + y * Math.sin(cameraAngle);
>   y *= Math.cos(cameraAngle);
>   var s:Number = lensFocal/ ( lensFocal + z); // ratio
>   // 2D coordinates & render:
>   pMC._x = centerX + s * x;
>   pMC._y = centerY + s * y;
>   pMC._xscale = pMC._yscale = s * 100; // TODO: ajust scale
>   pMC.swapDepths(int(2000 + 1000*pMC._y + pMC._x)); // a simple z-sort
> formula
> }
>
> usage (in your case):
> applyPerspective(mc, radius*Math.cos(mc.angle), radius*Math.sin(mc.angle));
>
> You will probably have to try-and-guess by adjusting initial setup
> variables.
> You can achieve nice 3D effect by connecting some property (example:
> cameraAngle) with _ymouse.
>
> --
> Olivier Besson (gludion) - (33 1) 44 64 78 99
> http://www.gludion.com
> http://blog.gludion.com
>
> _______________________________________________
> Flashcoders mailing list
> [email protected]
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>

_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to