Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
Daniel.Vintan

Issue with TimelineMax .pause()

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

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