Jump to content
GreenSock

erikb

onStart not firing on empty TimelineMax

Go to solution Solved by GreenSock,

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

Came across a snag -- an empty TimelineMax does not fire its onStart events, but does fire its onComplete events.

 

In contrast to this  example:

See the Pen eZPGrb by jedierikb (@jedierikb) on CodePen

 

Is this a bug?  It seems like it might be.  

 

(I am dynamically making tweens based on incoming data, hence the perhaps odd discovery )

See the Pen EKdwoJ by jedierikb (@jedierikb) on CodePen

Link to comment
Share on other sites

Regarding the empty timeline, I imagine Jack will chime in with more specifics, but I believe it can be argued that it never started. It doesn't have a duration or any child tweens. However, perhaps it completes based soley on the fact that the root timeline passed over the point in time where the complete callback should be fired.

 

Then again it might be a bug. I think its tough to really say what one should expect when dealing with an animation that has no duration.

 

To get the results you want, for now you could just add a callback at time(0) like:

 

var tm = new TimelineMax({
  onComplete: completeThing
});


tm.call(startThing)
  • Like 1
Link to comment
Share on other sites

  • Solution

I can see valid arguments on both sides. Ultimately I do lean slightly toward making onStart fire in this case. If anyone disagrees, please chime in. I've made that update in the 1.18.5 preview which you can check (uncompressed) here: https://s3-us-west-2.amazonaws.com/s.cdpn.io/16327/TweenMax-latest-beta.js Better? 

  • Like 2
Link to comment
Share on other sites

Thanks for this patch.  I will be able to test it next week.

  • Like 1
Link to comment
Share on other sites

  • 2 weeks later...

I can see valid arguments on both sides. Ultimately I do lean slightly toward making onStart fire in this case. If anyone disagrees, please chime in. I've made that update in the 1.18.5 preview which you can check (uncompressed) here: https://s3-us-west-2.amazonaws.com/s.cdpn.io/16327/TweenMax-latest-beta.js Better? 

 

Looks good.  Thanks.

See the Pen pyYXQa by jedierikb (@jedierikb) on CodePen

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