pull/13018/head
Rich Harris 2 years ago
parent 31d81a6e43
commit 2817255fe0

@ -366,9 +366,6 @@ function animate(element, options, t1, t2, on_finish, on_abort) {
/** @type {globalThis.Animation} */
var animation;
/** @type {Task} */
var task;
// run after a micro task so that all transitions that are lining up and are about to run can correctly measure the DOM
queue_micro_task(() => {
// WAAPI
@ -431,7 +428,7 @@ function animate(element, options, t1, t2, on_finish, on_abort) {
tick(0, 1); // TODO put in nested effect, to avoid interleaved reads/writes?
}
task = loop(() => {
loop(() => {
if (animation.playState !== 'running') return false;
var time = /** @type {number} */ (
@ -454,7 +451,8 @@ function animate(element, options, t1, t2, on_finish, on_abort) {
// This prevents memory leaks in Chromium
animation.effect = null;
}
task?.abort();
// TODO does this belong in the animation.finished handlers?
on_abort?.();
on_finish = undefined;
on_abort = undefined;

@ -134,6 +134,8 @@ class Animation {
this.currentTime = null;
// @ts-ignore
this.startTime = null;
this.playState = 'idle';
this.#cancelled();
raf.animations.delete(this);
}

Loading…
Cancel
Save