Keyframes
.my-animation {
animation: my-animation 600ms ease 0ms 1 normal both;
}
@keyframes my-animation {
from { opacity: 0; transform: translateY(20px); }
to { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
.my-animation {
animation: none;
}
}Timing function
How to use
Pick a preset and name
Choose one of the 50 presets from the grouped list, then type a name. Names must start with a letter, underscore or hyphen; an invalid name is replaced with my-animation. Click Edit steps to change the keyframes.
Set timing and replay
Set Duration and Delay, pick a named easing, draw a custom curve or use steps, then choose iteration count, direction and fill mode. Pick a trigger and press Replay to watch it again.
Copy the code
Pick CSS, @keyframes, Shorthand, Tailwind or JavaScript, then copy or download the .css file. Switches add a reduced motion block, the -webkit- prefix or minified output.
Why CSS Animation Generator
- 50 presets in six groups, and a step editor for your own keyframes.
- Named, Penner, custom cubic-bezier and steps() timing, plus fill mode and triggers.
- Preview on five sample objects, played on load, on hover or on click.
- CSS, Tailwind config and Web Animations output, with reduced motion and prefix options.
The animation shorthand: order and defaults
The generated line packs several properties into one. Most can appear in any order, but the first time value is always the duration and the second is the delay. The name can go anywhere, though putting it first is easiest to read.
Any property you leave out of the shorthand is reset to its default. That matters when you override an animation later: writing animation: my-animation 1s on a hover rule also resets the fill mode to none and the iteration count to 1. To change one thing, use the longhand property, such as animation-duration.
| Property | In the generated line | Default if left out |
|---|---|---|
| animation-name | my-animation | none |
| animation-duration | 600ms | 0s |
| animation-timing-function | ease | ease |
| animation-delay | 0ms | 0s |
| animation-iteration-count | 1 | 1 |
| animation-direction | normal | normal |
| animation-fill-mode | both | none |
| animation-play-state | not written | running |