Document.getAnimations()
Experimental: これは実験的な機能です。
本番で使用する前にブラウザー互換性一覧表をチェックしてください。
getAnimations()
メソッドは Document
インターフェイスのメソッドで、この文書の配下にあるターゲット要素にあるすべての Animation
オブジェクトの配列を返します。この配列には CSS アニメーション, CSS トランジション, ウェブアニメーション が含まれます。
構文
var allAnimations = Document.getAnimations();
引数
なし。
返値
例
次のコードスニペットは、ページ上のすべてのアニメーションの Animation.playbackRate
(en-US) を半分にすることで速度をゆっくりにします。
document.getAnimations().forEach(
function (animation) {
animation.playbackRate *= .5;
}
);
仕様書
Specification |
---|
Web Animations # dom-documentorshadowroot-getanimations |
ブラウザーの互換性
BCD tables only load in the browser
関連情報
- ウェブアニメーション API
- CSS アニメーション
- CSS トランジション
Element.getAnimations()
- 単一の要素 (Element
) とその子孫にあるアニメーションのみを読み取るAnimation