A CSS animation generator for keyframe effects
This CSS animation generator writes the two pieces every keyframe animation needs: an @keyframes block that describes the motion, and a class that applies it with the animation shorthand. Pick an effect, tune its timing and looping, preview it live and copy code that also respects users who prefer reduced motion.
Example output
The default Bounce animation, looping forever, produces:
@keyframes bounce {
0%, 20%, 53%, 100% { transform: translateY(0); }
40%, 43% { transform: translateY(-30px); }
70% { transform: translateY(-15px); }
90% { transform: translateY(-4px); }
}
.animated {
animation: bounce 1s ease 0s infinite normal both;
}
@media (prefers-reduced-motion: reduce) {
.animated {
animation: none;
}
}
Add class="animated" to any element to use it. The HTML tab shows that markup, and Download HTML demo saves a standalone page with the animation running.
Reading the animation shorthand
The generated shorthand always lists values in the same order: name, duration, timing function, delay, iteration count, direction and fill mode. The first time value is always the duration and the second the delay, which is why 1s ease 0s is unambiguous.
Options explained
The 19 animations
- Entrances: Fade in, Slide in from left, right, up or down, Zoom in, Flip X and Flip Y.
- Exits: Fade out and Zoom out.
- Attention seekers: Bounce, Pulse, Heartbeat, Shake, Wobble, Swing and Blink.
- Loops: Spin and Float.
Swing also adds transform-origin: top center so the element rocks from its top edge like a hanging sign.
Timing, iterations and direction
- Duration ranges from 0.1 to 10 seconds and Delay from 0 to 5 seconds.
- Timing function offers the five CSS keywords or a custom
cubic-bezier(). The custom field starts withcubic-bezier(0.34, 1.56, 0.64, 1), a slight overshoot; design your own in the cubic bezier generator. - Loop forever writes
infinite; untick it to choose 1 to 20 Iterations. - Direction:
alternateplays forwards then backwards, which suits Float or Pulse loops that should not snap back.
Fill mode
| Value | Effect |
|---|---|
none | Keyframe styles apply only while the animation runs. |
forwards | The element keeps the last keyframe after finishing. |
backwards | The first keyframe applies during the delay. |
both (default) | Both of the above: no flash before a delayed entrance and no jump back after an exit. |
For example, a one-time entrance with Fade in, 0.6s and ease-out gives animation: fadeIn 0.6s ease-out 0s 1 normal both;.
Tips and common mistakes
- Existing transforms are replaced. Most presets animate
transform. If your element already uses one, for exampletranslate(-50%, -50%)for centering, the animation overrides it while running. Animate an inner wrapper instead. - Slide-ins can cause scrollbars.
translateX(100%)moves the element by its own width, possibly past the viewport edge. Putoverflow: hidden(oroverflow-x: clip) on the container. - Prefer transform and opacity. Every preset uses only these two properties, which browsers can animate without recalculating layout. Animating
top,widthormarginis heavier. - Class names are sanitized. Spaces and other invalid characters become hyphens, and a leading digit gets an underscore, so the selector is always valid.
- Start on scroll. To play an entrance when an element comes into view, add the class from an
IntersectionObservercallback.
For static positioning and rotation values, the CSS transform generator helps, and for looping spinners the CSS loader generator has ready-made designs.
Privacy
The keyframes, preview and demo page are generated in your browser. Nothing is uploaded.