Jump to content


rotationZ & rotationY

Moderator Tag

Recommended Posts

Hello everybody!!!


I'm newbie in this forum and I have one question. I'm trying to animate a movieClip first in z-axis (e.g 45 degrees) and then in Y-axis (e.g.90 degrees). If I do only the one rotation its OK,

TweenMax.to(cont, 1, {rotationZ:-45});


TweenMax.to(cont, 1, {rotationY:90});


but when I'm trying to do first the one an then the second or both together like this

TweenMax.to(cont, 1, {rotationZ:-45, rotationY:90});

I have a problem, the result is not what I expected to see. Did you have any idea??


Thanks in advance!!!


p.s. I have attached a simple .fla & .swf file.


Link to comment
Share on other sites

Hi konstantinos,


I looked at your file. I didn't see any unexpected behavior.

hitting rotationZ and then rotationY gave same results as hitting rotationZ+Y


its a little tricky to follow because you have an object rotated in 3D space inside the object that your tweening in 3D, but if you focus on the tweens as they apply to the container, it seems like it is working properly.


just for kicks add this code after your addChild(cont)



var reference:_test = new _test();
TweenMax.to(reference, 0, {tint:0xff0000});


this will allow you to see how the cont is being tweened.


perhaps I'm misunderstanding what issue you are experiencing.

Link to comment
Share on other sites

Hello Carl! Thank you for the respond!!!


I probably did not explain properly what the problem is.I want to have a container that contains one or more objects and one of this objects for example the green object will be rotated by Z-axis 45 degrees (image: attached file: steps.zip/step0.jpg).


So I want to tween the container and the green object be in vertical position.(image: attached file: steps.zip/step1.jpg).


And then I want to tween the container in Y-axis 90 degrees and the green object will be in horizontal position (image: steps.zip/step2.jpg).


But instead of this (image: attached file: steps.zip/step2.jpg) I got this (image: attached file: steps.zip/wrongStep.jpg).


I know that if I rotate only the green object I'll have the result that I expect. But if there is more than one objects, for example 10 objects...


I really try to find the way to be able to tween container and all nested object will tween in the same time. But I think is impossible.


Thank you all in advance!



Link to comment
Share on other sites

Hi Konstantinos,


First, my apologies for the delayed response. I was without internet for 4 days and am just getting caught up on things.


Your new file and description are very helpful. I think you are absolutely right in thinking that this approach is going to be problematic once more objects are added to the container.

You may be able to have each object (like the green clip) in its own container that gets rotated.

That could get kind of tricky to manage the rotation properties of all the container and child elements.


Unfortunately I am at a loss for the best solution to this problem.

Link to comment
Share on other sites

3D rotation is indeed a very thorny issue. I can't explain all the issues involved or the possible solutions (it would take pages and pages plus a fair amount of research), but you may need to look into directly manipulating the transform.matrix3D and doing matrix multiplication or using quaternions. Basically it looks like you're wanting to describe the rotation in terms of absolute "world" axis but I don't think that's how Flash operates by default.


Again, I wish I had a simple solution to offer you, but I figured that at least recommending that you look into direct matrix3D manipulation or quaternions might at least get you pointed in the right direction even if you have to do a lot of Googling to find detailed explanations and recommendations.

Link to comment
Share on other sites


Thanks Carl and Thanks Jack for the respond!!! I really appreciate that you two tried to find a solution. I'll take a look at transform.matrix3D and if I found something interesting I'll let you know!!!



Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.