Jump to content


set vs 0 in TimeLines

Recommended Posts

Hi, I wondered why the only way I can trigger a quick reveal in Nested Timelines, is by using a duration longer than 0. 


As you can see in the CodePen example, the Blue, Green and Yellow circles should reveal themselves halfway through the Red circle's Timeline, but .set and a duration of 0 trigger initially, whereas the only way round it is to use 0.00001


See the Pen MEpVNd by friendlygiraffe (@friendlygiraffe) on CodePen

  • Thanks 1
Link to comment
Share on other sites

Thanks for providing the clear demo.


The reason the set() and 0-duration tweens rendered immediately is they were the first things added to their parent timelines at a time of 0.

A tween with no duration (and set()) are tricky beasts in that they technically need to complete as soon as they are created because they don't have any duration. When they are the first thing in a timeline (at time 0) the engine needs to render them in their completed state the instant the timelines are created. Something with no duration, that starts at a time of 0 needs to complete instantly (render immediately).


If the set() and 0-duration tweens were added at a start time of anything other than 0, they would wait to the scheduled time to complete.


var stl1 = new TimelineMax();
    stl1.set(div, {autoAlpha:1}, 1); //render at 1 second



When your timelines that include the set() and 0-duration tweens are created they have no idea that they are being nested into another timeline and scheduled to actually run 2 seconds later. 


The way you can use set() and 0-duration tweens in your setup is to set immediateRender to false as shown below:


See the Pen boqmpN?editors=0010 by GreenSock (@GreenSock) on CodePen




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