CSS3 animation-directionProperty
Example
First run the animation once, then run it in reverse once:
animation-direction:alternate;
-webkit-animation-direction:alternate; /* Safari and Chrome */
-webkit-animation-direction:alternate; /* Safari and Chrome */
Try it Yourself »
Browser Support
The numbers in the table specify the first browser version that fully supports the property.
Numbers followed by -webkit-, -ms-, or -moz- specify the first browser version that supported the 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 in reverse alternately in cycles.
Note:If the animation is set to play only once, this property has no effect.
| Default value: | normal |
|---|---|
| Inherited: | no |
| Animatable: | No. SeeAnimatable。 |
| version: | CSS3 |
| JavaScript Syntax: | object.style.animationDirection="reverse" Try it Yourself |
CSS Syntax
animation-direction: normal|reverse|alternate|alternate-reverse|initial|inherit;
Property value
| Value | Description | Testing |
|---|---|---|
| normal | Default value. The animation plays normally. | Test » |
| reverse | Reverse animation playback. | Test » |
| alternate | The animation is played forward on odd-numbered cycles (1, 3, 5...), and in reverse on even-numbered cycles (2, 4, 6...). | Test » |
| alternate-reverse | The animation is played in reverse on odd-numbered cycles (1, 3, 5...), and forward on even-numbered cycles (2, 4, 6...). | Test » |
| initial | Sets this property to its default value. Seeinitial。 | |
| inherit | Inherits the property from the parent element. See alsoinherit。 |
Related Articles
CSS3 Tutorial:CSS3 Animations
other extensions