Best way to wait for end of animation #3092
Answered
by
mattgperry
felixranesberger
asked this question in
Q&A
-
Hi, I was wondering what the best way is, to await the Background: I want to abort a event listener, when the animate function is finished. Currently I'm using this workaround: async function animateHidePreview() {
animate(element, {
opacity: 0,
}, { duration: defaultAnimationDuration / 1000 });
await new Promise(resolve => setTimeout(resolve, defaultAnimationDuration));
} |
Beta Was this translation helpful? Give feedback.
Answered by
mattgperry
Feb 28, 2025
Replies: 1 comment 4 replies
-
Here you can literally do “await animate()” |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You can also await Promise-likes and one of the controls is “then” so you can also do
controls.then(() => next thing)