Path: blob/main/files/en-us/web/api/animation/play/index.md
6552 views
------{{ APIRef("Web Animations") }}
The play() method of the Web Animations API's {{ domxref("Animation") }} Interface starts or resumes playing of an animation. If the animation is finished, calling play() restarts the animation, playing it from the beginning.
Syntax
Parameters
None.
Return value
None ({{jsxref("undefined")}}).
Examples
In the Growing/Shrinking Alice Game example, clicking or tapping the cake causes Alice's growing animation (aliceChange) to play forward, causing her to get bigger, as well as triggering the cake's animation. Two Animation.play()s, one EventListener:
Specifications
{{Specifications}}
Browser compatibility
{{Compat}}
See also
{{domxref("Animation")}} for other methods and properties you can use to control web page animation.
{{domxref("Animation.pause()")}} to pause an animation.
{{domxref("Animation.reverse()")}} to play an animation backwards.
{{domxref("Animation.finish()")}} to finish an animation.
{{domxref("Animation.cancel()")}} to cancel an animation.