Animation Intermediate

Custom easing curves without cubic-bezier guessing

Creating non-standard easing like bounce or spring required either a cubic-bezier approximation (which can only produce curves, not bounces) or a JavaScript animation library. linear() defines an easing function by interpolating between a list of keyframe values.

Modern
4 lines
1.el {
2  transition: transform 0.6s
3    linear(0, 1.2 60%, 0.9, 1.05, 1);
4}
Old JS required
1// JS animation library for bounce/spring easing
2anime({
3  targets: el,
4  translateY: -20,
5  easing: 'easeOutBounce'
6});
Newly available Since 2024 87% global usage

Since 2024 this feature works across the latest devices and browser versions. This feature might not work in older devices or browsers.

Works in all modern browsers. May need a fallback for older browsers.

113+
112+
17.2+
113+
click trigger β€” see the bounce on the right
ease-out (old)
linear() bounce
linear(0, 0.06, 0.25, 0.56, 1 36%, 0.88, 0.81, 0.88, 1 73%, 0.95, 1)
Kinsta

Your first month is free

Managed WordPress hosting for faster sites.

Learn more
⚑

Bounce and spring without a library

cubic-bezier() can only produce S-curves. linear() can overshoot and come back, producing bounces, springs, and elastic effects in pure CSS.

✦

Works with transition and animation

linear() is a standard easing value. Use it anywhere you use ease, ease-in-out, or cubic-bezier β€” in transitions, animations, and animation-timing-function.

∞

Optional position hints

Each stop can include an optional percentage hint. linear(0, 1.2 60%, 1) puts the overshoot at 60% of the duration rather than evenly spaced.

Old Approach
JS animation library
anime.js, GSAP, or cubic-bezier approximations
Modern Approach
linear()
Keyframe values define the easing curve
Supports
Bounce + Spring
Overshooting values create non-cubic curves

How it works

cubic-bezier() defines an easing curve with two control points. Because it is a cubic function, it cannot cross itself β€” it can only produce smooth S-curves. Achieving a bounce required either a JavaScript animation library or manually chaining multiple animations, which was complex and hard to maintain.

linear() defines an easing function by linearly interpolating between a list of output values. Values above 1 or below 0 overshoot, which creates bounce and spring effects. Optional percentage hints like 1.2 60% place a keyframe at a specific point in the duration. A useful tool for generating linear() curves is linear-easing-generator.netlify.app.

New CSS drops.

Join 600+ readers who've survived clearfix hacks.

ESC