CSS Animation Generator
Controls
Preview & CSS
How to Use
- Select a preset — Choose Fade In, Slide Up, Bounce, or Pulse as your animation starting point.
- Set duration — Adjust the slider from 0.1 to 5 seconds for speed control.
- Choose timing — Select an easing function (ease, linear, cubic-bezier, etc.) to control acceleration.
- Set delay & iterations — Add a delay before start and control how many times it repeats.
- Pick direction & fill — Control whether the animation plays in reverse or alternates, and what state the element holds after.
- Copy CSS — Get the complete
@keyframesblock plus the animation shorthand.
What Is the CSS Animation Property?
The CSS animation shorthand combines eight sub-properties: name, duration, timing-function, delay, iteration-count, direction, fill-mode, and play-state. Together they drive keyframe-based animations purely in CSS — no JavaScript needed for most effects.
@keyframes defines the states. The animation property applies them to elements. You can layer multiple animations by comma-separating values.
Common Use Cases
Tips & Best Practices
Animating transform and opacity uses the compositor thread — far cheaper than animating layout properties like width or top.
Wrap animations in @media (prefers-reduced-motion: no-preference) so users who prefer less motion are not affected.
fill-mode: both combines forwards and backwards — the element starts in the first keyframe state and ends in the last.
Apply the same animation to multiple elements with incrementally higher delays to create staggered entrance effects.
Frequently Asked Questions
What is the difference between animation-direction: alternate and reverse?
reverse plays the keyframes backwards on every cycle. alternate plays forward then backward on successive iterations, creating a ping-pong effect.
When should I use animation-fill-mode: forwards?
Use forwards when you want the element to stay in its final keyframe state after the animation completes — for example, a fade-in that should remain visible.
Can I animate multiple properties at once?
Yes. A single @keyframes block can set any number of CSS properties at each keyframe step. The Slide Up preset, for example, animates both transform and opacity simultaneously.
What is cubic-bezier(0.4, 0, 0.2, 1)?
This is Google's Material Design easing curve — a fast start with a smooth deceleration. It gives UI transitions a natural, physical feel.