Tweening an vector isn't work if value of property is 0

Hi, I noticed strange behavior when I try to make “yoyo” and return vector to its zero value.

repeatTw() {
    const {vector} = this;

    console.log(vector.x);

    tween(vector)
        .to(2, {x: 1})
        .to(2, {x: 0})
        .call(() => this.repeatTw())
        .start();
}

if I write this code, vector.x become to value 1, but never return to value 0.
if I change second “x” property to 0.0001 it works.

I add test project you can look cube doesn’t return to “x” position 0:
Cocos Creator 3 preview.

Tween_Bug.zip (1.2 MB)

Thanks for the bug report!

We have fixed this issue on the development branch, you can refer to the following code :

2 Likes

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.