Jump to content
GreenSock

d-sheep

Stagger with array parameter to timeline.add()

Recommended Posts

Hi, in GSAP v2 it was possible to add nested timelines to a main timeline with a stagger by specifying two additional parameters like so:

const timelines = [tl1, tl2, tl3];
const mainTimeline = new TimelineMax(...);

mainTimeline.add(timelines, 0, 'start', 0.1);

How can I achieve a stagger when adding a possibly unknown number of nested timelines in GSAP v3? It seems that this functionality has been abandoned since timeline.add() only takes 2 parameters now.

Link to comment
Share on other sites

Hey @d-sheep,

Welcome to the forums!

 

You can still pass a position parameter - so you could do something like this -
 

timelines.forEach((tl, i) => {
 mainTimeline.add(tl, i * 0.1)
})


Hope this helps!

  • 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.
×