Jump to content
Search Community

Diffrences between TimelineMax.to() and TweenMax.to()

BornToCreate test
Moderator Tag

Warning: Please note

This thread was started before GSAP 3 was released. Some information, especially the syntax, may be out of date for GSAP 3. Please see the GSAP 3 migration guide and release notes for more information about how to update the code to GSAP 3's syntax. 

Recommended Posts

I would agree with Blake on this. If i can remember, Carl, also recommended just using the convenience methods to(), from(), etc instead of using add() with a TweenMax/Lite instance in it.

 

I had asked GreenSocks Mighty Carl about the same thing and he told me the following about add()

  • add() is tricky because although its super flexible, we only really use it for adding nested timelines and labels and perhaps the occasional callback without parameters.

  • For adding tweens to a timeline, the convenience methods (to(), from(), staggerFrom() etc)  do the exact same thing but with less code. The flexibility of the position parameter made append() and insert() totally obsolete. So no need to use add(TweenMax.to()) .. just use the convenience methods (to(), from(), staggerFrom() etc)

  • Besides nesting timelines the only unique thing add() can do is allow you to add an array of tweens and change the alignment. Like appendMultiple() and insertMultiple() used to do.

But Carl and Jack could explain it better than i ever could.

 

I also agree with Blake, that it helps with improving readability like Blake said above, when you use a convenience method like to() over add(TweenMax.to())

 

Also the difference between TimelineMax.to() and TweenMax.to() is that TimelineMax.to() is used in creating sequenced timelines, even though you could also use TweenMax by associating with a variable instance. But TimelineMax/Lite is the preferred method in creating timelines, especially nested timelines.

 

Here is a link to both in the GSAP Docs so you can see the differences between TweenMax.to() and TimelineMax.to():

Just my two cents, with a side of lint. :)

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