Document: getAnimations()-Methode

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.

Die getAnimations()-Methode der Document-Schnittstelle gibt ein Array aller aktuell wirksamen Animation-Objekte zurück, deren Ziel-Elemente Nachkommen des Dokuments sind. Dieses Array schließt CSS-Animationen, CSS-Übergänge und Web-Animationen ein.

Syntax

js
getAnimations()

Parameter

Keine.

Rückgabewert

Ein Array von Animation-Objekten, die jeweils eine Animation darstellen, die aktuell mit Elementen verknüpft ist, welche Nachkommen des Document sind, auf dem es aufgerufen wird.

Beispiele

Das folgende Code-Snippet verlangsamt alle Animationen auf einer Seite, indem es ihre Animation.playbackRate halbiert.

js
document.getAnimations().forEach((animation) => {
  animation.playbackRate *= 0.5;
});

Spezifikationen

Specification
Web Animations
# dom-documentorshadowroot-getanimations

Browser-Kompatibilität

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
getAnimations

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
Partial support
Partial support
Has more compatibility info.

Siehe auch