Share Posted May 23, 2022 Hi there, I just came across a small issue related to the gsap.utils.snap function (gsap version 3.10.4): gsap.utils.snap(0.01, 0.29); // Returns 0.28 instead of 0.29 I know that I could use other ways to get float number with 2 precision points but this function is very handy Link to comment Share on other sites More sharing options...
Share Posted May 23, 2022 Great spot! Thanks for finding this. We'll look into it. 1 Link to comment Share on other sites More sharing options...
Solution Solution Share Posted May 23, 2022 Ah, the joys of weird binary math issues. Check this out: console.log(0.29 * 100); // should be 29 but returns 28.999999999999996! 🤥 I've added some code to work around that issue in the next release which you can preview at https://assets.codepen.io/16327/gsap-latest-beta.min.js 2 1 Link to comment Share on other sites More sharing options...
Share Posted May 23, 2022 It's time for the wat-duck again. 3 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