Skip to content
party.js logoparty.js logo

ReferenceBehaviorsType

Easing

Reshapes progress to make transitions start or end softly.

type Easing = (t: number) => number;

A function that reshapes progress from 0 to 1, used by behaviors like fade() and scale() to make a transition start or end softly.

It receives a progress t from 0 to 1 and returns the eased value. It is expected to return 0 at t = 0 and 1 at t = 1. In between, its shape determines how fast the transition moves.

tnumber

The received progress from 0 to 1.

number

The reshaped progress.

// A custom ease that starts even more slowly than sineIn.
const cubicIn: Easing = (t) => t ** 3;
fade(0.2, 0.5, cubicIn);