Jump to content
Search Community

Can't get the rotation values from rotated object

Heelaque test
Moderator Tag

Go to solution Solved by Carl,

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 everyone,

 

I'm continuing to develop this project and I've come across a small problem:

 

I'm trying to make a rotating black-block swing 270 degrees once it leaves its container-box (clockwise or counter-clockwise) so that once it leaves it suddenly begins re-entering the box again.

 

To do this I'm trying to get the object's current rotational value so that once it reaches a certain degree-value - it swings 270 around and re-enters.

 

I'm having difficulty with the [_gsTransform] in the "console.log" (which is why I've commented it out) can anyone please figure-out why it's not working?

See the Pen fKLjq by anon (@anon) on CodePen

Link to comment
Share on other sites

  • Solution

a few problems

 

1: your code was in a weird spot in between if / else blocks.

2: the ._gsTransform object is placed on any target of a tween, you were referencing the target of a DOM element (which doesn't exist)

 

try this

 

console.log(Math.round(bRing._gsTransform.rotation));

 

 

http://codepen.io/anon/pen/emOaXq?editors=001

  • Like 3
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.
×
×
  • Create New...