Jump to content
GreenSock

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

.complete(ignore events) for timelinemax?

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

The quickest way would be to use progress() to jump to the end, with supressEvents set to true e.g.

timeline.progress(1, true);
// progress(value:Number, suppressEvents:Boolean = false)

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

  • Like 3
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

Ah I see what you mean now. GSAP doesn't currently have a built in option to do this, but here's a workaround that should have the effect you want.

See the Pen KlGdf?editors=001 by jamiejefferson (@jamiejefferson) on CodePen

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