Class: Easing

PD. Easing


new Easing()

A static helper class with a range of easing functions.

Each easing function takes a single parameter, t, which represents the progress of the animation from 0 (start) to 1 (end), and returns a modified progress value also in the range 0 to 1.

These were inspired by http://gizma.com/easing/, but only considering the 't' value for the range [0..1] => [0..1], as per: https://gist.github.com/gre/1650294.

See https://easings.net/ for a visual representation of these easing functions.

Author:
  • drajmarsh

Methods


inBack(t) <static>

Function with a bit of over-run at start.

Parameters:
Name Type Description
t number

The progress value (0-1).

Returns:

Returns the modified progress (0-1).

Type
number

inBounce(t) <static>

Function with a bit of a bounce at start.

Parameters:
Name Type Description
t number

The progress value (0-1).

Returns:

Returns the modified progress (0-1).

Type
number

inCirc(t) <static>

Circular function accelerating from zero to one.

Parameters:
Name Type Description
t number

The progress value (0-1).

Returns:

Returns the modified progress (0-1).

Type
number

inCubic(t) <static>

Cubic function (t^3) accelerating from zero to one.

Parameters:
Name Type Description
t number

The progress value (0-1).

Returns:

Returns the modified progress (0-1).

Type
number

inExpo(t) <static>

Exponential function (2^t) accelerating from zero to one.

Parameters:
Name Type Description
t number

The progress value (0-1).

Returns:

Returns the modified progress (0-1).

Type
number

inOutBack(t) <static>

Function with a bit of over-run at both start and end.

Parameters:
Name Type Description
t number

The progress value (0-1).

Returns:

Returns the modified progress (0-1).

Type
number

inOutBounce(t) <static>

Function with a bit of a bounce at start and end.

Parameters:
Name Type Description
t number

The progress value (0-1).

Returns:

Returns the modified progress (0-1).

Type
number

inOutCirc(t) <static>

Circular function accelerating until halfway, then decelerating.

Parameters:
Name Type Description
t number

The progress value (0-1).

Returns:

Returns the modified progress (0-1).

Type
number

inOutCubic(t) <static>

Cubic function (t^3) accelerating until halfway, then decelerating.

Parameters:
Name Type Description
t number

The progress value (0-1).

Returns:

Returns the modified progress (0-1).

Type
number

inOutExpo(t) <static>

Exponential function (2^t) accelerating until halfway, then decelerating.

Parameters:
Name Type Description
t number

The progress value (0-1).

Returns:

Returns the modified progress (0-1).

Type
number

inOutQuad(t) <static>

Quadratic function (t^2) accelerating until halfway, then decelerating.

Parameters:
Name Type Description
t number

The progress value (0-1).

Returns:

Returns the modified progress (0-1).

Type
number

inOutQuart(t) <static>

Quartic function (t^4) accelerating until halfway, then decelerating.

Parameters:
Name Type Description
t number

The progress value (0-1).

Returns:

Returns the modified progress (0-1).

Type
number

inOutQuint(t) <static>

Quintic function (t^5) accelerating until halfway, then decelerating.

Parameters:
Name Type Description
t number

The progress value (0-1).

Returns:

Returns the modified progress (0-1).

Type
number

inOutSine(t) <static>

Sine function accelerating to one halfway, then decelerating back to zero.

Parameters:
Name Type Description
t number

The progress value (0-1).

Returns:

Returns the modified progress (0-1).

Type
number

inOutSinePow(t, p) <static>

Sine function accelerating until halfway, then decelerating with a power function (Math.pow) applied.

Parameters:
Name Type Description
t number

The progress value (0-1).

p number

An optional power value apply to the result, defaults to 2.0.

Returns:

Returns the modified progress (0-1).

Type
number

inOutWobble(t) <static>

Function with a bit of an elastic jelly wobble at the end.

Parameters:
Name Type Description
t number

The progress value (0-1).

Returns:

Returns the modified progress (0-1).

Type
number

inQuad(t) <static>

Quadratic function (t^2) accelerating from zero to one.

Parameters:
Name Type Description
t number

The progress value (0-1).

Returns:

Returns the modified progress (0-1).

Type
number

inQuart(t) <static>

Quartic function (t^4) accelerating from zero to one.

Parameters:
Name Type Description
t number

The progress value (0-1).

Returns:

Returns the modified progress (0-1).

Type
number

inQuint(t) <static>

Quintic function (t^5) accelerating from zero to one.

Parameters:
Name Type Description
t number

The progress value (0-1).

Returns:

Returns the modified progress (0-1).

Type
number

inSine(t) <static>

Sine function accelerating from zero to one.

Parameters:
Name Type Description
t number

The progress value (0-1).

Returns:

Returns the modified progress (0-1).

Type
number

inWobble(t) <static>

Function with a bit of an elastic jelly wobble at the start.

Parameters:
Name Type Description
t number

The progress value (0-1).

Returns:

Returns the modified progress (0-1).

Type
number

linear(t) <static>

No easing or acceleration.

Parameters:
Name Type Description
t number

The progress value (0-1).

Returns:

Returns the modified progress (0-1).

Type
number

outBack(t) <static>

Function with a bit of over-run at end.

Parameters:
Name Type Description
t number

The progress value (0-1).

Returns:

Returns the modified progress (0-1).

Type
number

outBounce(t) <static>

Function with a bit of a bounce at end.

Parameters:
Name Type Description
t number

The progress value (0-1).

Returns:

Returns the modified progress (0-1).

Type
number

outCirc(t) <static>

Circular function decelerating from one to zero.

Parameters:
Name Type Description
t number

The progress value (0-1).

Returns:

Returns the modified progress (0-1).

Type
number

outCubic(t) <static>

Cubic function (t^3) decelerating from one to zero.

Parameters:
Name Type Description
t number

The progress value (0-1).

Returns:

Returns the modified progress (0-1).

Type
number

outElastic(t, p) <static>

Function with a bit of an elastic bounce at the end.

Parameters:
Name Type Description
t number

The progress value (0-1).

p number

An optional power value apply to the result, defaults to 0.35.

Returns:

Returns the modified progress (0-1).

Type
number

outExpo(t) <static>

Exponential function (2^t) decelerating from one to zero.

Parameters:
Name Type Description
t number

The progress value (0-1).

Returns:

Returns the modified progress (0-1).

Type
number

outQuad(t) <static>

Quadratic function (t^2) decelerating from one to zero.

Parameters:
Name Type Description
t number

The progress value (0-1).

Returns:

Returns the modified progress (0-1).

Type
number

outQuart(t) <static>

Quartic function (t^4) decelerating from one to zero.

Parameters:
Name Type Description
t number

The progress value (0-1).

Returns:

Returns the modified progress (0-1).

Type
number

outQuint(t) <static>

Quintic function (t^5) decelerating from one to zero.

Parameters:
Name Type Description
t number

The progress value (0-1).

Returns:

Returns the modified progress (0-1).

Type
number

outSine(t) <static>

Sine function decelerating from one to zero.

Parameters:
Name Type Description
t number

The progress value (0-1).

Returns:

Returns the modified progress (0-1).

Type
number

outWobble(t) <static>

Function with a bit of an elastic jelly wobble at the end.

Parameters:
Name Type Description
t number

The progress value (0-1).

Returns:

Returns the modified progress (0-1).

Type
number