Skip to content
Tutorials Center
My learning

Topics

CSS Reference Β· Functions

The linear() function

Reference for the CSS linear() easing function: piecewise-linear timing with stops, building bounce and spring effects, syntax details and live examples.

The linear() function is an easing function built from straight segments. You list output values (progress, usually from 0 to 1) and the browser draws straight lines between them across the duration. With enough points, you can approximate any curve, including ones a cubic BΓ©zier cannot make: bounces, springs and elastic wobbles.

Do not confuse it with the linear keyword (constant speed) or with linear-gradient().

CSS
.ball {
  animation: drop 900ms linear(0, 0.6, 1, 0.8, 1, 0.95, 1);
}

Try it

A bouncing easing

Syntax

CSS
linear( <stop># )

/* <stop> = <number> && <percentage>{0,2} */
linear(0, 0.25, 1)             /* points spread evenly in time */
linear(0, 0.25 75%, 1)         /* the 0.25 point sits at 75% of the duration */
linear(0, 0.5 25% 50%, 1)      /* the value 0.5 is held from 25% to 50% */
  • Where it works: animation-timing-function, transition-timing-function and the shorthands.
  • Inherited: not applicable. Animatable: no.

Values

Part Description
Number The progress at that point. 0 is the start value and 1 the end value. Numbers outside 0 to 1 overshoot.
One percentage The time position of the point in the duration. Without it, points without positions are spaced evenly between their neighbors.
Two percentages The same value is held between both positions (a flat part).

If the first point has no position it is placed at 0%, and an unpositioned last point at 100%. Positions must not go backward; the browser corrects ones that do.

Usage notes

  • Why it exists. A cubic BΓ©zier has one smooth bend. Bounce, spring and elastic motion need several, which linear() can sample from a spring formula.
  • Generate the points. Real spring curves have dozens of points. Write them with an easing generator or a script, then paste the result into a custom property such as --spring.
  • Smoothness comes from point count. Few points look angular; many points look smooth.
  • Start and end. Curves usually begin at 0 and end at 1; if they do not, the animation jumps at the start or end.
  • Combine with animation-fill-mode so the element stays at the final value.
  • Respect motion preferences. Bounces are decorative, so reduce or remove them under prefers-reduced-motion.

Browser support

The linear() easing function is supported by the current versions of all major browsers; check a compatibility table if you must support older ones. Unsupported browsers ignore the declaration, so set an ease fallback before it.