Closed
Description
Create two tween
s and chain them:
const tween1 = new TWEEN.Tween({})
.to({}, 500)
.onComplete(() => {
console.log('complete');
tween1.stop();
tween2.stop();
});
const tween2 = new TWEEN.Tween({})
.to({}, 500);
tween1.chain(tween2);
tween2.chain(tween1);
In onComplete
callback, I try to stop both of them, but it does not work and just loops forever.
Looking into the code, I find that, in onComplete
callback tween2._isPlaying
is set to false, after that, the chained tween2
is started no matter if it should be stopped, so the stop
does not make a difference to the result.
So a workaround is to wrap it in setTimeout
:
.onComplete(() => {
setTimeout(() => {
tween1.stop();
tween2.stop();
});
})
Anyway, it's ugly and doesn't make sense.
This has worked before, I think the refactor has broken a lot of things. 😞
Metadata
Metadata
Assignees
Type
Projects
Status
Done