greensock / GSAP

GSAP (GreenSock Animation Platform), a JavaScript animation library for the modern web
https://gsap.com
19.84k stars 1.72k forks source link

display error when data is big #379

Closed xudamin closed 4 years ago

xudamin commented 4 years ago

I use TweenLite/TimelineMax to translate 0 to 1000000, the result display wrong. here are some picture: 139197F7-8C14-4b19-84D4-46D520FFFFB0 9438022B-36FD-46b9-87A2-90ACA7DCC3E7 I expect height from 0 to 1000000. the result is wrong。 but when I transform height from 0 to 100000. the result is correct。

xudamin commented 4 years ago

here is the bug code. let test = {height: 0} let tl = new TimeLineLite({ onUpdate: function() {console.log(test.height)} }) tl.add(TweenLite.to(test, 2, {height: 1000000}))

OSUblake commented 4 years ago

Works fine here. https://codepen.io/osublake/pen/20c890a27a391f9d4a05b596519b2ea9

Make sure you're using the latest version. There was a bug in older version for large numbers.

OSUblake commented 4 years ago

BTW, TweenLite, TweenMax, TimelineLite, and TimelineMax are deprecated.

gsap.timeline({
  onUpdate() {
    console.log(test.height)
  }
})
.to(test, {
  duration: 2,
  height: 1000000
})
ZachSaucier commented 4 years ago

Perhaps you're using an old version of GSAP? There was a bug in an earlier version of GSAP 3 that had this issue.