How CSS Cubic-Bezier Animation Easing Works
In CSS animations and transitions, the transition-timing-function property controls the speed curve of an animation. By default, CSS provides simple presets like linear, ease-in, and ease-out.
A custom cubic-bezier(x1, y1, x2, y2) function gives you fine-grained mathematical control over the acceleration and deceleration of UI elements, enabling natural spring effects, bouncy modals, and responsive hover micro-interactions.
Why Custom Easing Makes Interfaces Feel Premium
- Natural Physicality: Linear animations look robotic and stiff. A subtle overshoot curve (e.g.
1.15on y2) makes buttons and menus feel tactile and responsive. - Cross-Browser Support: Fully supported in all modern web browsers across CSS Transitions, Keyframe Animations, and JavaScript Web Animations API.
- Performance Optimization: Runs on the browser's compositor thread at 60+ FPS without triggering layout reflows.
Frequently Asked Questions (FAQ)
Can bezier coordinates exceed 1.0 or fall below 0.0?
Yes! While the horizontal x1 and x2 time axis must remain between 0.0 and 1.0, the vertical y1 and y2 progress coordinates can exceed 1.0 or drop below 0.0 to produce springy bouncy overshoots.
How do I use this timing function in CSS keyframes?
You can assign animation-timing-function: cubic-bezier(...) to your entire element or specify it inside individual keyframe percentages (0%, 50%, 100%) for multi-step motion sequences.