Methods

inverse_lerp(a, b, value) → {number}

Returns the progress value between two numbers given an interpolated value.

Parameters:
NameTypeDescription
anumber

The start value.

bnumber

The end value.

valuenumber

The value to find the progress of.

Returns:

The progress value.

Type: 
number

lerp(a, b, t) → {number}

Linearly interpolates between two values given a progress value.

Parameters:
NameTypeDescription
anumber

The start value.

bnumber

The end value.

tnumber

The progress value.

Returns:

The interpolated value.

Type: 
number

matrix_product(a, b, a_rows, a_columns, b_columns) → {Array.<number>}

Multiplies two matrices together.

Parameters:
NameTypeDescription
aArray.<number>

The first matrix to multiply as a flat array.

bArray.<number>

The second matrix to multiply as a flat array.

a_rowsnumber

The number of rows in the first matrix.

a_columnsnumber

The number of columns in the first matrix.

b_columnsnumber

The number of columns in the second matrix.

Returns:

The product of the two matrices.

Type: 
Array.<number>

matrix_product_path(matrix, path, a_rows, a_columns, b_columns) → {Path2D}

Multiplies a matrix by a path of 2D points, returning a new path.

Parameters:
NameTypeDescription
matrixArray.<number>

The matrix to multiply as a flat array.

pathPath2D

The path to multiply.

a_rowsnumber

The number of rows in the first matrix.

a_columnsnumber

The number of columns in the first matrix.

b_columnsnumber

The number of columns in the second matrix.

Returns:

The product of the matrix and the path.

Type: 
Path2D

(async) play(animations, duration, easing) → {Promise.<void>}

Plays an animation.

Parameters:
NameTypeDescription
animationsMap.<(string|number), Animation>

The animations to play.

durationnumber

The duration of the animation in milliseconds.

easingEasing

The easing function to use.

Returns:
  • A promise that resolves when the animation has finished.
Type: 
Promise.<void>

(async) render() → {Promise.<void>}

Renders the scene to the canvas. Preferably don't await to keep the animation smooth.

Returns:
  • A promise that resolves when the scene has been rendered.
Type: 
Promise.<void>

(async) render() → {Promise.<void>}

Renders the scene to the SVG. Preferably don't await to keep the animation smooth.

Returns:
  • A promise that resolves when the scene has been rendered.
Type: 
Promise.<void>

resume() → {void}

Resumes the scene.

Returns:
Type: 
void

stop() → {void}

Stops the scene.

Returns:
Type: 
void