Jump to content


TimelineMax - seek(mylabel) - firing all onComplete events

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

I don't know. What am I doing wrong?


My code is essentially like this:
var tl = new TimelineMax({paused:true})
tl.to($("#pin"), 1, {x:455,y:198, onComplete:myFunction, onCompleteParams:["params"]}) 
.to($("#pin"), 1, {x:737,y:307}) 



using play(), resume(), seek(), it doesn't matter, it always trigger all events on the way.


Link to comment
Share on other sites

And using call(myfunction) instead of oncomplete event, do the same. 

Link to comment
Share on other sites

Hi Giovani and welcome to the GreenSock forums.


Some methods, seek() among them, have a second parameter, a boolean to be more specific, which indicates whether callbacks should be ignored or not. By default this is false, so the engine should ignore any callbacks during the seek, so your code should work as you expected.




So there's two thing to consider, first be sure that you're using the latest version of the engine and second please provide a reduced sample in codepen in order to see what could be the issue:





  • Like 1
Link to comment
Share on other sites

Thanks, Rodrigo.


It seems though that Giovani did uncover a regression that slipped in with version 1.12.0.

The short story is that when tweens that weren't yet initialized were sent off to be "lazy" rendered, their events were not being suppressed properly.


The good news is, there is now a fix in place in version 1.13.2 (attached)




Sorry for the hassle and thanks for reporting the issue.

Here is a very basic CodePen example that uses a pre-release of 1.13.2.



Very similar to your code and you will see that events are now properly being suppressed.


Please grab the pre-release version of 1.13.2 (below) and test with your code.

If you find errors, please fork the codepen demo I provided so that we can quickly hunt them down. We've tested and I'm confident it should work properly.


Thanks and sorry again for the trouble.



Edit: in methods like pause(), play(), seek(), time() the suppressEvents parameter is true by default.


  • Like 1
Link to comment
Share on other sites

What I am doing is basically like that:


See the Pen FbozA by anon (@anon) on CodePen


But after a couple of non sleeping nights, I figured out that using the version 1.11.0 it doesn't happen


Both seek("myLabel") and play("myLabel") suppress the events like expected.



Link to comment
Share on other sites

Thank you, it's working fine with 1.13.2

  • Like 2
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.