Jump to content


Overwrite mode 'complete'?

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, I'm trying to figure out how to make a tween autocomplete when it is overwritten. I have something rotating by '+=180', so if it is interrupted, it ends up at an odd angle. Is there an easy way to do this in GSAP JS?




Link to comment
Share on other sites

Hi, I don't know if I'm following you exactly. 


Is your tween being interrupted or overwritten? Overwriting happens when a new tween tries to tween the same properties on the same target of an existing tween. If all the properties of the new tween match all the properties of the old tween, the old tween will be killed and destroyed so it won't ever complete. 


I would need more clarification on what is interrupting your tween, but I'm assuming a new Tween is being created that rotates to a value 180 degrees more than the current rotation value. If the current rotation value at the time that happens isn't an increment of 180, you are then going to land somewhere other than an increment of 180.


Please see this example that forces a rotational tween to always land on 90 degree increments. 

See the Pen ad91fe3b1071d26d2abc41104ba82134 by GreenSock (@GreenSock) on CodePen


If it is different than what you need, please fork the example and try to provide a simulation of what you are experiencing.


Furthermore, you could test to see if the object is already tweening, and if so ignore the button click OR force the tween to completion. Again, I'm not totally clear on what you are trying to accomplish.

  • Like 1
Link to comment
Share on other sites

Your example is pretty close to what I was asking.


There are some specific complexities in my project which makes incrementing by 180 easier than doing your click tracking method, but it is a valid solution.


In essence, 'forcing the tween to completion', is indeed what I am trying to do. I was just seeing if there was an automated way of doing that when the tween was to be overwritten, rather than keeping track of the affected tweens and doing it manually.

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.