Skip to content
This repository has been archived by the owner on Nov 12, 2024. It is now read-only.

[Bug] AnimationControls.finished promise stays pending if it's not immediately used #260

Open
piotrjoniec opened this issue Jun 4, 2024 · 1 comment
Labels
Bug Bug report

Comments

@piotrjoniec
Copy link

1. Describe the bug

The AnimationControls.finished promise stays pending if it's not immediately used after creating the animation. If I await this promise after the animation has already finished, it will await forever, which is unlike the normal behavior of the "finished" promise in WAAPI.

2. IMPORTANT: Provide a CodeSandbox reproduction of the bug

https://codesandbox.io/p/devbox/motionone-bug-k37tnt?file=%2Fsrc%2Findex.mjs

3. Steps to reproduce

  1. Open the CodeSandbox link.
  2. Open the console.

4. Expected behavior

Console should show all "Case 1 finished", "Case 2 finished" and "Case 3 finished".

@piotrjoniec piotrjoniec added the Bug Bug report label Jun 4, 2024
@piotrjoniec
Copy link
Author

Here's another strange behavior:

image

When animating for the first time, the animation will end with playState of idle and currentTime will revert to 0.

But when animating for the second time by calling play() directly, the animation will end with playState of finished and currentTime of 1.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug Bug report
Projects
None yet
Development

No branches or pull requests

1 participant