Jump to content
Search Community

pausing or killing the timeline once the current tween has completed animating

nolimit966 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 there,

 

I have a simple tweenMax timeline setup which has a number of headlines which appear and move around on canvas.

 

I am using the html5 'touchstart' functionality to detect if a user has swiped upwards, and if they have then pause the timeline which is currently running.

 

its easy enough to do using mainTl.kill(); which works fine, but if the animation is in the middle of the tween i need that element to finish what it is doing before it pauses.

 

I could write a function which checks if the current element is animating (boolean), then if so keep checking until true becomes false then do something but wanted to know if there was a way in GSAP this could be done.

 

Something along the lines of mainTl.kill() but if the current tween is complete.

 

I have had a search on the forum but theres nothing I can find like this which has been done before.

 

Cheers

Link to comment
Share on other sites

1 hour ago, nolimit966 said:

I could write a function which checks if the current element is animating (boolean), then if so keep checking until true becomes false then do something but wanted to know if there was a way in GSAP this could be done.

 

It's hard to advise without a demo, but you should use callbacks e.g. onComplete. There should be no reason to ever poll an animation to see if it's complete.

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