Jump to content
GreenSock

kaidean

Getting current rotation of object

Moderator Tag
Go to solution Solved by kaidean,

Warning: Please note

This thread was started before GSAP 3 was released. Some information, especially the syntax, may be out of date for GSAP 3. Please see the GSAP 3 migration guide and release notes for more information about how to update the code to GSAP 3's syntax. 

Recommended Posts

Hello all, I am new around these parts and I am having a slight issue...

 

Is there a way for me to get the current rotation of an object? I am making a spinning wheel activity, I want the wheel to spin at least twice before settling in its final position, for the first spin this works fine but after that it just rotates round to the next stop rather than going round twice first.

 

Currently the code I am using is:

 

rotation:(degArray[a] + minSpin) + "_cw"

 

"degArray" is where the randomised values are stored and "minSpin" is a variable set earlier (currently set to 720).  What I feel I should be able to do is something like this:

 

rotation:(currentRotation + degArray[a] + minSpin) + "_cw"

 

I am using this in JS within Adobe Edge Animate.

 

Thanks in advance

 

Kai

Link to comment
Share on other sites

Hi kaidean  :)

 

you can get current roation value by this : element._gsTransform.rotation

 

for example :

TweenLite.set("#Stage_Ellipse",{rotation:270});

console.log( document.getElementById("Stage_Ellipse")._gsTransform.rotation );
  • Like 2
Link to comment
Share on other sites

  • Solution

 

Hi kaidean  :)

 

you can get current roation value by this : element._gsTransform.rotation

 

for example :

TweenLite.set("#Stage_Ellipse",{rotation:270});

console.log( document.getElementById("Stage_Ellipse")._gsTransform.rotation );

 

Perfect, thanks a lot!

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.
×