How to Create CSS Animations with Keyframes
CSS animations bring web pages to life with motion, transitions, and interactive effects. The @keyframes rule defines animation sequences with multiple steps, while animation properties control timing, duration, and easing. Writing keyframe animations by hand requires understanding percentages, timing functions, and property changes. Visual animation editors let you design animations interactively with timeline controls and live preview. This guide shows you how to create CSS animations using fixie.tools — a free visual keyframe editor with instant code generation.
Step 1: Open the CSS Animation Generator
Navigate to fixie.tools/animation in your browser. The animation editor works entirely in your browser with no server processing. You'll see a preview element that plays your animation in real-time as you build it.
Step 2: Define Animation Keyframes
Create keyframes at different percentages (0%, 50%, 100%) that define property values at specific points in the animation timeline. For a simple fade-in, set opacity: 0 at 0% and opacity: 1 at 100%. For a slide-in, set transform: translateX(-100px) at 0% and transform: translateX(0) at 100%. Add intermediate keyframes at 25%, 50%, 75% for complex multi-step animations.
Step 3: Set Duration and Timing
Configure animation duration (how long one cycle takes) in seconds or milliseconds. Typical durations are 0.3s for quick transitions, 0.6-1s for standard animations, and 2-5s for slow, ambient effects. Choose a timing function (easing) — ease-in-out for natural motion, linear for constant speed, ease-in for acceleration, ease-out for deceleration, or custom cubic-bezier curves for precise control.
Step 4: Configure Iteration and Direction
Set iteration count — 1 for play-once animations, infinite for loops, or a specific number for repeated cycles. Choose animation direction — normal (start to end), reverse (end to start), alternate (ping-pong back and forth), or alternate-reverse. For loading spinners and continuous effects, use infinite + linear. For one-time entrance effects, use 1 + ease-out.
Step 5: Copy Animation CSS Code
The tool generates complete CSS including both the @keyframes rule and animation properties. Click Copy to copy the code to your clipboard. Paste into your stylesheet, then apply the animation to elements with the generated class name. The code includes vendor prefixes for browser compatibility and works in all modern browsers. You can customize the animation name to match your project naming conventions.