Jump to content
Search Community

TimelineMax - AppendMultiple?

aholla test
Moderator Tag

Go to solution Solved by Carl,

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

Hi, I would like start multiple tweens at the same time with different delays. In the past I used "append" or "insert" with something like:
 

timeline.appendMultiple([ 
     TweenLite.from(bar1, 1, {scaleY:0, delay 0.1}), 
     TweenLite.from(bar2, 1, {scaleY:0, delay:0.3}), 
     TweenLite.from(bar3, 1, {scaleY:0, delay 0.7}), 
], 0, TweenAlign.NORMAL, 0);

 or:

timeline.insert( TweenLite.from(bar1, 1, {scaleY:0}), 0.1 ); 
timeline.insert( TweenLite.from(bar2, 1, {scaleY:0}), 0.3 );
timeline.insert( TweenLite.from(bar3, 1, {scaleY:0}), 0.7 );

But neither of these are documented so I guess there is a "proper" way to do it. How would I achieve the above using the preferred way?
 
Thanks,
 
Adam

Link to comment
Share on other sites

  • Solution

Hi it looks like you've been with us since the Flash days. Very cool.

 

appendMultiple / insertMultiple have been deprecated in favor of a much more flexible add() method

So to add an array of tweens to a timeline and stagger the start times you would do this

 

//add an array of tweens so that they are sequenced one-after-the-other with 0.5 seconds inbetween them, starting 2 seconds after the end of the timeline
 tl.add([tween1, tween2, tween3], "+=2", "sequence", 0.5);

Check out the docs for add() 

 

If you are used to insert() and append(), those are deprecated too in favor of new "convenience" methods of TimelineLite/Max like to(), from(), fromTo(), staggerFrom() etc that have a much more concise yet flexible syntax thanks to our fairly new "position" parameter.

//old 
tl.append(TweenLite.to(obj, 1, {x:200}));

//new
tl.to(obj, 1, {x:200});

The absolute best thing to do is watch the video and study the demos here: 

http://greensock.com/position-parameter

 

I think you will find this syntax much easier to work with.

  • Like 2
Link to comment
Share on other sites

Hi Carl, thanks for the fast reply and yeah I've been using TweenMax for some years, thanks for all your hard work!

 

I think I will go with the "to" method as it seems the most flexible.

 

Thanks!

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