Path: blob/main/files/en-us/web/api/animation/playstate/index.md
6552 views
------{{APIRef("Web Animations")}}
The read-only Animation.playState property of the Web Animations API returns an enumerated value describing the playback state of an animation.
Value
idle: The current time of the animation is unresolved and there are no pending tasks.
running: The animation is running.
paused: The animation was suspended and the {{domxref("Animation.currentTime")}} property is not updating.
finished: The animation has reached one of its boundaries and the {{domxref("Animation.currentTime")}} property is not updating.
Previously, Web Animations defined a pending value to indicate that some asynchronous operation such as initiating playback was yet to complete. This is now indicated by the separate {{domxref("Animation.pending")}} property.
Examples
In the Growing/Shrinking Alice Game example, players can get an ending with Alice crying into a pool of tears. In the game, for performance reasons, the tears should only be animating when they're visible. So they must be paused as soon as they are animated like so:
Specifications
{{Specifications}}
Browser compatibility
{{Compat}}
See also
{{domxref("Animation")}} for other methods and properties you can use to control web page animation.