Propriedade de animação de estilo
Exemplo
Alterando a animação de um elemento <div>, usando a propriedade shorthand:
document.getElementById("myDIV").style.animation = "mynewmove 4s 2";
Definição e uso
A propriedade de animação é uma propriedade abreviada para seis das propriedades de animação:
animaçãoName
animationDuration
animationTimingFunction
animationDelay
animationIterationCount
animationDirection
Nota: Sempre especifique a propriedade animationDuration, caso contrário, a duração é 0 e nunca será reproduzida.
Suporte ao navegador
Os números na tabela especificam a primeira versão do navegador que oferece suporte total à propriedade.
Números seguidos por Webkit, Moz ou O especificam a primeira versão que funcionou com um prefixo.
Property | |||||
---|---|---|---|---|---|
animation | 43.0 4.0 Webkit |
10.0 | 16.0 5.0 Moz |
9.0 4.0 Webkit |
30.0 15.0 Webkit 12.1 12.0 O |
Sintaxe
Retorne a propriedade de animação:
object.style.animation
Defina a propriedade de animação:
object.style.animation = "name duration timingFunction delay iterationCount direction fillMode playState"
Valores de propriedade
Value | Description |
---|---|
animationName | Specifies the name of the keyframe you want to bind to the selector |
animationDuration | Specifies how many seconds or milliseconds an animation takes to complete |
animationTimingFunction | Specifies the speed curve of the animation |
animationDelay | Specifies a delay before the animation will start |
animationIterationCount | Specifies how many times an animation should be played |
animationDirection | Specifies whether or not the animation should play in reverse on alternate cycles |
animationFillMode | Specifies what values are applied by the animation outside the time it is executing |
animationPlayState | Specifies whether the animation is running or paused |
initial | Sets this property to its default value. Read about initial |
inherit | Inherits this property from its parent element. Read about inherit |
Detalhes técnicos
Valor padrão: | nenhum 0 facilidade 0 1 normal nenhum funcionando |
---|---|
Valor de retorno: | Uma String, representando a propriedade de animação de um elemento |
Versão CSS | CSS3 |
Páginas relacionadas
Referência CSS: propriedade de animação