Cubic Bezier Generator

Type the four numbers of a cubic-bezier() curve, watch a dot run it, and copy the line for your animation or transition.

FluffyShield Protected workspace
FluffyShield

Isolated workspace: other page scripts can't read your files. How FluffyShield works

Free · No upload · No sign-up · No usage quotas

What do the four numbers in cubic-bezier() do?

They bend a graph of time against distance. Once you can read that graph, the curve tells you where your element is at every moment of the move.

A graph with the clock along the bottom

Say a menu slides in from the side of your page, and the design notes ask for cubic-bezier(0.16, 1, 0.3, 1). A word like ease-out at least hints at what it does. Four bare numbers don't.

They make sense once you see what they're drawn on: a graph of one trip. Along the bottom runs the clock, from the moment the menu starts moving to the moment it stops. Up the side runs the distance, from where it starts to where it ends up. Every easing curve begins in the bottom-left corner and finishes in the top-right one, so those two points are never yours to set.

What you set are two handles that pull the line between them out of straight. X1 and Y1 say where the first one sits, across and then up, and X2 and Y2 do the same for the second. Across is time, and time can't run before the start or past the end, so the X numbers stay between 0 and 1. Type more and the box answers "X1 must be between 0 and 1."

Steep means fast, flat means slow

Read the curve the way you'd read a hill on a walking map. Where it climbs steeply, a lot of distance goes by in a little time, so the element is moving fast. Where it runs flat, the clock keeps going and the element barely moves.

0.16, 10.3, 1endstart01Time01Position

cubic-bezier(0.16, 1, 0.3, 1)

Each dot is one tenth of the time. Carried across to the line on the right, the dots show where the element is at each tick: most of them sit in the last stretch before the end. How we worked it out

With 0.16, 1, 0.3, 1, the first handle sits right up against the top-left of the graph, and the line shoots up after it. After a tenth of the time the element has covered 49% of the way. After a fifth it has covered 75%. By half time it's at 97%, and the whole second half of the animation moves it the last 3%.

A longer duration doesn't change those shares, only the seconds behind them.

When Y goes above 1

The Y numbers are distance, not time, and distance is allowed to overshoot. The box takes anything from -3 to 3 for Y1 and Y2. Change Y2 in the example to 1.5, and partway through the move the element travels about 20% past where it should stop, then drifts back to its place. A springy finish is made this way, with no extra keyframes.

A Y below 0 does the same at the other end: the element backs up a little before it sets off.

Putting the example's numbers into the box

Above is the Easing mode of FluffyBench CSS Generator. Its curve starts out as 0.25, 0.1, 0.25, 1, the one CSS calls ease. Three of its numbers need changing.

  1. Change X1 to 0.16.

  2. Change Y1 to 1.

  3. Change X2 to 0.3.

  4. Leave Y2 at 1, the value it already has.

  5. Press Replay, above the curve: the dot leaps away, then creeps in.

  6. Take the line with Copy CSS once the pace looks right.

The line you copy is animation-timing-function: cubic-bezier(0.16, 1, 0.3, 1);

The tool names it for an animation. On a transition, the same cubic-bezier(0.16, 1, 0.3, 1) goes after transition-timing-function instead, or anywhere inside a transition shorthand.

When the timing isn't the part you need

What moves is a card's shadow, deepening when someone points at it

CSS Box Shadow Generator

Make the resting shadow and the deeper one there. This curve then sets the pace of the change between them.

Search FluffyBench