Jump to content
Search Community

.complete(ignore events) for timelinemax?

IsDon test
Moderator Tag

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,

 

Just wondering if there's a nice way to complete a timelinemax without stopping for events on the way through? the play() and fromTo() functions have a ignoreEvents, but it seems to be only for ignoring events while setting the playhead initially, not while playing.

 

Tweens have a complete() that seems to have a ignoreEvents() that ignores events from the time set through to the end of the tween. Is this possible with Timeline?

 

Thanks,

 

Don

have a great day

 

PS. I'm very pleased to finally have the opportunity to grab a Club Greensock membership, which will happen in the next week.

Link to comment
Share on other sites

Also, I'm not sure where you are reading about complete() and ignoreEvents(), but they don't exist in GSAP...

 

 ahh, I am only just starting to use GSAP in js, been playing with it for actionscript for a couple of years now.

 

What I'm after, and why progress(1,true) doesn't help, is I want the animation to finish up, no matter where it was up to - I have a stop event in the middle of the timeline, but if the page moves to another state, I want the animation to play through to completion so the elements disappear without just blinking out of existence.

 

Would doing a tween of the timeline progress from current_time to 1 be the way to do this?

 

Don

have a great day

Link to comment
Share on other sites

Well... Jamie is faster than I am :mrgreen:

 

I also cam with a workaround but a little different from Jamie's approach:

 

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

 

Rodrigo.

 

PS: Jack a question, in the codepen if you comment out line 34 ( tl.pause(0) ) and try to remove the callback while the timeline's playhead is at the end, the callback isn't removed. Why is that?

  • Like 1
Link to comment
Share on other sites

Thanks to you both - I will grab Jamie's function as it will work straight out of the box and is nice and reuseable, but I was wondering about doing it the second way too.

 

Cheers,

 

Don

Have a great day

Link to comment
Share on other sites

PS: Jack a question, in the codepen if you comment out line 34 ( tl.pause(0) ) and try to remove the callback while the timeline's playhead is at the end, the callback isn't removed. Why is that?

 

Thanks for pointing that out, Rodrigo. It should be resolved in the next update. It had to do with the fact that when a timeline completes, it marks its tweens as eligible for garbage collection, and that was preventing them from being found when the remove() was looking for them in this particular scenario. 

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