Skip to main content

Class: Easing

Defined in: src/sdk/utils/controllers/Easing.ts:7

A utility class for creating easing functions. All generated easing functions are based on their CSS counterparts.

Constructors​

Constructor​

new Easing(): Easing

Returns​

Easing

Methods​

back()​

static back(end): (progress) => number

Defined in: src/sdk/utils/controllers/Easing.ts:236

Creates a back easing function.

Parameters​

ParameterTypeDescription
end"in" | "out" | "both"The end to which to apply easing.

Returns​

A back easing function.

(progress): number

Parameters​
ParameterType
progressnumber
Returns​

number

Throws​

Error if end is not one of 'in' | 'out' | 'both'.


bezier()​

static bezier(c1x, c1y, c2x, c2y, precompute, minXResolution?, epsilon?, maxDepth?): (progress) => number

Defined in: src/sdk/utils/controllers/Easing.ts:330

Creates a cubic bezier easing function. The function follows a cubic bezier curve with the endpoints fixed at (0, 0) and (1, 1).

The function can optionally use a precomputed lookup table. Using a lookup table may increase performance and/or precision of the created function at the cost of some precomputation time and memory needed to store the lookup table.

Parameters​

ParameterTypeDefault valueDescription
c1xnumberundefinedThe x-coordinate of the first control point. Will be clamped to the range [0, 1].
c1ynumberundefinedThe y-coordinate of the first control point.
c2xnumberundefinedThe x-coordinate of the second control point. Will be clamped to the range [0, 1].
c2ynumberundefinedThe y-coordinate of the second control point.
precomputebooleanfalseWhether to precompute a lookup table. Defaults to false.
minXResolution?numberundefinedThe minimum resolution of the function along the x-axis. Defaults to 0.1 if precompute is true, or 1e-4 if precompute is false.
epsilon?number1e-3The threshold of acceptable linear interpolation error used during precomputation. Ignored if precompute is false. Defaults to 1e-4.
maxDepth?number10The maximum allowed recursive depth of precomputation. The number of additional lookup table breakpoints generated is bounded from above by 2 ^ (maxDepth) - 1. Ignored if precompute is false. Defaults to 10.

Returns​

A cubic bezier easing function.

(progress): number

Parameters​
ParameterType
progressnumber
Returns​

number


circ()​

static circ(end): (progress) => number

Defined in: src/sdk/utils/controllers/Easing.ts:198

Creates a circular easing function.

Parameters​

ParameterTypeDescription
end"in" | "out" | "both"The end to which to apply easing.

Returns​

A circular easing function.

(progress): number

Parameters​
ParameterType
progressnumber
Returns​

number

Throws​

Error if end is not one of 'in' | 'out' | 'both'.


cubic()​

static cubic(end): (progress) => number

Defined in: src/sdk/utils/controllers/Easing.ts:42

Creates a cubic easing function.

Parameters​

ParameterTypeDescription
end"in" | "out" | "both"The end to which to apply easing.

Returns​

A cubic easing function.

(progress): number

Parameters​
ParameterType
progressnumber
Returns​

number

Throws​

Error if end is not one of 'in' | 'out' | 'both'.


elastic()​

static elastic(end): (progress) => number

Defined in: src/sdk/utils/controllers/Easing.ts:282

Creates an elastic easing function.

Parameters​

ParameterTypeDescription
end"in" | "out" | "both"The end to which to apply easing.

Returns​

An elastic easing function.

(progress): number

Parameters​
ParameterType
progressnumber
Returns​

number

Throws​

Error if end is not one of 'in' | 'out' | 'both'.


exp()​

static exp(end): (progress) => number

Defined in: src/sdk/utils/controllers/Easing.ts:217

Creates an exponential easing function.

Parameters​

ParameterTypeDescription
end"in" | "out" | "both"The end to which to apply easing.

Returns​

An exponential easing function.

(progress): number

Parameters​
ParameterType
progressnumber
Returns​

number

Throws​

Error if end is not one of 'in' | 'out' | 'both'.


linear()​

static linear(): (progress) => number

Defined in: src/sdk/utils/controllers/Easing.ts:13

Creates a linear easing function.

Returns​

A linear easing function.

(progress): number

Parameters​
ParameterType
progressnumber
Returns​

number


polynomial()​

static polynomial(order, end): (progress) => number

Defined in: src/sdk/utils/controllers/Easing.ts:160

Creates a polynomial easing function.

Parameters​

ParameterTypeDescription
ordernumberThe order of the polynomial.
end"in" | "out" | "both"The end to which to apply easing.

Returns​

A polynomial easing function.

(progress): number

Parameters​
ParameterType
progressnumber
Returns​

number

Throws​

Error if end is not one of 'in' | 'out' | 'both'.


quad()​

static quad(end): (progress) => number

Defined in: src/sdk/utils/controllers/Easing.ts:23

Creates a quadratic easing function.

Parameters​

ParameterTypeDescription
end"in" | "out" | "both"The end to which to apply easing.

Returns​

A quadratic easing function.

(progress): number

Parameters​
ParameterType
progressnumber
Returns​

number

Throws​

Error if end is not one of 'in' | 'out' | 'both'.


quart()​

static quart(end): (progress) => number

Defined in: src/sdk/utils/controllers/Easing.ts:81

Creates a quartic easing function.

Parameters​

ParameterTypeDescription
end"in" | "out" | "both"The end to which to apply easing.

Returns​

A quartic easing function.

(progress): number

Parameters​
ParameterType
progressnumber
Returns​

number

Throws​

Error if end is not one of 'in' | 'out' | 'both'.


quint()​

static quint(end): (progress) => number

Defined in: src/sdk/utils/controllers/Easing.ts:120

Creates a quintic easing function.

Parameters​

ParameterTypeDescription
end"in" | "out" | "both"The end to which to apply easing.

Returns​

A quintic easing function.

(progress): number

Parameters​
ParameterType
progressnumber
Returns​

number

Throws​

Error if end is not one of 'in' | 'out' | 'both'.


sin()​

static sin(end): (progress) => number

Defined in: src/sdk/utils/controllers/Easing.ts:179

Creates a sinusoid easing function.

Parameters​

ParameterTypeDescription
end"in" | "out" | "both"The end to which to apply easing.

Returns​

A sinusoid easing function.

(progress): number

Parameters​
ParameterType
progressnumber
Returns​

number

Throws​

Error if end is not one of 'in' | 'out' | 'both'.


withEndpointParams()​

static withEndpointParams(ease): (start, stop, progress) => number

Defined in: src/sdk/utils/controllers/Easing.ts:465

Converts an easing function to one which supports arbitrary start and stop endpoints.

Parameters​

ParameterTypeDescription
ease(progress) => numberAn easing function.

Returns​

A new easing function which generates the same shape as the specified function while supporting arbitrary start and stop endpoints.

(start, stop, progress): number

Parameters​
ParameterType
startnumber
stopnumber
progressnumber
Returns​

number


withEndpoints()​

static withEndpoints(ease, start, stop): (progress) => number

Defined in: src/sdk/utils/controllers/Easing.ts:479

Converts an easing function to one which uses specific start and stop endpoints.

Parameters​

ParameterTypeDescription
ease(progress) => numberAn easing function.
startnumberThe start endpoint.
stopnumberThe stop endpoint.

Returns​

A new easing function which generates the same shape as the specified function while using the specified start and stop endpoints.

(progress): number

Parameters​
ParameterType
progressnumber
Returns​

number