Jump to content
Search Community

Issue with TimelineMax .pause()

Daniel.Vintan test
Moderator Tag

Go to solution Solved by CraigWheatley,

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,

 

Trying to wrap the GSAP into a standard interface i bumped into an issue calling .pause() method to several timelines.

 

Please take a look at this fiddle:

 

https://jsfiddle.net/_Ovidiu/x5m690Ld/

 

1. From drop-down selelect "Sprite animation"

2. Click "Start Animation"

3. After 3 seconds click "Pause animation"

 

result:

The console logs that the timeline is paused but the animation still runs.

 

Please help.

 

Thanks

See the Pen by _Ovidiu (@_Ovidiu) on CodePen

Link to comment
Share on other sites

  • Solution

Hello!

 

So in your code it only took a second to see you're running .Pause() and .Resume() on the click event of btn2.

  $('#btn2').click(function(){
  
  	Actions[iCurrAction].Pause();

  });
  $('#btn2').click(function(){
  //alert('C');
  	Actions[iCurrAction].Resume();
  });

Both of these run and so the animation pauses then immediately resumes.

 

I'm assuming you want the resume to trigger on the click event of btn3, not btn2 ;)

Changing the Resume event trigger to btn3 solved your issue and also made the resume button work :)

 $('#btn2').click(function(){
  
  	Actions[iCurrAction].Pause();

  });
  $('#btn3').click(function(){ // changed to #btn3
  //alert('C');
  	Actions[iCurrAction].Resume();
  });
  • Like 5
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...