CSS3 animation-direction property
Example
Play the animation once forward, then play it once in reverse:
animation-direction:alternate;
-webkit-animation-direction:alternate; /* Safari and Chrome */
Try it »
Browser support
The numbers in the table indicate the first browser version that supports this property.
A number immediately before -webkit-, -ms-, or -moz- indicates the first browser version that supports that prefixed property.
| 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- |
Definition and Usage
The animation-direction property defines whether an animation should be played forwards, backwards, or in alternate cycles.
**Note:** If the animation is set to play only once, this property has no effect.
| Default value: | normal |
|---|---|
| Inherited: | No |
| Animatable: | No. See Animatable. |
| Version: | CSS3 |
| JavaScript syntax: | object.style.animationDirection="reverse" Try it |
CSS Syntax
animation-direction: normal|reverse|alternate|alternate-reverse|initial|inherit;
Attribute values
| Value | Description | Testing |
|---|---|---|
| normal | Default. The animation is played normally. | Test » |
| reverse | The animation is played in reverse. | Test » |
| alternate | The animation is played forward on odd cycles (1, 3, 5...) and in reverse on even cycles (2, 4, 6...). | Test » |
| alternate-reverse | The animation is played in reverse on odd cycles (1, 3, 5...) and forward on even cycles (2, 4, 6...). | Test » |
| initial | Sets this property to its default value. See initial. | |
| inherit | Inherits this property from its parent element. See inherit. |
Related Articles
CSS3 Tutorial:CSS3 Animations
CSS Reference Manual