Document.getAnimations()

Experimental: これは実験的な機能です。
本番で使用する前にブラウザー互換性一覧表をチェックしてください。

getAnimations() メソッドは Document インターフェイスのメソッドで、この文書の配下にあるターゲット要素にあるすべての Animation オブジェクトの配列を返します。この配列には CSS アニメーション, CSS トランジション, ウェブアニメーション が含まれます。

構文

var allAnimations = Document.getAnimations();

引数

なし。

返値

Animation オブジェクトの Array で、それぞれの要素は呼び出された Document の配下にある要素に現在関連付けられているアニメーション 1 つを表します。

次のコードスニペットは、ページ上のすべてのアニメーションの 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

関連情報