Easing Function

The easing function data type denotes a mathematical function that describes the rate at which a numerical value changes.

Types of Easing Functions

Linear

linear

The interpolation is done at a constant rate from beginning to end.

Equivalent to cubic-bezier(0.0, 0.0, 1.0, 1.0).


Cubic Bézier Curves

cubic-bezier(x1, y1, x2, y2)

Defines a cubic Bézier curve defined by:

  • P0(0,0)P_0(0, 0) — the starting position
  • P1(x1,y1)P_1(x_1, y_1)
  • P2(x2,y2)P_2(x_2, y_2)
  • P3(1,1)P_3(1, 1) — the final position

ease

Starts slowly, accelerates sharply, and then slows down towards the end. (Equivalent to cubic-bezier(0.25, 0.1, 0.25, 1.0).)

ease-in

Starts slowly, and accelerates towards the end. (Equivalent to cubic-bezier(0.42, 0.0, 1.0, 1.0).)

ease-in-out

Starts slowly, speeds up, and then slows down towards the end (Equivalent to cubic-bezier(0.42, 0.0, 0.58, 1.0).)

ease-out

Starts abruptly, and then slows down towards the end. (Equivalent to cubic-bezier(0.0, 0.0, 0.58, 1.0).)


Step Functions

steps(n, jump)

Defines a step function with n step(s) and which segment to jump:

  • jump-start or start skip the start segment
  • jump-end or end skip the final segment
  • jump-none include the start and final segments
  • jump-both skip both the start and final segments
Illustration of different jump values
Illustration of different jump values (Source: MDN)

step-start

Skip the start segment (jumps directly to its final position).

step-end

Skip the final segment (stays at its initial position).

Assets

References