Share Posted July 19, 2019 Hello, I am discovering GSAP and I did an exercice with TweenMax, And I don't understand why I have to write : TweenMax.set('....', {transformPerspective: xxx}); If I write the same thing with TweenMax.to and it don't works ... Can someone tell me when we have to use the 1st one and the 2nd one ? Link to comment Share on other sites More sharing options...
Share Posted July 19, 2019 Hey Jeff and welcome to the forums! The .set method is essentially a .to but with a duration of 0. But it's used to set properties of an element without an animation. It makes sense to use it for a transformPerspective because you don't (usually) want to animate that property. However, it should work for you if you do TweenMax.to('.foo', 0, {transformPerspective: xxx}); I'm guessing you just forgot the animation duration in the .to call (the second parameter). Does that help? For more information, check out their docs pages: TweenMax.set and TweenMax.to. Link to comment Share on other sites More sharing options...
Share Posted July 19, 2019 Without a codepen demo to see the context, it'd difficult to know for sure but typically it's best to just set a perspective on the parent element rather than a transformPerspective on the element itself. I assume you're doing some 3D-related transforms? 2 Link to comment Share on other sites More sharing options...
Author Share Posted July 21, 2019 Hi, Thank you all for your answers it helps me to understand Yep I wrote : TweenMax.set('#box',{transformPerspective:600}); TweenMax.to('#box',4,{rotationY:360}); 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