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 KeyframeEffect
s caused by this animation and aborts its playback.
When an animation is cancelled, its startTime
and currentTime
are set to null
.
Animation.cancel();
None.
None.
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
.
Specification | Status | Comment |
---|---|---|
Web Animations The definition of 'Animation.cancel()' in that specification. | Working Draft | Editor's draft. |
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
---|---|---|---|---|---|
Basic support | 39 | 48 (48) | No support | 26 | No support |
Feature | Android Webview | Chrome for Android | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|---|
Basic support | 39 | 39 | 48.0 (48) | No support | 26 | No support |
KeyframeEffect
Animation
Animation.playState
Animation.finished
returns the promise this action will reject if the animation's playState
is not "idle"
.
© 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