Skip to content
Tutorials Center
My learning

Topics

CSS Reference ยท Transforms, Transitions and Animations

The animation-timing-function property

Reference for the CSS animation-timing-function property: easing between keyframes with ease, linear, cubic-bezier(), steps() and linear(), with live examples.

The animation-timing-function property sets the easing of a keyframe animation: whether movement starts slowly, runs at a steady speed, jumps in steps, or follows a custom curve.

There is one important difference from transitions. In an animation the curve is applied between each pair of keyframes, not across the whole animation. With keyframes at 0%, 50% and 100%, an ease-in-out curve eases in and out of each half separately, so the movement slows down at the middle keyframe too. A keyframe can also set its own animation-timing-function to override the element's value for the segment that follows it.

CSS
.ball {
  animation: drop 1s ease-in infinite;
}

Try it

Easing per keyframe segment

Watch the ease-in-out dot: it slows down in the middle of the lane, because the 50% keyframe ends one segment and starts another.

Syntax

CSS
animation-timing-function: <easing-function>#

<easing-function> =
    linear | ease | ease-in | ease-out | ease-in-out
  | cubic-bezier(<x1>, <y1>, <x2>, <y2>)
  | steps(<integer>[, <step-position>])
  | step-start | step-end
  | linear(<stop>#)
  • Initial value: ease
  • Applies to: all elements, and the ::before and ::after pseudo-elements
  • Inherited: no
  • Animatable: no
  • Computed value: as specified

Values

Value Description
ease Slow start, quick middle, slow end. Equal to cubic-bezier(0.25, 0.1, 0.25, 1).
linear Constant speed.
ease-in Starts slowly: cubic-bezier(0.42, 0, 1, 1).
ease-out Ends slowly: cubic-bezier(0, 0, 0.58, 1).
ease-in-out Slow at both ends: cubic-bezier(0.42, 0, 0.58, 1).
cubic-bezier(x1, y1, x2, y2) A custom curve; x values in the range 0 to 1, y values may leave it to overshoot.
steps(n, position) n equal jumps. Positions: jump-start, jump-end (default), jump-both, jump-none.
step-start, step-end One jump at the start or at the end of each segment.
linear(...) A curve made of straight segments between listed points; useful for bounce and spring effects.
Comma-separated list One easing per animation name.

Usage notes

  • Per segment, not per run. Use linear on the element when keyframes already describe the motion you want, and put easing inside individual keyframes when only some parts should ease.
  • Looping spinners need linear; the default ease makes each turn pause at the start and end.
  • Inside a keyframe. Writing animation-timing-function in a keyframe block affects only the segment starting at that keyframe. In other properties of a keyframe rule, most other animation settings are ignored.
  • steps() for frame animation. Use steps(n) with a sprite sheet or a typewriter reveal. The jump-none position holds both the first and last value, which suits discrete series.
  • linear() is newer. It allows hand-written bounce curves. Check a compatibility table and provide a cubic-bezier() fallback.
  • Overshoot with y-values outside 0 to 1 is fine for transform, but may be clamped for properties with limited ranges, such as opacity.
  • Easing is not a substitute for duration. If a motion feels wrong, adjust the time and the curve together.

Browser support

The keywords, cubic-bezier() and steps() work in every browser; linear() is newer, so check a compatibility table.