greensock / GSAP

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

properties get calculated wrong when tweening #123

Closed firsara closed 8 years ago

firsara commented 8 years ago

just noticed this bug after upgrading from 1.16.1. Here's a simple example that illustrates the issue:

<button id="button">Button</button>
<script>
document.getElementById('button').style.opacity = 0;
TweenLite.to(document.getElementById('button').style, 2, {opacity: 1});
</script>

the tween renders fine but finishes at opactiy 10 instead of 1 (setting different easings like Quint.easeIn) makes it look even worse.

Did not look into the code in detail myself but would be nice if you have a hint so I can look at it myself.

jackdoyle commented 8 years ago

Ah, very interesting - that has to do with the fact that the object you're tweening is returning a STRING as the from value rather than a number. I'll apply a workaround in the next update. Thanks for letting us know. In the mean time, you could just use CSSPlugin or tween a proxy object and use an onUpdate to apply the value.

firsara commented 8 years ago

Ah ok got it, thanks for pointing out the CSS Plugin! Was just strange for me as it used to work "correctly" in earlier versions...

jackdoyle commented 8 years ago

This should be resolved in the latest update (1.18.1). Thanks again for pointing it out.