Propiedad de dirección de animación CSS
Ejemplo
Reproduzca la animación primero hacia adelante y luego hacia atrás:
div {
animation-direction: alternate;
}
Más ejemplos de "Pruébelo usted mismo" a continuación.
Definición y uso
La animation-direction
propiedad define si una animación debe reproducirse hacia adelante, hacia atrás o en ciclos alternos.
Valor por defecto: | normal |
---|---|
Heredado: | No |
Animable: | No. Leer sobre animable |
Versión: | CSS3 |
Sintaxis de JavaScript: | objeto .style.animationDirection="reverse" |
Compatibilidad con navegador
Los números de la tabla especifican la primera versión del navegador que es totalmente compatible con la propiedad.
Los números seguidos de -webkit-, -moz- o -o- especifican la primera versión que funcionó con un prefijo.
Property | |||||
---|---|---|---|---|---|
animation-direction | 43.0 4.0 -webkit- |
10.0 | 16.0 5.0 -moz- |
9.0 4.0 -webkit- |
30.0 15.0 -webkit- 12.0 -o- |
Sintaxis CSS
animation-direction: normal|reverse|alternate|alternate-reverse|initial|inherit;
Valores de propiedad
Value | Description | Play it |
---|---|---|
normal | Default value. The animation is played as normal (forwards) | |
reverse | The animation is played in reverse direction (backwards) | |
alternate | The animation is played forwards first, then backwards | |
alternate-reverse | The animation is played backwards first, then forwards | |
initial | Sets this property to its default value. Read about initial | |
inherit | Inherits this property from its parent element. Read about inherit |
Más ejemplos
Ejemplo
Reproduzca la animación primero hacia atrás y luego hacia adelante:
div {
animation-direction: alternate-reverse;
}
Ejemplo
Reproducir la animación al revés:
div {
animation-direction: reverse;
}
páginas relacionadas
Tutorial CSS: Animaciones CSS
Referencia HTML DOM: propiedad animationDirection