Taylan Posted December 16, 2020 Share Posted December 16, 2020 E.g. gsap.utils.snap(0.05, -0.16) returns -0.16 instead of -0.15. Probably caused by combination of negative & floating point numbers. See the Pen dypWYpK by taylankasap (@taylankasap) on CodePen 1 Link to comment Share on other sites More sharing options...
ZachSaucier Posted December 16, 2020 Share Posted December 16, 2020 Another probably related situation where it doesn't snap exactly: gsap.utils.snap(-0.05, -0.13) // -0.151 instead of -0.15 Thanks for reporting this, Taylan. We'll get it fixed in the next version. 2 Link to comment Share on other sites More sharing options...
GreenSock Posted December 18, 2020 Share Posted December 18, 2020 This should be resolved in the next release which you an preview at https://assets.codepen.io/16327/gsap-latest-beta.min.js FYI, it has to do with tiny imprecisions in JavaScript math (floating point, as you mentioned) and the fact that Math.floor() works in the opposite direction for negative values. Like Math.floor(-150.00000000000003) is 151 instead of -150. 😐 Sorry about any confusion there. 2 1 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now