CSS Animation Generator
Choose an animation preset, set how long it runs, how it eases, how many times it repeats and how far it moves, and the tool writes the @keyframes block and the rule that applies it. The code is plain CSS with no library needed. There is no looping preview on this page, so each preset is described below and in the guide; paste the code into your page to see it move.
What you enter
- Preset
- Duration
- Delay
- Easing
- Times to play
- Repeat forever
- Direction
- Fill mode
- Distance
- Scale amount
- Class name
- Include a reduced motion rule
How it works
- Pick a preset. Fade, slide and zoom are entrances, while bounce, pulse, shake, float, blink and spin are attention or loop effects.
- Set the duration, the delay before it starts, the easing curve and the number of repeats, or tick Repeat forever for a loop.
- Set the distance for slides, bounce, shake and float, and the scale amount for zoom and pulse.
- Copy the CSS and add the class name to the element you want to animate. The reduced motion rule is included by default.
Choosing an easing curve
Easing is the speed profile of the motion. Ease-out starts fast and slows to a stop, which feels natural for things arriving on screen because it matches how objects settle. Ease-in starts slow and ends fast, which suits things leaving. Ease-in-out suits movement that starts and ends in view, and linear is for loops such as spinners where any change in speed would show as a stutter.
The overshoot option uses a cubic Bezier curve that goes slightly past the target and returns, which gives buttons and cards a springy feel. Use it for small distances; over a large distance the overshoot looks like a mistake.
Timing and delay
The delay is useful for staggering several items: give the first card a delay of zero, the second 0.1 seconds, the third 0.2 seconds and so on, and the group appears as a ripple instead of all at once. Keep the total stagger under about half a second or visitors will wait for the last item.
Do not animate things that people need to read or click while they move. A button that slides in over a full second can be missed or tapped in the wrong place. Let the content settle quickly and use the longer loops only for decoration.
Performance and accessibility
Properties like width, height, top and margin force the browser to recalculate the page layout on every frame, which makes animation janky on weaker devices. Transform and opacity do not, and every preset here uses only those two. If you need something to grow, use scale rather than width.
The prefers-reduced-motion media query is the standard way to respect a visitor's system setting. Inside it, the generated code turns the animation off completely. For loops that carry meaning, such as a loading spinner, you may prefer to slow it down rather than stop it.
Tips
- Keep entrance animations short, usually between 0.3 and 0.8 seconds. Longer than a second makes a page feel slow.
- Animate transform and opacity only. The browser can run them on the graphics chip without recalculating the layout, so they stay smooth even on a phone.
- Use fill mode both for entrances. Without it, an element with a delay shows briefly in its final position before the animation starts.
- Loops draw the eye and never stop, so use them sparingly: one pulsing call-to-action is a signal, five are noise.
- Leave the reduced motion rule on. Some people get dizzy or distracted by movement and ask their device to minimise it, and the rule respects that.
Frequently asked questions
What is a CSS keyframe animation?
It is a set of named waypoints. The @keyframes block lists what the element should look like at points along the timeline, such as from and to or 0%, 50% and 100%, and the animation property tells an element which block to play and how fast.
What does the animation shorthand contain?
In order: the keyframes name, duration, timing function, delay, iteration count, direction and fill mode. For example, fade-in 2s ease-in-out 0.5s 3 normal forwards plays the fade-in block over 2 seconds, after a 0.5 second wait, three times.
What is fill mode?
It controls what the element looks like before and after the animation. Forwards keeps the final frame, backwards applies the first frame during the delay, both does both, and none returns the element to its normal style.
How are the distance and scale used?
Slides start the given number of pixels away and move to their normal place. Zoom in starts at one minus the scale amount: a scale amount of 20% starts at 0.8 size. Pulse grows to one plus the scale amount, so 20% grows to 1.2 times. Shake swings a quarter of the distance each side.
Can I run two animations on one element?
Yes, but only by separating them with a comma in one animation property. Two animations that both set transform will fight each other, so combine them in one keyframes block or wrap the element in a second element.
Related: CSS shadow generator, CSS layout generator, CSS gradient generator.
Start a 7-day free trial or see all free tools. On We.Inc you get a 7-day free trial, not a free plan: card needed, $0 today, cancel before it ends and you pay nothing. AI building is on paid plans from $20 a month.
More in Free Tools
- CSS Background Generator
- CSS Border Generator
- CSS Button Generator
- CSS Clamp Generator
- CSS Filter Generator
- CSS Formatter
- CSS Gradient Generator
- CSS Grid Generator
Related guides
Product
Who It's For
- For Agencies
- For Freelancers
- For Hosting Providers
- For SaaS Platforms
- For Startups
- For Financial Services
- For Healthcare
Features
Resources
- Blog
- Help Center
- Free Business Tools
- Free UI Components
- Website Templates
- Template Collections
- Website Examples
- Guides
- Comparisons
- Alternatives
- Best Lists
- Reviews
- Pricing Guides
- Use Cases
- Glossary & Guides
- Integrations
- Developers
- Benchmark
- Windows App