The animation-direction property controls which way a CSS animation plays. Use it to move elements forward, backward, or smoothly back and forth without a visible jump at the end of each cycle.
01
Playback Flow
Control animation direction.
02
Syntax
Four keyword values.
03
normal
Default forward playback.
04
reverse
Play from end to start.
05
alternate
Smooth back-and-forth motion.
06
Shorthand
Works with animation too.
Fundamentals
Definition and Usage
The animation-direction CSS property sets whether an animation runs from the first keyframe to the last, from last to first, or alternates between those directions on repeated cycles.
This is especially useful for bouncing loaders, sliding panels that return smoothly, pulsing indicators, and any motion that should feel continuous rather than snapping back to the start.
💡
Beginner Tip
For a smooth ping-pong effect, pair animation-direction: alternate with animation-iteration-count: infinite. The box moves forward, then backward, without jumping.
Foundation
📝 Syntax
Set animation-direction with one of its keyword values:
The initial value is normal, which plays keyframes from start to end.
alternate and alternate-reverse only show their full effect when the animation repeats.
When multiple animations run on one element, use comma-separated direction values matching each animation.
Direction can be included in the animation shorthand after timing and iteration values.
Combine with animation-iteration-count: infinite for continuous back-and-forth motion.
Cheat Sheet
⚡ Quick Reference
Question
Answer
Initial value
normal
Applies to
Elements with CSS animations
Inherited
No
Animatable
No
Common use
Bouncing, sliding, and looping motion effects
Defaults
Default Value
The initial value of animation-direction is normal. The animation plays from the first keyframe to the last, and on each repeat it starts again from the beginning.
Reference
💎 Property Values
These keyword values define how animation cycles are played over time.
Value
Example
Meaning
normal
animation-direction: normal;
Plays forward from start to end on every iteration
reverse
animation-direction: reverse;
Plays backward from end to start on every iteration
alternate
animation-direction: alternate;
Alternates forward and backward on each iteration
alternate-reverse
animation-direction: alternate-reverse;
Starts backward, then alternates forward and backward
initial
animation-direction: initial;
Resets to the default value normal
inherit
animation-direction: inherit;
Inherits direction from the parent element
normal
The box always moves left to right, then jumps back to the start on each repeat.
Forward each cycle
Default playback direction.
reverse
The box always moves right to left, starting from the end position of the keyframes.
Backward each cycle
Every iteration runs in reverse.
alternate
The box moves forward, then smoothly returns backward without jumping to the start.
Ping-pong motion
Most popular choice for bouncing effects.
alternate-reverse
The first cycle runs backward, then the animation alternates direction on later repeats.
Reverse first, then alternate
Useful when the element should begin at the end state.
Compare
reverse vs alternate
Value
Cycle 1
Cycle 2
Best for
reverse
End → start
End → start again
Always running backward
alternate
Start → end
End → start
Smooth back-and-forth looping
Preview
👀 Live Preview
This box uses animation-direction: alternate to slide back and forth smoothly:
The box moves right, then returns left, repeating without a visible jump.
Hands-On
Examples Gallery
Try animation-direction with reverse, alternate, normal, and shorthand syntax.
📚 Direction Keywords
See how each keyword changes the way the same keyframe animation is played.
Example 1 — Play the Animation in Reverse
Move a box from right to left by setting animation-direction: reverse.
The shorthand order includes name, duration, timing function, iteration count, and direction. Here, the dot begins with the larger scale and alternates back.
🧠 How animation-direction Works
1
You define keyframes
Create a path from a start state to an end state with @keyframes.
Keyframes
2
You choose a direction
Set normal, reverse, alternate, or alternate-reverse.
Direction
3
The browser plays each cycle
On repeat, the browser follows your direction rules instead of always restarting forward.
Playback
=
🔀
Dynamic motion
The same keyframes can feel completely different depending on the direction you choose.
Compatibility
Universal Browser Support
animation-direction is supported in all modern browsers alongside CSS animations.
✓ Baseline · CSS Animations
Control animation flow in modern browsers
Chrome, Firefox, Safari, Edge, and Opera all support every animation-direction keyword.
98%Modern browser support
Google Chrome43+ · Desktop & Mobile
Full support
Mozilla Firefox16+ · Desktop & Mobile
Full support
Apple Safari9+ · macOS & iOS
Full support
Microsoft Edge12+ · Modern versions
Full support
Opera30+ · Modern versions
Full support
Legacy browsers
Very old browsers without CSS animation support also lack animation-direction.
💻
Internet ExplorerIE 9 and earlier · No CSS animation support
None
animation-direction property98% supported
Bottom line: Use animation-direction freely in modern projects. Test looping animations on mobile for smooth performance.
Wrap Up
Conclusion
The animation-direction property lets you control how CSS animations play across repeated cycles. It turns simple keyframes into forward motion, backward motion, or smooth alternating movement.
Start with normal, then try alternate for bouncing effects and reverse when you want every cycle to run backward.