Ttooleras
🎬

CSS Animation Generator

CSS Tools

Build CSS keyframe animations and transitions with live preview and easing curves. Free, private — all processing in your browser.

Color Stops (3)
background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #ec4899 100%);
Advertisement

The CSS Animation Generator lets you build keyframe animations and transitions visually — no typing @keyframes blocks from scratch. Pick from common animation patterns (fade, slide, scale, rotate, bounce, shake, pulse, spin, zoom) or build custom keyframes by adding stops at specific percentages (0%, 50%, 100%) and specifying properties at each stop. Configure timing with a visual cubic-bezier editor — drag control points to fine-tune easing curves beyond the default ease-in, ease-out, ease-in-out. See the animation running live in a preview box, tweak until it feels right, then copy the complete CSS ready to drop into your stylesheet.

Animations and transitions are the difference between a flat website and one that feels alive. Done well, they guide attention, communicate state changes, and delight users. Done poorly, they annoy and distract. Getting animations right requires tuning — duration (too fast feels jarring, too slow feels sluggish), easing (linear feels mechanical, ease-in-out feels natural), timing, and property selection (animate transform and opacity for GPU acceleration; avoid animating layout properties like width or margin). This generator handles all of that — including GPU-friendly property recommendations so your animations stay smooth at 60fps.

CSS Animation Generator — key features

Preset animations

Fade, slide, scale, rotate, bounce, shake, pulse, spin, zoom, flip — instant starting points.

Visual keyframe editor

Add stops at any percentage. Specify transform, opacity, color at each stop.

Cubic-bezier curve editor

Drag control points to customize easing. See preview updating live.

Transition mode

Switch between full keyframe animation and simple transition (hover/focus/state change).

Live preview

Animation plays in a preview box. Tweak parameters, see result instantly.

GPU-friendly properties only

Tool recommends transform + opacity for smooth 60fps. Warns about layout-triggering properties.

prefers-reduced-motion

Generated CSS includes motion-reduce media query by default. Accessible by default.

Copy-paste ready

Complete @keyframes block plus animation property. Works in any stylesheet.

How to use the CSS Animation Generator

  1. 1

    Pick a preset or start custom

    Fade, slide, bounce, rotate — or build from scratch. Presets are starting points.

  2. 2

    Set duration

    150-300ms for UI feedback, 500-1000ms for entrances, 2-3s for attention loops. Too fast feels jarring, too slow feels sluggish.

  3. 3

    Choose easing curve

    ease-out for UI (natural deceleration). cubic-bezier for custom. linear only for mechanical (rotations, loading indicators).

  4. 4

    Configure keyframes (for custom)

    Add stops at specific percentages. At each stop, specify transform/opacity/color values.

  5. 5

    Add iteration and delay

    Iteration: 1 (once), infinite (loop), specific number. Delay: how long to wait before starting.

  6. 6

    Preview and tweak

    Watch the animation play. Adjust until it feels right.

  7. 7

    Copy CSS

    Complete @keyframes + animation property ready to paste into your stylesheet.

Common use cases for the CSS Animation Generator

UI feedback

  • Button hover effects: Smooth color transition and slight scale on hover. 200-300ms ease-out feels responsive.
  • Form validation feedback: Shake animation on error, checkmark fade-in on success. 400-600ms.
  • Modal open/close: Fade + scale up for open, fade + scale down for close. 200ms ease-out.
  • Toast notifications: Slide in from right, hold, slide out. Timed sequence with delay.

Page transitions

  • Page fade-in on load: Content fades in gently as it mounts. 500ms ease-out.
  • Staggered item appearance: List items fade in one after another with animation-delay. 100-200ms stagger.
  • Hero animation: Headline slides up as page loads, subhead follows, CTA fades in.
  • Route transitions: Between page navigation — content fades out old, fades in new.

Loading states

  • Spinner: Infinite rotation, linear easing. Classic loading indicator.
  • Skeleton shimmer: Gradient moving across placeholder content. 1.5s infinite linear.
  • Progress bar: Width transition as progress updates (or use transform: scaleX for smoother).
  • Pulsing dots: Scale + opacity on dots, staggered by delay. Engaging while waiting.

Attention and delight

  • Success confirmation: Checkmark draws in, scales up briefly, settles.
  • Notification badge bounce: Badge appears with bounce on new notification.
  • Hero attention grabbers: Subtle float or pulse on CTA buttons to draw eye.
  • Achievement unlocks: Celebration animations — confetti, trophy spin, etc.

CSS Animation Generator — examples

Fade in

Simple opacity transition.

Input
Preset: fade-in, 500ms
Output
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
.element { animation: fadeIn 500ms ease-out; }

Slide up entry

Element rises into position.

Input
Translate Y + opacity, 600ms ease-out
Output
@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
.element { animation: slideUp 600ms ease-out; }

Bounce loading dot

Infinite bounce for loader.

Input
Keyframes at 0, 50, 100; infinite
Output
@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-20px); }
}
.dot { animation: bounce 600ms ease-in-out infinite; }

