Share Posted May 19, 2014 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 More sharing options...
Share Posted May 19, 2014 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... 3 Link to comment Share on other sites More sharing options...
Author Share Posted May 20, 2014 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 More sharing options...
Share Posted May 20, 2014 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 3 Link to comment Share on other sites More sharing options...
Share Posted May 20, 2014 Well... Jamie is faster than I am 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? 1 Link to comment Share on other sites More sharing options...
Author Share Posted May 20, 2014 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 More sharing options...
Share Posted May 22, 2014 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. 1 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now