Animation: finished プロパティ

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since March 2020.

Animation.finishedウェブアニメーション API の読み取り専用プロパティで、アニメーションの再生が完了すると解決される Promise を返します。

メモ: アニメーションが finished の再生状態から離れる時点(つまり、再び再生を始める時点)ごとに、このプロパティに対して新しい Promise が作成されます。新しい Promise は新しいアニメーションシーケンスが完了すると解決されます。

アニメーションの実行が完了すると解決される Promise オブジェクト。

以下のコードは、要素 elem で実行するアニメーションがすべて完了するまで待ち、その要素を DOM ツリーから削除します。

js
Promise.all(elem.getAnimations().map((animation) => animation.finished)).then(
  () => elem.remove(),
);

仕様書

Specification
Web Animations
# dom-animation-finished

ブラウザーの互換性

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
finished

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support

関連情報