CSS Animation Generator
Visually build CSS @keyframes animations — keyframe editor, easing selector, live preview, one-click copy
Presets
Timing
Iteration Count
Easing & Playback
Keyframe Stops (3)
Edit Keyframe at 0%
Live Preview
The purple square animates using your exact generated CSS
Generated CSS
@keyframes my-animation {
0% {
transform: translateX(0) scale(1);
opacity: 1;
}
50% {
transform: translateX(50px) scale(1.2);
opacity: 0.7;
}
100% {
transform: translateX(0) scale(1);
opacity: 1;
}
}
.animated-element {
animation-name: my-animation;
animation-duration: 1s;
animation-timing-function: ease;
animation-delay: 0s;
animation-iteration-count: infinite;
animation-direction: normal;
animation-fill-mode: none;
}More Formats
@keyframes my-animation {
0% {
transform: translateX(0) scale(1);
opacity: 1;
}
50% {
transform: translateX(50px) scale(1.2);
opacity: 0.7;
}
100% {
transform: translateX(0) scale(1);
opacity: 1;
}
}animation: my-animation 1s ease 0s infinite normal none;You need a card entrance animation — slide in from the left, fade in, and stop at the final position. That’s three CSS properties (transform, opacity, animation-fill-mode) across two keyframe stops, plus the timing function, duration, delay, and iteration count. Writing it by hand means guessing at cubic-bezier values, refreshing to check, tweaking, refreshing again. And if you need the animation to stagger across a list of cards, you’re doing mental math on animation-delay offsets.
Why This Tool (Not DevTools or Copy-Paste from Animate.css)
Animate.css gives you pre-built animations with great naming (fadeInLeft, bounceIn), but customizing them means forking the library or overriding timing in your own stylesheet. Chrome DevTools has an animation inspector for debugging, but no way to build new animations from scratch. This tool lets you add keyframe stops on a visual timeline, set per-stop transforms and opacity, pick easing curves, and watch the result animate in real time — then copy the exact @keyframes block + animation shorthand. Everything runs in your browser; no data is sent to any server.
What Is a CSS Animation?
A CSS animation is defined by two things: a @keyframes rule that describes what properties change at each point in time, and the animation property on the element that ties it all together.
How to Use This Tool
- Choose a preset — start from a built-in animation (Fade In, Bounce, Spin, Pulse, Slide In, Color Shift) or build from scratch
- Set the animation name — this becomes the
@keyframesidentifier and theanimation-namevalue - Add or remove keyframe stops — each stop represents a percentage of the animation timeline (0% to 100%)
- Edit per-keyframe properties — set
transform,opacity,background-color, or any extra CSS for each stop - Configure timing — adjust duration, delay, iteration count, direction, and fill-mode
- Pick an easing function — choose from ease, linear, ease-in, ease-out, ease-in-out, or a custom
cubic-bezier() - Watch the live preview — the sample element animates in real time using your exact CSS
- Copy the output — copy the generated
@keyframesblock + animation properties with one click
@keyframes Explained
The @keyframes rule defines the animation sequence. Each selector inside it is a keyframe stop — a snapshot of CSS properties at a specific point in time:
@keyframes slide-in {
0% {
transform: translateX(-100px);
opacity: 0;
}
100% {
transform: translateX(0);
opacity: 1;
}
}
You can use from and to as aliases for 0% and 100%, or any percentage in between. Browsers interpolate the property values between stops.
The animation Property
The animation shorthand applies a @keyframes animation to an element:
.element {
animation: slide-in 0.4s ease-out 0s 1 normal forwards;
}
| Sub-property | Example | Description |
|---|---|---|
animation-name | slide-in | Matches the @keyframes name |
animation-duration | 0.4s | How long one cycle takes |
animation-timing-function | ease-out | Speed curve within each cycle |
animation-delay | 0s | Wait before starting |
animation-iteration-count | 1 or infinite | How many times to repeat |
animation-direction | normal, reverse, alternate | Play direction |
animation-fill-mode | forwards, backwards, both, none | State before/after animation |
Easing Functions
The animation-timing-function controls the rate of change between keyframe stops:
| Value | Effect |
|---|---|
ease | Slow start, fast middle, slow end (default) |
linear | Constant speed throughout |
ease-in | Slow start, accelerates at end |
ease-out | Fast start, decelerates at end |
ease-in-out | Slow at both ends |
cubic-bezier(x1, y1, x2, y2) | Custom speed curve |
Tip: Use linear for continuous rotations so the motion feels uniform. Use ease-in-out for elements that expand and contract, like a pulsing effect.
transform Property Values
The transform property is the workhorse of CSS animations. Common functions:
| Function | Example | Effect |
|---|---|---|
translateX(n) | translateX(50px) | Move horizontally |
translateY(n) | translateY(-20px) | Move vertically |
translate(x, y) | translate(10px, 20px) | Move both axes |
scale(n) | scale(1.5) | Uniform scale |
scaleX(n) / scaleY(n) | scaleX(0.5) | Scale one axis |
rotate(deg) | rotate(360deg) | Rotate |
skewX(deg) | skewX(15deg) | Skew horizontally |
Combine multiple transforms in one value: transform: translateY(-40px) scale(1.1) rotate(5deg);
animation-fill-mode
fill-mode determines what styles apply before the animation starts and after it ends:
none— the animation has no effect outside its active period. The element snaps back to its original state.forwards— the element retains the last keyframe’s styles after the animation ends. Use for one-shot animations like “fade in”.backwards— the element applies the first keyframe’s styles during the delay period.both— combines forwards and backwards behavior.
animation-direction
normal— plays 0% → 100%, then resets to 0% for the next cyclereverse— plays 100% → 0%alternate— alternates between normal and reverse on each cycle (smooth back-and-forth)alternate-reverse— starts in reverse, then alternates
Performance Tips
Animate only compositor-friendly properties for smooth 60 fps animation:
transform— runs entirely on the GPU compositor threadopacity— also compositor-accelerated
Properties that trigger layout or paint (avoid in loops):
width,height,top,left,margin,padding— cause layout recalculationbackground-color,color,box-shadow— cause paint
For animations that require non-compositor properties, consider using the will-change hint:
.animated-element {
will-change: transform, opacity;
}
Frequently Asked Questions
What is the difference between CSS animations and CSS transitions?
CSS transitions animate a property from its current value to a new value when that value changes (usually triggered by :hover or a class toggle). CSS animations use @keyframes to define a sequence with multiple steps and can play automatically, loop, and alternate direction without any trigger.
Can I animate multiple properties at the same time? Yes. Within each keyframe stop you can set as many CSS properties as needed. The browser interpolates all of them simultaneously.
How do I pause and resume a CSS animation with JavaScript?
Set element.style.animationPlayState = 'paused' to pause and 'running' to resume.
Why does my animation jump at the end?
This usually means the 0% and 100% keyframes are not aligned. If you want a seamless loop, ensure those keyframes have the same property values. Also try animation-direction: alternate for automatic smooth reversal.
How do I chain multiple animations?
Use the animation property with a comma-separated list:
.element {
animation: fade-in 0.3s ease forwards,
slide-up 0.3s ease 0.1s forwards;
}
What does animation-fill-mode: forwards do?
It makes the element hold the last keyframe’s styles after the animation finishes. Without it, the element reverts to its pre-animation state when the animation ends.