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 GitHubdesktop | mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
finished |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.