Keyframe Animation Builder
Build CSS keyframe animations visually. Add keyframe stops, set transform, opacity, and color values, preview the animation live, and copy ready to use @keyframes CSS.
Build @keyframes Without Guessing Percentages
CSS keyframe animations are powerful but awkward to write blind. You pick an offset like 50%, guess a rotate value of 180deg, reload the page, and repeat until the motion feels right. This builder flips that workflow: add stops, adjust transform, opacity, and background color values, and watch the preview animate instantly as you type.
When the motion looks right, copy the generated @keyframes block and animation shorthand straight into your stylesheet.
Anatomy of a Keyframe Animation
The generated CSS has two parts. The @keyframes rule holds one block per keyframe stop, each containing:
- transform: a combined translate, rotate, and scale that positions and shapes the element.
- opacity: the element's transparency at that moment, from 0 to 1.
- background-color: the fill color at that stop, which can shift gradually between stops.
The second part is a class rule that applies the animation shorthand: name, duration, timing function, iteration count, direction, and fill mode. Apply that class to any element to run the animation.
Choosing Timing, Direction, and Fill Mode
- Timing function:
linearmoves at a constant speed, whileease,ease-in,ease-out, andease-in-outadd acceleration. Use ease-in-out for a natural swing feel. - Iterations: a fixed count like 3 runs the animation three times, and
infiniteloops it forever. Loading spinners and pulsing badges usually use infinite. - Direction:
alternateplays forward then backward on each cycle, which is ideal for breathing and bobbing motions.reverseplays the animation backwards. - Fill mode:
forwardskeeps the last keyframe's styles after the animation ends,backwardsapplies the first keyframe during any delay, andbothcovers both cases.
Tips for Smooth Motion
- Keep the first and last stops consistent when you want a seamless loop: copy the 0% values to 100% so the element returns to its starting pose.
- Rotate and scale combine well with a slight translate to create an orbiting or floating effect.
- Prefer animating transform and opacity, which browsers can composite on the GPU, over properties like width and top that trigger layout.
- Use the Replay button to restart the preview whenever you want to rewatch a short animation.
- Name animations descriptively like
card-pulseorlogo-spin, and keep names unique across your stylesheet.
How to Use the Builder
- Set the animation name, duration, timing, iterations, direction, and fill mode.
- Adjust the three default keyframe stops, or click Add Keyframe to insert a new stop in the largest gap and edit its values.
- Watch the preview animate live and press Replay for a fresh look.
- Copy the CSS output or download it as a .css file, then paste it into your project.
Related Reading
A keyframe animation pairs well with transitions for hover states, and with the transform shorthand for one-off movements. If you only need an entrance effect, combine a single keyframe animation with an animation-fill-mode of forwards so the element stays in place after it appears.
Frequently Asked Questions
What properties can I animate at each keyframe stop?
Each stop controls a combined transform (translate X, translate Y, rotate, and scale), opacity, and background color. Those cover the majority of common UI animations while keeping the generated CSS readable.
How do I add and remove keyframe stops?
Click Add Keyframe to insert a new stop at the midpoint of the largest gap between existing stops, then edit its percentage and values. Each stop has a remove button, and at least two stops are always kept so the animation stays valid.
Why does my animation restart when I change settings?
The preview remounts when the generated CSS changes so you immediately see the updated motion. That is why edits restart the animation from the beginning instead of continuing mid-cycle.
What do offset percentages on the stops mean?
Each percentage is the point in the animation timeline where that stop's values apply. 0% is the start, 100% is the end, and a stop at 50% is the halfway pose. The CSS output sorts stops by percentage automatically.
Can I use the generated CSS in any project?
Yes. The output is standard @keyframes CSS with no prefixes or dependencies, so it works in any web project, whether you use plain CSS, Tailwind, SCSS, or a component library.
Does the builder send my animation to a server?
No. The preview and CSS generation run entirely in your browser. Nothing is uploaded or stored, and the tool works offline after the page loads.
Related Tools
Explore more CSS generators for your project: