tween.js icon indicating copy to clipboard operation
tween.js copied to clipboard

[bug] calling tween.stop() does not cause tween.update() to return false

Open trusktr opened this issue 2 years ago • 0 comments

Calling tween.stop() should stop the tween, and a following tween.update(time) (f.e. in an animation frame) should return false so that the return value is reliable for exiting the animation loop. Currently this will fail:

function loop(time) {
  const keepGoing = tween.update(time)
  if (keepGoing) requestAnimationFrame(loop)
}

loop(performance.now())

// ... later, before the animation is finished ...
tween.stop() // Does not cause the loop to stop, the loop keeps going.

The tween.stop() call should cause tween.update() to return true so that the animation loop will end.

trusktr avatar Aug 07 '23 19:08 trusktr