Animation.cancel()
Experimental: Esta é uma tecnologia experimental (en-US)
Verifique a tabela de compatibilidade entre Navegadores cuidadosamente antes de usar essa funcionalidade em produção.
O método Animation.cancel()
da interface Animation
, limpa todas as keyframeEffects
(en-US) geradas pela animação e aborta esta execução.
Nota: Quando uma animação é cancelada, os valores de startTime
(en-US) e currentTime
são definidos como null
.
Sintaxe
// cancela animação
animation.cancel();
Parametros
Nenhum.
Valor de retorno
Nenhum.
Exceptions
Se o método Animation.playState
da animação estiver executando quando a operação for cancelada, esta ação vai rejeitar a current finished promise
(en-US) com a DOMException
nomeada AbortError
.
Especificações
Specification | Status | Comment |
---|---|---|
Web Animations The definition of 'Animation.cancel()' in that specification. |
Rascunho atual | Editor's draft. |
Compatibilidade com navegadores
BCD tables only load in the browser
Veja também
- Web Animations API
KeyframeEffect
(en-US)Animation
Animation.playState
Animation.finished
(en-US) returns the promise this action will reject if the animation'splayState
is notidle
.