Jump to content


Elements getting stuck during animation

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 and welcome to the GreenSock forums,


Thanks for the demo. Things are actually working as they should.


from() tweens animate a property value from the value you specify to the current value.


When your demo first loads the x of the boxes is 0% (the current value) so your animation tweens from x:100% to x:0%


However while the animation is playing you could click the button when x is 50%, in that case you will animate from x:100% to x:50%


If you keep pressing the button quickly it's very likely there will be very little distance between the current x value and the from value... which makes it appear to be stuck.


a solution in this case is to use fromTo() where you hardcode both the start and end values like:


See the Pen moYooe?editors=0010 by GreenSock (@GreenSock) on CodePen



Another issue is that you were adding new tweens to the end of your timeline on each click. There really isn't any need for a timeline for something like this, so a single TweenMax.fromTo() will work fine.

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