Jump to content
Search Community

Modifier for short-rotation?

CryOfGaming test
Moderator Tag

Recommended Posts

Hello,

 

anyone any idea why this code wont print the current rotation in the console?

 

gsap.to(this, {
            duration: 2, 
            rotation: "-170_short",
            modifiers: {
                rotation: function(x) {
                    console.log(x);
                },
            }, 
            ease: "none"
        })

 

When i remove the "_short" it works perfectly fine. Thank you!

Link to comment
Share on other sites

7 minutes ago, Cassie said:

Hey @CryOfGaming

 

Welcome to the forums! 

 

 


It's logging out to the console for me. 👀

 

 

Thanks for the quick response. I used your gsap.min.js which you used in codepen now and it shows me: 

But wihtout "-short" it works perfectly fine and loggst the position.

 

 

image.png

Link to comment
Share on other sites

Just now, Cassie said:

What version of GSAP were you using before? Maybe it was an old one without that syntax available?

I opened both and both are 3.7.0
(i checked, the old one also send that warning. Did just not saw it cause my console got spammed)

Link to comment
Share on other sites

Oh, it's not broken - you're trying to animate a target that has no such property ("rotation"). :)

 

The directional rotation functionality is baked into CSSPlugin which is for DOM elements. And CSSPlugin is in the core (you don't have to load it separately). If you need to do directional rotation for generic objects, you can make a custom plugin or run your logic outside the tween so that it feeds in the already-transformed value into the rotation. 

  • Like 1
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...