Jump to content

Thomas James Thorstensson

TimelineLite seems useful almost always (over TweenLite alone)

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

Hello again


Looking at the documentation and having used it a lot in the past days, it seems to me that TimelineLite can almost always be used. Since from your own example it can be written in two ways:=

//add another tween at the end of the timeline (makes sequencing easy)
tl.add( TweenLite.to(element, 0.5, {opacity:0}) );

//append a tween using the convenience method (shorter syntax) and offset it by 0.5 seconds
tl.to(element, 1, {rotation:30}, "+=0.5");

The second way above is very similar to how you would write if using TweenLite.to( etc...)


So I wonder if there's any good reason to not always use TimelineLite- it seems to inherit the same callbacks too ?


Thanks in advance



Link to comment
Share on other sites

Sure, a timeline is just a container for tweens. There isn't really a down side to wrapping your tweens in a timeline other than a very very slight performance degradation only because there's an extra function call during each render (I can't imagine you'd notice any difference unless maybe you're running tens of thousands of tweens simultaneously...but even then you may not notice). Totally up to you. And of course timelines can be slightly more verbose to create initially. Again, minor point. I'd say use whatever "feels" best to you from a stylistic standpoint. 

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