Jump to content
GreenSock

Rodrigo

addPause() Issue/Question

Recommended Posts

Hi Guys,

 

I stumbled upon this rare behaviour and I'm not sure if it's happening because what I'm trying to achieve or something else.

 

I have a TimelineLite and at some point an addPause() instance in it. The timeline is not nested and doesn't have any other timeline in it, just common from and to instances, nothing fancy. I added a callback in the addPause() method.

 

What I want to achieve is to call the function when the timeline is going forward and reaches the addPause(). Then execute some code (load some resources asynchronously) and when that's done resume the timeline going forward. Then when the timeline goes back, of course it'll be paused and the callback in the addPause() will be executed. Here's when things brake. I created a boolean so when the timeline goes forward and the boolean is false load the resources and change the boolean. Then when the timeline passes through the addPause() again ignore the rest of the code in the callback and just resume so it goes back to time zero. Instead it keeps calling the addPause() callback and returning to that point in the timeline endlessly.

 

I also tried using a TweenLite instance to take the progress of the timeline back to zero but as soon as the tween is completed the timeline starts again, even if I changed the pause state of the timeline before creating the tween, which shouldn't have any effect whatsoever in the play/paused state of the timeline (uncomment lines 32-33 and comment-out line 31). The only way it works is by forcing the timeline to be paused using an onComplete callback in the tween that changes the progress of the timeline (remove inline block comment ), which IMHO it's a bit hacky and strange.

 

Rodrigo.

See the Pen azRGZe by rhernando (@rhernando) on CodePen

  • Like 2
Link to comment
Share on other sites

Rodrigo, Please step away from the computer and hand in your badge.

 

;)

 

Thanks for the demo. Yup, seems you found an issue in 1.16.0.

 

A temporary fix is to use: 

tl.resume(tl.time()-0.001); 

which will just nudge the playhead an eensy weensy teensy bit in front of the addPause().

 

Expect to see a fix in 1.16.1 very soon.

 

Thanks!

  • Like 3
Link to comment
Share on other sites

Rodrigo, Please step away from the computer and hand in your badge.

 

;)

This is what happens when you make the guys in the top floor look bad... :rolleyes:

 

The fix works great. I'll be waiting for the official release (if my badge has been returned of course ;)).

 

Thanks buddy!!

Happy Tweening!!

  • Like 3
Link to comment
Share on other sites

Thanks Jack!!

 

Problemo solved as usual.

 

Happy Tweening!!

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