Jump to content

Andrew Harris

GSAP v3 Object Tweening Wrong when large number

Recommended Posts

Hiya all! i recently tried updating my site to using GSAP v3.

I have a couple transitions that relied on GSAP tweening object values, it all worked perfectly, but now GSAP is updating the object with incorrect values and ending on the wrong final value.


Check out my codepen for a bare minimum reproduction of the issue. The expected end state is 10000000 but GSAP is ending the tween with 121575.2192. In some cases i've seen it end with a negative number.

It seems to work perfectly fine with smaller numbers under ~100000

Anyone aware of why this is happening or a way around this issue?

Thank you!

See the Pen KKKYawR by andrewmumblebee (@andrewmumblebee) on CodePen

Link to comment
Share on other sites

This has been fixed in the next release.





  • Like 3
Link to comment
Share on other sites

Awesome cheers!

As a temporary workaround, as it can handle smaller numbers, you can divide the expected number by a factor (i.e. 10000) to make GSAP properly handle it, then in the "onUpdate" method undo the division.

However, this adds extra calculations to the tween which is less than ideal.

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.