Jump to content
GreenSock

RolandSoos

What is the right way to merge multiple parallel timeline into one

Recommended Posts

For example I have 2 timelines and both contains several tweens. These two timelines are placed to a main timeline both of them to position 0.

See the Pen QzVYyP?editors=0010 by mm00 (@mm00) on CodePen

 

If I would like to remove the two additional timelines, what would be the best way to place the tweens to the timeline. (Try to think in general with a lot of involved tweens.)

 

 

Getting the .recent() tween from the timeline and sum .startTime() and .totalDuration() of the tween is the right way to get the upcoming position of that tween?

 

See the Pen oJPmGp?editors=0010 by mm00 (@mm00) on CodePen

 

Link to comment
Share on other sites

You're trying to empty one timeline into another? Yeah, you could just getChildren() and loop through and add() them to the other. But it isn't as if it's expensive to have nested timelines, so don't feel like you NEED to do that to somehow avoid a performance problem. There are even some cases where having things nested could lead to improved performance (though I highly doubt it'd be noticeable).  

  • Like 2
Link to comment
Share on other sites

Thanks, if it does not improve performance, then I will stay with multiple nested timelines. 

 

(I had a misunderstanding with immediateRender and I thought the nested timelines cause the issue. I thought if I have multiple fromTo tweens on the same element and same properties in the same timeline, then I do not have to take care setting immediateRender to false when required. Well, it turned out I have to take care of it :) )

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