The Web Animations API's cancel() method of the Animation interface clears all KeyframeEffects caused by this animation and aborts its playback.
Note: When an animation is cancelled, its startTime and currentTime are set to null.
cancel()None.
None (undefined).
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.
KeyframeEffectAnimationAnimation.playStateAnimation.finished returns the promise this action will reject if the animation's playState is not "idle".