Iteration Count Classes
Control how many times an animation repeats.Available Classes
| Class | Value | Description |
|---|---|---|
animate-iteration-count-none | 0 | Animation doesn’t play |
animate-iteration-count-once | 1 | Plays once (default for most) |
animate-iteration-count-twice | 2 | Plays twice |
animate-iteration-count-thrice | 3 | Plays three times |
animate-iteration-count-infinite | infinite | Loops forever |
Usage Examples
Common Patterns
Direction Classes
Control the direction of animation playback.Available Classes
| Class | Value | Description |
|---|---|---|
animate-direction-normal | normal | Plays forward (default) |
animate-direction-reverse | reverse | Plays backward |
animate-direction-alternate | alternate | Forward, then backward |
animate-direction-alternate-reverse | alternate-reverse | Backward, then forward |
Usage Examples
Alternate Direction Patterns
Perfect for creating continuous back-and-forth motion:Fill Mode Classes
Control which styles apply before and after animation.Available Classes
| Class | Value | Description |
|---|---|---|
animate-fill-mode-none | none | No styles before/after |
animate-fill-mode-forwards | forwards | Keeps end state |
animate-fill-mode-backwards | backwards | Applies start state immediately |
animate-fill-mode-both | both | Both forwards and backwards |
Understanding Fill Modes
Practical Examples
Play State Classes
Control whether animation is running or paused.Available Classes
| Class | Value | Description |
|---|---|---|
animate-play-running | running | Animation plays (default) |
animate-play-paused | paused | Animation is paused |
Usage Examples
Interactive Controls
Combining Control Classes
Create complex animation behaviors by combining multiple control classes:Advanced Patterns
Attention-Seeking Animation
Loading Indicator
Hover Animation Loop
Staggered Entrance with Hold
CSS Variable Reference
Responsive Control Classes
Apply different controls at different breakpoints:Best Practices
Use Fill Mode Both for Delays
When using delays, apply fill-mode-both to avoid flashing:Infinite Animations Need Pause
Provide a way to pause infinite animations:Match Direction to Purpose
Browser Compatibility
All control classes are supported in modern browsers:- Chrome 43+
- Firefox 16+
- Safari 9+
- Edge 12+
- Opera 30+