Animation.cancel()

Baseline 2022

Newly available

Since September 2022, this feature works across the latest devices and browser versions. This feature might not work in older devices or browsers.

El método cancel() de la Web Animations API de la interfaz Animation borra todos los KeyframeEffect (en-US) causados por esta animación y aborta su reproducción.

Nota: Cuando se cancela una animación, su startTime y su currentTime se establecen en null.

Sintaxis

js
Animation.cancel();

Parámetros

Ningun.

Valor devuelto

Ningun.

Excepciones

Este método no arroja excepciones directamente; sin embargo, si la animación playState no está "idle""inactiva" cuando se cancela, el current finished promise se rechaza con un DOMException llamado AbortError.

Especificaciones

Specification
Web Animations
# dom-animation-cancel

Compatibilidad con navegadores

BCD tables only load in the browser

Ver también