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()
staticback(end): (progress) =>number
Defined in: src/sdk/utils/controllers/Easing.ts:236
Creates a back easing function.
Parameters
| Parameter | Type | Description |
|---|---|---|
end | "in" | "out" | "both" | The end to which to apply easing. |
Returns
A back easing function.
(
progress):number
Parameters
| Parameter | Type |
|---|---|
progress | number |
Returns
number
Throws
Error if end is not one of 'in' | 'out' | 'both'.
bezier()
staticbezier(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
| Parameter | Type | Default value | Description |
|---|---|---|---|
c1x | number | undefined | The x-coordinate of the first control point. Will be clamped to the range [0, 1]. |
c1y | number | undefined | The y-coordinate of the first control point. |
c2x | number | undefined | The x-coordinate of the second control point. Will be clamped to the range [0, 1]. |
c2y | number | undefined | The y-coordinate of the second control point. |
precompute | boolean | false | Whether to precompute a lookup table. Defaults to false. |
minXResolution? | number | undefined | The 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? | number | 1e-3 | The threshold of acceptable linear interpolation error used during precomputation. Ignored if precompute is false. Defaults to 1e-4. |
maxDepth? | number | 10 | The 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
| Parameter | Type |
|---|---|
progress | number |
Returns
number
circ()
staticcirc(end): (progress) =>number
Defined in: src/sdk/utils/controllers/Easing.ts:198
Creates a circular easing function.
Parameters
| Parameter | Type | Description |
|---|---|---|
end | "in" | "out" | "both" | The end to which to apply easing. |
Returns
A circular easing function.
(
progress):number
Parameters
| Parameter | Type |
|---|---|
progress | number |
Returns
number
Throws
Error if end is not one of 'in' | 'out' | 'both'.
cubic()
staticcubic(end): (progress) =>number
Defined in: src/sdk/utils/controllers/Easing.ts:42
Creates a cubic easing function.
Parameters
| Parameter | Type | Description |
|---|---|---|
end | "in" | "out" | "both" | The end to which to apply easing. |
Returns
A cubic easing function.
(
progress):number
Parameters
| Parameter | Type |
|---|---|
progress | number |
Returns
number
Throws
Error if end is not one of 'in' | 'out' | 'both'.
elastic()
staticelastic(end): (progress) =>number
Defined in: src/sdk/utils/controllers/Easing.ts:282
Creates an elastic easing function.
Parameters
| Parameter | Type | Description |
|---|---|---|
end | "in" | "out" | "both" | The end to which to apply easing. |
Returns
An elastic easing function.
(
progress):number
Parameters
| Parameter | Type |
|---|---|
progress | number |
Returns
number
Throws
Error if end is not one of 'in' | 'out' | 'both'.
exp()
staticexp(end): (progress) =>number
Defined in: src/sdk/utils/controllers/Easing.ts:217
Creates an exponential easing function.
Parameters
| Parameter | Type | Description |
|---|---|---|
end | "in" | "out" | "both" | The end to which to apply easing. |
Returns
An exponential easing function.
(
progress):number
Parameters
| Parameter | Type |
|---|---|
progress | number |
Returns
number
Throws
Error if end is not one of 'in' | 'out' | 'both'.
linear()
staticlinear(): (progress) =>number
Defined in: src/sdk/utils/controllers/Easing.ts:13
Creates a linear easing function.
Returns
A linear easing function.
(
progress):number
Parameters
| Parameter | Type |
|---|---|
progress | number |
Returns
number
polynomial()
staticpolynomial(order,end): (progress) =>number
Defined in: src/sdk/utils/controllers/Easing.ts:160
Creates a polynomial easing function.
Parameters
| Parameter | Type | Description |
|---|---|---|
order | number | The order of the polynomial. |
end | "in" | "out" | "both" | The end to which to apply easing. |
Returns
A polynomial easing function.
(
progress):number
Parameters
| Parameter | Type |
|---|---|
progress | number |
Returns
number
Throws
Error if end is not one of 'in' | 'out' | 'both'.
quad()
staticquad(end): (progress) =>number
Defined in: src/sdk/utils/controllers/Easing.ts:23
Creates a quadratic easing function.
Parameters
| Parameter | Type | Description |
|---|---|---|
end | "in" | "out" | "both" | The end to which to apply easing. |
Returns
A quadratic easing function.
(
progress):number
Parameters
| Parameter | Type |
|---|---|
progress | number |
Returns
number
Throws
Error if end is not one of 'in' | 'out' | 'both'.
quart()
staticquart(end): (progress) =>number
Defined in: src/sdk/utils/controllers/Easing.ts:81
Creates a quartic easing function.
Parameters
| Parameter | Type | Description |
|---|---|---|
end | "in" | "out" | "both" | The end to which to apply easing. |
Returns
A quartic easing function.
(
progress):number
Parameters
| Parameter | Type |
|---|---|
progress | number |
Returns
number
Throws
Error if end is not one of 'in' | 'out' | 'both'.
quint()
staticquint(end): (progress) =>number
Defined in: src/sdk/utils/controllers/Easing.ts:120
Creates a quintic easing function.
Parameters
| Parameter | Type | Description |
|---|---|---|
end | "in" | "out" | "both" | The end to which to apply easing. |
Returns
A quintic easing function.
(
progress):number
Parameters
| Parameter | Type |
|---|---|
progress | number |
Returns
number
Throws
Error if end is not one of 'in' | 'out' | 'both'.
sin()
staticsin(end): (progress) =>number
Defined in: src/sdk/utils/controllers/Easing.ts:179
Creates a sinusoid easing function.
Parameters
| Parameter | Type | Description |
|---|---|---|
end | "in" | "out" | "both" | The end to which to apply easing. |
Returns
A sinusoid easing function.
(
progress):number
Parameters
| Parameter | Type |
|---|---|
progress | number |
Returns
number
Throws
Error if end is not one of 'in' | 'out' | 'both'.
withEndpointParams()
staticwithEndpointParams(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
| Parameter | Type | Description |
|---|---|---|
ease | (progress) => number | An 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
| Parameter | Type |
|---|---|
start | number |
stop | number |
progress | number |
Returns
number
withEndpoints()
staticwithEndpoints(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
| Parameter | Type | Description |
|---|---|---|
ease | (progress) => number | An easing function. |
start | number | The start endpoint. |
stop | number | The 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
| Parameter | Type |
|---|---|
progress | number |
Returns
number