Jump to content
Search Community

NaN Values break in GSAP3.2.0 , worked well in 3.1.1

themepunch test
Moderator Tag

Recommended Posts

Hi Guys ! Just realised a small change in the last version which had crazy  influences some of our functions.
If in the Vars any attribute get a NaN Value, the rest of the animation will break, or will only partly work. 
These NaN values were "ignored" and/or somehow handled in version 3.1.1 and older, so the Animation could work once they get the right values.

 

I made you two examples:  

Version 3.1.1 -> 

See the Pen GRJreJg by themepunch (@themepunch) on CodePen

Version 3.2.0 -> 

 

I can understand that we should take care of NaNs and Undefined values on our side, however  you can maybe also ignore values like NaN, undefined, so nothing else breaks on the row in following animations.  

I don't want to push things from our side to your side, of course i will fix things in my functions, however this is maybe relevant for you and you want to handle it  also ?

See the Pen gOpgEpp by themepunch (@themepunch) on CodePen

  • Thanks 1
Link to comment
Share on other sites

Thanks for the reduced test case! Yeah, this was an interesting side effect of an internal change in the way rounding was done. Previously, ~~(value * 10000) / 10000 was used whereas now it's Math.round(value * 10000) / 10000 but the bitwise operator would take NaN and make it 0 whereas Math.round() won't. Ha. 

 

Anyway, I'll add some code to work around this edge case in the next release: https://s3-us-west-2.amazonaws.com/s.cdpn.io/16327/gsap-latest-beta.min.js

  • Like 3
Link to comment
Share on other sites

2 hours ago, GreenSock said:

Thanks for the reduced test case! Yeah, this was an interesting side effect of an internal change in the way rounding was done. Previously, ~~(value * 10000) / 10000 was used whereas now it's Math.round(value * 10000) / 10000 but the bitwise operator would take NaN and make it 0 whereas Math.round() won't. Ha. 

 

Anyway, I'll add some code to work around this edge case in the next release: https://s3-us-west-2.amazonaws.com/s.cdpn.io/16327/gsap-latest-beta.min.js

Thank you very much for the quick solution ! Really appreciate it ! You guys are the best ! 

  • Like 1
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.
×
×
  • Create New...