Jump to content
GreenSock

tpav

Pause event edge case

Go to solution Solved by OSUblake,

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

Let's say on an event such as a modal window opening you want to pause an animation that may or may not the on the page like in a case where you're A/B testing with and without animation. This works great.

if (typeof(myGSanimation) !== 'undefined') {
        myGSanimation.pause();
}

Now, what if there may be any number of animations being tested and you don't know what timeline to reference?

 

Is there a strategy for catching any Greensock timelines other than standardizing on a few timeline names and checking for each? 

Link to comment
Share on other sites

Yup, Blake is exactly right.

The use case you describe "stopping all animations on a page when a modal opens" is exactly what we are doing on the GSAP page:

 

http://greensock.com/gsap

press the download button and the animation will stop.

close the modal and it will resume.

 

All done with exportRoot()

 

it's one the 7 Hidden Gems of GSAP too :)

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