Skip to main content

Function: cubicBezier()

cubicBezier(x1, y1, x2, y2): RateFunction

Defined in: src/rate-functions/customEase.ts:84

Create a CSS cubic-bezier easing.

Control points are P0 = (0, 0), P1 = (x1, y1), P2 = (x2, y2), P3 = (1, 1). x1 and x2 are clamped to [0, 1] so the x axis stays monotonic, as CSS requires. y1 and y2 are free, so the curve may overshoot.

Parameters​

x1​

number

y1​

number

x2​

number

y2​

number

Returns​

RateFunction

Example​

const ease = cubicBezier(0.25, 0.1, 0.25, 1);
ease(0); // 0
ease(1); // 1