document.getAnimations() is an instance method that returns every Animation currently in effect under the document (see MDN Document: getAnimations()). Learn what the array contains (CSS animations, transitions, and Web Animations), how to change playbackRate, pause or cancel everything, how it compares to Element.getAnimations(), and five try-it labs.
01
Kind
Instance method
02
Params
None
03
Returns
Animation[]
04
Includes
CSS + WAAPI
05
Scope
whole document
06
Status
Baseline
Fundamentals
Introduction
Pages mix motion from many sources: CSS @keyframes, CSS transitions, and JavaScript element.animate(). The Web Animations API unifies them as Animation objects you can inspect and control.
MDN: document.getAnimations() returns an array of all Animation objects currently in effect whose targets are descendants of the document — including CSS Animations, CSS Transitions, and Web Animations.
💡
Think: a remote for every running animation
1) Call document.getAnimations() 2) Get an array of Animation objects 3) Loop to read playState or change playbackRate 4) Pause, play, or cancel as needed
With only one animated node, both counts match. Add more animated elements and the document count grows while each element stays local — see Element.getAnimations().
Applications
🚀 Common Use Cases
Global slow-mo / speed-up — MDN’s playbackRate pattern.
Pause all motion — accessibility or debug overlays.
Cleanup — cancel leftover animations when unmounting a view.
Diagnostics — count running animations during performance work.
Prefer element scope — use Element.getAnimations() for a single widget.
Not creating motion — use element.animate() or CSS to start animations.
🧠 How getAnimations() Works
1
Animations are already running
From CSS, transitions, or element.animate() on document descendants.
Sources
2
Call document.getAnimations()
No arguments. The browser collects in-effect Animation objects (MDN).
Query
3
Receive an array
Each entry is a live Animation you can inspect or control.
Result
4
✓
Loop and control
Change playbackRate, pause, play, cancel, or await finished.
Important
📝 Notes
MDN: Baseline Widely available since September 2020.
MDN: includes CSS Animations, CSS Transitions, and Web Animations.
MDN: no parameters; returns an array of Animation objects.
Only descendants of this document are included (MDN).
Document.getAnimations() is Baseline Widely available on MDN (since September 2020). Logos use the shared browser-image-sprite.png sprite from this project.
✓ Baseline Widely available
Document.getAnimations()
List every in-effect Animation under the document — CSS, transitions, and Web Animations.
BaselineWidely available
Google ChromeSupported
Yes
Mozilla FirefoxSupported
Yes
Apple SafariSupported
Yes
Microsoft EdgeSupported
Yes
OperaSupported
Yes
Internet ExplorerNot supported
No
getAnimations()Wide
Bottom line: Use document.getAnimations() for page-wide control. Prefer Element.getAnimations() when you only need one element or subtree.
Wrap Up
Conclusion
document.getAnimations() is your document-wide inventory of live Animation objects. Use it to slow, pause, or cancel motion across the page — exactly the toolkit MDN demonstrates with playbackRate.
Use document scope for global pause / slow-mo tools
Prefer Element.getAnimations() for a single component
Re-call getAnimations() after starting or canceling motion
Respect prefers-reduced-motion when pausing page animations
Inspect playState and playbackRate while debugging
❌ Don’t
Expect parameters on Document.getAnimations() (MDN: none)
Assume an empty array means animations never existed — they may have finished
Cancel everything if you only meant to pause one widget
Forget IE lacks this API (prefer modern Baseline browsers)
Confuse listing animations with creating them (animate() / CSS)
Summary
Key Takeaways
Knowledge Unlocked
Five things to remember about getAnimations()
List every live Animation under the document, then control them.
5
Core concepts
📝01
Returns
Animation[]
MDN
🔄02
Includes
CSS + WAAPI
transitions
⚡03
MDN tip
playbackRate
slow / speed
📄04
Scoped alt
Element.getAnimations
local
🛡05
Status
Baseline
2020
❓ Frequently Asked Questions
MDN: Document.getAnimations() returns an array of all Animation objects currently in effect whose target elements are descendants of the document. This includes CSS Animations, CSS Transitions, and Web Animations.
No. MDN marks Document.getAnimations() as Baseline Widely available (since September 2020). It is not Deprecated, Experimental, or Non-standard.
An Array of Animation objects, each representing one animation currently associated with descendant elements of the Document (MDN).
No. MDN: Document.getAnimations() has no parameters. (Element.getAnimations() can take an options object such as subtree.)
Document.getAnimations() lists animations across the whole document. Element.getAnimations() is scoped to one element (optionally including its subtree).
Common controls include playbackRate, play(), pause(), cancel(), and awaiting animation.finished. MDN’s example halves every animation’s playbackRate.
Did you know?
The same getAnimations() idea exists on ShadowRoot in the Web Animations specification — so encapsulated components can inventory their own animations without scanning the whole page.