What is a cubic-bezier timing function?

A timing function decides how an animation or transition moves between its start and end. cubic-bezier(x1, y1, x2, y2) describes it as a curve from (0, 0) to (1, 1): the x axis is the time that has passed, and the y axis is how far the motion has gone. The four numbers are the positions of two control points that bend the curve. A steep part of the curve is fast motion, a flat part is slow.

You use it in transition-timing-function, animation-timing-function or the transition and animation shorthands.

How to use the generator

  1. Drag the two round control points in the editor, or pick a preset.
  2. Or type or paste a timing function into the field: cubic-bezier(0.25, 0.1, 0.25, 1), just the four numbers, or a keyword such as ease-in-out.
  3. Press Play to compare the motion of your curve with a linear one, and change the duration to see it slower or faster.
  4. Copy the timing function, or the ready-made transition line.

The control points can also be moved with the keyboard: focus one with Tab and use the arrow keys, holding Shift for bigger steps.

Reading the curve

  • The x values must stay between 0 and 1, because time can't run backwards. The editor keeps them there.
  • The y values can go below 0 or above 1. Then the motion overshoots: it goes a little past its end and comes back, or pulls back before it starts. The preview's dashed lines mark the start and end, so you can see the overshoot.
  • The dashed diagonal in the editor is the linear timing function, for comparison.

The presets

The first five are the timing functions CSS has keywords for: linear, ease, ease-in, ease-out and ease-in-out. The others are popular curves from the easings.net collection, named in the same style as the keywords (easings.net calls them easeOutCubic, easeInOutCubic and easeOutBack): ease-out-cubic slows down smoothly at the end, ease-in-out-cubic speeds up and slows down more strongly than ease-in-out, and ease-out-back overshoots a little before settling. The preset that matches the current curve is highlighted.

Examples

  • cubic-bezier(0.25, 0.1, 0.25, 1) is the same as ease, the default of CSS transitions.
  • cubic-bezier(0, 0, 0.58, 1) is ease-out: a quick start and a gentle stop, good for things entering the screen.
  • cubic-bezier(0.34, 1.56, 0.64, 1) is ease-out-back, with a playful overshoot.

Features

  • Curve editor with draggable control points, also usable with the keyboard
  • Type or paste any timing function or CSS keyword
  • CSS keyword presets and popular easing curves
  • Motion preview against linear with an adjustable duration
  • Copy the timing function or a transition line
  • Runs in your browser