Element: getAnimations() メソッド
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.
getAnimations()
は Element
インターフェイスのメソッドで(Animatable
ミックスインで指定されており)、この要素に影響を与える、あるいは将来的に影響を与える予定のすべての Animation
オブジェクトの配列を返します。オプションとして、子孫要素の Animation
オブジェクトも返すことができます。
メモ: この配列には CSS アニメーション、CSS トランジション、ウェブアニメーションが含まれます。
構文
js
getAnimations()
getAnimations(options)
引数
options
省略可-
以下のプロパティを含むオプションオブジェクトです。
返値
例
以下のコードでは、 elem
とその子孫のすべてのアニメーションが終了するのを待ってから、文書からその要素を削除します。
js
Promise.all(
elem.getAnimations({ subtree: true }).map((animation) => animation.finished),
).then(() => elem.remove());
仕様書
Specification |
---|
Web Animations # dom-animatable-getanimations |
ブラウザーの互換性
Report problems with this compatibility data on GitHubdesktop | mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
getAnimations |
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.
関連情報
- ウェブアニメーション API
- CSS アニメーション
- CSS トランジション
Document.getAnimations()
- 文書内のすべてのアニメーションを読み取るAnimation