CSS animation-direction Property
Description
The animation-direction property in CSS controls the direction in which an animation is played. While many animations naturally run from their starting keyframe to their ending keyframe in a forward manner, this property allows developers to alter that flow. By adjusting the direction, an animation can run in reverse, alternate between forward and backward directions, or even alternate in a reverse-first sequence. This gives designers a powerful tool for creating more dynamic, non-linear motion effects, adding visual interest and complexity to otherwise straightforward animations.
One of the key benefits of animation-direction is its ability to work in conjunction with animation-iteration-count. When an animation is set to repeat multiple times, the direction can change with each iteration, allowing for oscillating or ping-pong motion effects. For example, a bouncing ball could appear to rise and fall naturally without needing separate keyframes for each movement direction. This property essentially reduces redundancy in animation coding and simplifies complex motion sequences.
Moreover, animation-direction can be combined with other animation-related properties like animation-fill-mode and animation-timing-function to achieve highly controlled effects. While the timing function controls the pacing of an animation, and the fill mode determines how an element retains styles before or after the animation, animation-direction dictates the path along which these effects occur. Together, they give designers precise control over the visual storytelling of animated elements, whether creating subtle hover effects, looping background motions, or intricate interactive sequences.
Definition
- Initial value
- normal
- Applies to
- All elements, :before and :after pseudo elements
- Inherited
- No
- Computed value
- As specified
- Animatable
- No
- JavaScript syntax
- object.style.animationDirection
Interactive Demo
Syntax
animation-direction: <single-animation-direction> [ ',' <single-animation-direction> ]*
Values
- normalAll iterations of the animation are played as specified.
- reverseAll iterations of the animation are played in the reverse direction from the way they were specified.
- alternateThe animation cycle iterations that are odd counts are played in the normal direction, and the animation cycle iterations that are even counts are played in a reverse direction.
- alternate-reverseThe animation cycle iterations that are odd counts are played in the reverse direction, and the animation cycle iterations that are even counts are played in a normal direction.
Example
Browser Support
The following information will show you the current browser support for the CSS animation-direction property. Hover over a browser icon to see the version that first introduced support for this CSS property.
This property is supported by all modern browsers.
Desktop
Tablets & Mobile
Last updated by CSSPortal on: 1st January 2026
