Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
tomcrown

Update child tween start time

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,

 

Wondering if it's possible to add children to a nested timeline and have them affect previously added children.

 

Please see the codepen sample for a better explanation:

 

Thanks

See the Pen BoKopg by brancusi (@brancusi) on CodePen

Link to comment
Share on other sites

Thanks for the demo

The short answer is no, the engine does not account for automatically moving children around when you add new child elements (tweens, timelines).

 

You can change the startTime() of titleTween:

 

titleTween.startTime(5)

http://codepen.io/GreenSock/pen/vNGKEr?editors=101

 

Normally I would suggest using shiftChildren()

http://greensock.com/docs/#/HTML5/GSAP/TimelineMax/shiftChildren/

 

But the problem with your demo is that you have an empty nested timeline added at the same time as your first tween

 

tl1.add(tl2);
tl1.add(titleTween);
 
If you call shiftChildren(5) on tl1, both tl2 and titleTween will move. 
 
 
You might want to try a more dynamic approach where you create a function that re-builds your timeline when you add more things. 
  • 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.
×