linear() CSS Function
The linear() easing function defines a custom easing curve from a list of points, so it can create effects such as bounce or spring.
Description
The linear() CSS function defines a custom easing function by listing points that the animation's progress passes through, joined by straight lines. It is used wherever an easing function is accepted, such as transition-timing-function, animation-timing-function and the transition and animation shorthands. Do not confuse it with the linear keyword, which is a constant speed with no points.
Each point is an output value, usually from 0 to 1, optionally followed by one or two percentages that say when in the animation that output is reached. linear(0, 0.5 80%, 1) moves halfway in the first 80% of the time and then finishes quickly. Outputs can go above 1 or below 0 to create overshoot. Because you can add as many points as you like, linear() can approximate effects that cubic-bezier() cannot, such as bounces and springs. Tools exist that convert a JavaScript spring or bounce curve into a long linear() list.
/* Same as the linear keyword */
.a { transition-timing-function: linear(0, 1); }
/* Slow start, fast finish */
.b { transition-timing-function: linear(0, 0.25 75%, 1); }
/* Simple bounce at the end */
.drop {
animation: fall 1s linear(0, 0.36, 1 50%, 0.75, 1 75%, 0.94, 1) forwards;
}
Interactive Demo
Syntax
linear() = linear( [ <number> && <percentage>{0,2} ]# )Values
- <number>The output progress at this point, where 0 is the start value and 1 is the end value. Values outside 0 to 1 create overshoot.
- <percentage>Optional. When in the animation (input progress) this output is reached. Two percentages hold the output steady between them. Points without a percentage are spaced evenly between their neighbours.
Example
Browser Support
The following information will show you the current browser support for the CSS linear() function. Hover over a browser icon to see the version that first introduced support for this CSS function.
Desktop





Tablets & Mobile





