DOM

Document.getAnimations() メソッド

 編集:2022.08.30 by T.A.

[Edge]実験的。→

Document の配下にあるターゲット要素にあるすべての Animation オブジェクトの配列を返します。

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

この配列には が含まれます。

構文
Document.getAnimations()
返値

Animation オブジェクトの Array

次のコード スニペットは、ページ上のすべてのアニメーションの Animation.playbackRate を半分にすることで速度をゆっくりにします。

document.getAnimations().forEach(
  function (animation) {
    animation.playbackRate *= .5;
  }
);

HTML:

<SPAN id=IdSpan style="
  transition:font-size 3s 0s;
">SPAN要素</SPAN><BR>
<BUTTON onclick="IdSpan.style.fontSize='40px'">大</BUTTON>

JavaScript:

D=document.getAnimations(); //=[object]:(空オブジェクト!)。得られていないようだ。

アニメーション:

以下のCSSが組み込んであります:

<DIV style="border:1px solid black;
 width:200px; height:50px;
">
 <DIV style="position:relative;
  width:25px; height:25px; background:red;
  left:0px; top:0px;
  animation:3s linear 5s Test;
 "></DIV>
</DIV>


テスト