Spinner

Classic loading spinner.

Input
Rotate 360deg, linear, infinite
Output
@keyframes spin {
  to { transform: rotate(360deg); }
}
.spinner { animation: spin 1s linear infinite; }

Shake on error

Horizontal shake.

Input
Keyframes at 0, 25, 50, 75, 100
Output
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-8px); }
  50% { transform: translateX(8px); }
  75% { transform: translateX(-4px); }
}
.error { animation: shake 400ms ease-in-out; }

Hover transition

Button state change.

Input
Transition on transform + color
Output
.button {
  background: #3498db;
  transition: background 200ms ease-out, transform 150ms ease-out;
}
.button:hover {
  background: #2980b9;
  transform: translateY(-2px);
}

Shimmer skeleton

Loading placeholder with shimmer.

Input
Gradient moving across with background-position
Output
@keyframes shimmer {
  from { background-position: -200% 0; }
  to { background-position: 200% 0; }
}
.skeleton {
  background: linear-gradient(90deg, #eee 0%, #f5f5f5 50%, #eee 100%);
  background-size: 200% 100%;
  animation: shimmer 1.5s linear infinite;
}

Accessible animation

Respects prefers-reduced-motion.

Input
Include motion-reduce media query
Output
@keyframes slideIn {
  from { transform: translateX(-100%); }
  to { transform: translateX(0); }
}
.panel { animation: slideIn 400ms ease-out; }

@media (prefers-reduced-motion: reduce) {
  .panel { animation-duration: 0.01ms; }
}

Technical details

CSS animations (CSS3, widely supported since 2012) work via two mechanisms: transitions (simple state changes) and keyframe animations (complex multi-step animations).

CSS Transitions:

For property changes on state (hover, focus, class toggle):

``css
.button {
background: blue;
transition: background 300ms ease-in-out, transform 200ms ease-out;
}
.button:hover {
background: darkblue;
transform: scale(1.05);
}
``

Properties: transition-property, transition-duration, transition-timing-function, transition-delay. Or shorthand transition.

CSS Keyframe Animations:

For complex multi-step sequences:

```css
@keyframes bounce {
0%, 100% { transform: translateY(0); }
50% { transform: translateY(-20px); }
}

.ball {
animation: bounce 1s ease-in-out infinite;
}
```

Properties: animation-name, animation-duration, animation-timing-function, animation-delay, animation-iteration-count (number or infinite), animation-direction (normal, reverse, alternate), animation-fill-mode (none, forwards, backwards, both), animation-play-state.

Easing (timing functions):

- linear — constant speed (often feels mechanical).
- ease — default; ease-in, then ease-out.
- ease-in — slow start, fast end (accelerate).
- ease-out — fast start, slow end (decelerate) — feels most natural for UI.
- ease-in-out — slow start and end.
- cubic-bezier(x1, y1, x2, y2) — custom curve.
- steps(n) — discrete steps (useful for sprite animation).

Common cubic-bezier values:

- cubic-bezier(0.4, 0, 0.2, 1) — Material Design standard.
- cubic-bezier(0.68, -0.55, 0.265, 1.55) — with overshoot (bounce-in).
- cubic-bezier(0.175, 0.885, 0.32, 1.275) — ease-out-back.

GPU-friendly properties:

These properties can be animated smoothly at 60fps because they do not trigger layout or paint:

- transform (translate, scale, rotate, skew)
- opacity
- filter (blur, brightness, etc.)

Expensive properties (avoid animating):

These trigger layout or paint on every frame, causing jank:

- width, height, top, left, right, bottom, margin, padding — layout
- background-color, color — paint (OK for single transitions, avoid for continuous)

Prefer:

```css
/* BAD — animates layout */
.panel { transition: width 300ms; }
.panel.expanded { width: 300px; }

/* GOOD — animates transform */
.panel { transition: transform 300ms; transform: translateX(-300px); }
.panel.expanded { transform: translateX(0); }
```

prefers-reduced-motion:

Accessibility: some users opt into reduced motion. Respect it:

``css
@media (prefers-reduced-motion: reduce) {
* {
animation-duration: 0.01ms !important;
transition-duration: 0.01ms !important;
}
}
``

Performance tips:

- Use will-change: transform, opacity to hint the browser to use GPU compositing.
- Keep animations short (100-500ms for UI feedback, 1-2s for attention-getters).
- Avoid animating many elements simultaneously.
- Use requestAnimationFrame for JavaScript-driven animations.

Common problems and solutions

Janky animations (choppy, not 60fps)

Animating layout properties (width, height, top, left, margin) triggers reflow on every frame. Animate transform and opacity instead — they are GPU-accelerated and stay smooth.

Animation not playing

Check: (1) animation-name matches @keyframes name exactly. (2) Element has animation property, not just @keyframes declared. (3) Element exists in DOM when CSS applies.

Element snaps back after animation ends

Default animation-fill-mode is none, so element returns to original state. Use fill-mode: forwards to keep final keyframe, or backwards to use first keyframe during delay.

Too-long animations

UI feedback: 150-300ms. Entrances: 400-600ms. Continuous loops: 1-3s. Longer feels sluggish and users skip over content. Shorter can feel snappy and responsive.

Linear easing for UI

Linear looks mechanical for UI. Use ease-out (decelerate to stop) for most UI interactions — feels natural, like real-world physics. Linear is fine for rotations and continuous motion.

Ignoring prefers-reduced-motion

~5% of users enable reduced motion (vestibular disorders, preference). Your CSS should respect it. Wrap animations in @media (prefers-reduced-motion: reduce) that disables or shortens animations.

Animation on page load jitter

Animation runs during initial page render, potentially before content is fully positioned. Use animation-delay to wait, or trigger animation after load event in JavaScript.

Too many simultaneous animations

Animating 100 elements at once taxes the browser. Stagger with animation-delay or limit to visible elements (Intersection Observer).

CSS Animation Generator — comparisons and alternatives

CSS transitions vs CSS animations: Transitions are for simple state changes (hover, focus) — from one value to another. Animations can have multiple keyframe stops, loop, and run without triggering events. Transitions are simpler; animations are more powerful.

CSS animations vs JavaScript animations: CSS is declarative, GPU-accelerated, and synchronized with browser compositor. JS animations (requestAnimationFrame, GSAP, Motion One) give fine-grained control, timeline orchestration, and physics. Start with CSS; switch to JS when you need complex sequencing.

CSS animations vs Web Animations API: Web Animations API gives CSS keyframes programmatic control via JavaScript. Element.animate() lets you control play/pause, reverse, speed. More powerful than CSS alone but requires JS.

CSS animations vs transform transitions: Transitions on transform/opacity are the 90% case — faster to write, less code, GPU-accelerated. Reserve keyframe animations for actual multi-step sequences or loops.

GSAP vs CSS animations: GSAP (GreenSock) is the industry-standard JS animation library. Far more powerful — timelines, stagger, morph, scroll-based, SVG path animations. But requires adding a library (150KB minified). Use CSS for simple, GSAP for complex.

Animate.css vs custom: Animate.css is a library of pre-made animations. Drop it in, add a class. Good for rapid prototyping or simple needs. Custom animations fit your brand better. This generator bridges — gives you custom CSS from visual editing.

Frequently asked questions about the CSS Animation Generator

What is the difference between animation and transition?

Transition animates between two property values when they change (hover, class toggle). Simple, one-to-one. Animation uses @keyframes with multiple stops, can loop, run without events. Use transition for state changes; animation for complex sequences.

How do I make my animation smooth (60fps)?

Animate only transform and opacity. These are GPU-accelerated and do not trigger layout or paint. Avoid animating width, height, top, left, margin — these cause reflow. Add will-change: transform hint for browser optimization.

How long should my animation be?

UI feedback (button press, menu open): 150-300ms. Entry animations (page load, modal): 400-600ms. Attention loops (spinner, pulse): 1-3s infinite. Longer = sluggish. Shorter = jarring. 200-300ms is the sweet spot for most UI.

What easing should I use?

ease-out for most UI — decelerates to stop, feels natural. linear only for continuous motion (rotations). ease-in for exits. cubic-bezier for custom curves. Material Design uses cubic-bezier(0.4, 0, 0.2, 1).

What is cubic-bezier?

A function defining an easing curve with 4 control points (x1, y1, x2, y2). Each CSS easing (ease, ease-in, ease-out) maps to a specific cubic-bezier. Use for custom timing curves. Tool visualizers like cubic-bezier.com let you drag control points to design curves.

Why does my animation not loop?

Set animation-iteration-count: infinite. Default is 1 (play once). For multiple iterations, use a number (3 = play 3 times). Use alternate direction (animation-direction: alternate) for back-and-forth.

What is animation-fill-mode?

Controls element state outside the animation duration. none (default): returns to original. forwards: keeps final keyframe. backwards: uses first keyframe during delay. both: both forwards and backwards. Typically forwards is what you want — keep the end state.

How do I trigger an animation with JavaScript?

Add a CSS class: element.classList.add(animate-in). CSS class has the animation property. Remove class to stop. Or use Web Animations API: element.animate(keyframes, options) for full JS control.

What is prefers-reduced-motion?

CSS media query that detects if the user has enabled reduced motion (OS accessibility setting). Respect it for accessibility: wrap animations in @media (prefers-reduced-motion: reduce) that disables or shortens them. Some users get nausea from excessive motion.

Can I animate colors?

Yes, but with caveats. Color transitions are OK (paint only). Continuous color animations are expensive (paint on every frame). Use SVG filters or backdrop-filter for color effects that need GPU acceleration.

Additional resources

Advertisement

Related tools

All CSS Tools

Learn more

Explore more tools

200+ free tools that run in your browser.

Browse all tools →