Share Posted July 14, 2021 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 More sharing options...
Solution Solution Share Posted July 14, 2021 Seems to work perfectly: See the Pen 4732a3a8097ca74af0bde38b59d8d92c?editors=0010 by GreenSock (@GreenSock) on CodePen If you're having trouble, please always provide a minimal demo so we can see what's going on in your particular context. We'd love to help, but it's just tough to troubleshoot blind. Link to comment Share on other sites More sharing options...
Share Posted July 14, 2021 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 More sharing options...
Author Share Posted July 14, 2021 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now