Jump to content
Search Community

Simple card flip code. One should work and doesn't; the other works and shouldn't. GSAP2 vs GSAP3?

SJH test
Moderator Tag

Go to solution Solved by GreenSock,

Recommended Posts

I'm simply flipping a card but I don't understand why one line of code works and the other doesn't.

Could someone please explain why this code in GSAP3  doesn't work:

gsap.to(targetObject, { duration: 2, rotationY: "+=180" });

And this version does work, even though the to of gsap.to is struck out in VSC:

gsap.to(targetObject, 2, { rotationY: "+=180" });

 

Link to comment
Share on other sites

2 hours ago, SJH said:

And this version does work, even though the to of gsap.to is struck out in VSC:



gsap.to(targetObject, 2, { rotationY: "+=180" });

 

 

Did you hover over it? It should say that syntax is deprecated. Deprecated means you shouldn't use it because it will probably be removed in the future but will work for the time being to give developers time to migrate to the newer syntax.

 

Link to comment
Share on other sites

Both of your replies are correct: I ran the GSAP 3 code (

gsap.to(targetObject, { duration: 2, rotationY: "+=180" });

today and it worked  perfectly!

OSUblake: yes, the syntax notes warned me the second solution was deprecated.

Thank you both for your quick reply.

Maybe this small thread can help someone else in the future.

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