Demigiant / dotween

A Unity C# animation engine. HOTween v2
http://dotween.demigiant.com
Other
2.33k stars 348 forks source link

ChangeEndValue doesn't work properly with speed based tweens #561

Open Ludwintor opened 2 years ago

Ludwintor commented 2 years ago

image As I understand, when tweener is created with speed based set to true, it calculates duration to finish this tweening, but after using ChangeEndValue, tween doesn't recalculate duration so my tween execute with old duration. For example, first call of Rotate() makes object to rotate from 0 to 0 (so duration is 0), but after I want to rotate object from current (snapping set to true in ChangeEndValue) angle to 20, that happen instant with duration of 0. I tried to pass same speed into "new duration" parameter of ChangeEndValue, but that caused errors image

Ludwintor commented 2 years ago

Okay, I've done a bit of researching and understand why it gives a NaN values. It happen because of "from" value is equals "to" value so as I understand, duration calculation on speed based tweens have a division by some delta of "from" and "to" values, that produce NaN because of zero division and simple if check before tweening resolves this issue. I don't know if it should be "out of the box" feature, that if the "from" and "to" values are same, tweening should be completed instantly without duration calculation, if it speed based