Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
jeff2019

TweenMax.to OR TweenMax.set

Recommended Posts

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 post
Share on other sites

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 post
Share on other sites

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? 

  • Like 2
Link to post
Share on other sites

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

×