W3cubDocs

/DOM

Animation.cancel

This is an experimental technology
Check the Browser compatibility table carefully before using this in production.

The Web Animations API's cancel() method of the Animation interface clears all KeyframeEffects caused by this animation and aborts its playback.

When an animation is cancelled, its startTime and currentTime are set to null.

Syntax

Animation.cancel();

Parameters

None.

Return value

None.

Exceptions

This method doesn't directly throw exceptions; however, if the animation's playState is anything but "idle" when cancelled, the current finished promise is rejected with a DOMException named AbortError.

Specifications

Specification Status Comment
Web Animations
The definition of 'Animation.cancel()' in that specification.
Working Draft Editor's draft.

Browser compatibilityUpdate compatibility data on GitHub

Desktop
Chrome Edge Firefox Internet Explorer Opera Safari
Basic support 39 ? 48
48
40 — 48
Disabled
Disabled From version 40 until version 48 (exclusive): this feature is behind the dom.animations-api.core.enabled preference (needs to be set to true). To change preferences in Firefox, visit about:config.
No 26 No
Mobile
Android webview Chrome for Android Edge Mobile Firefox for Android Opera for Android iOS Safari Samsung Internet
Basic support 39 39 ? 48
48
40 — 48
Disabled
Disabled From version 40 until version 48 (exclusive): this feature is behind the dom.animations-api.core.enabled preference (needs to be set to true). To change preferences in Firefox, visit about:config.
26 No 4.0

See also

© 2005–2018 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/Animation/cancel