PDA

View Full Version : 3D translation



geeem
January 6th, 2010, 07:38 AM
Hi

Hope someone can help...
I've created a motion tweened 3D animation that I now want to recreate using AS3. But how do I achieve the AS3 equivalent of switching from the 3D Translation Tool's Local Transform option?
Trying to do it in code, I've written the following on a button (I want the animation to occur as I roll over the button)...

import fl.transitions.Tween;
import fl.transitions.easing.*;

words_mc.rotationY = -60

words_btn.addEventListener(MouseEvent.ROLL_OVER, rollOver1)
function rollOver1(event:MouseEvent):void {
var move1:Tween = new Tween(words_mc,"x",Strong.easeOut,-215,400,2,true)
var move2:Tween = new Tween(words_mc,"z",Strong.easeOut,-215,-340,2,true)
}

With this code the mc slides on the stage from left to right, but not with the correct 3D perspective. To do that, the tween needs to be switched from global to local. But How?

Any help would be much appreciated.

creatify
January 6th, 2010, 03:42 PM
I'm not quite sure what you're asking, but, it seems to me that you need to set the projectionCenter? I guess I'm asking if you want to avoid the clip from appearing to skew while it's moving across the stage? You can place your word_mc within a container, and set the projectionCenter on the container, the child clips should then adhere to that. But, depending on what you're wanting to do, you have want to tween the x axis of the container, and then the z axis of the child words_mc clip.

import flash.geom.PerspectiveProjection; (http://help.adobe.com/en_US/AS3LCR/Flash_10.0/flash/geom/PerspectiveProjection.html)


var pp:PerspectiveProjection = new PerspectiveProjection();
pp.projectionCenter = new Point(123,123);
// can set this on root or any container DisplayObject
root.transform.perspectiveProjection = pp;

Hope this may help in some fashion.

geeem
January 9th, 2010, 05:47 PM
Thank you creatify. Your suggestion is much appreciated - and I'll explore this further.