Applies a transformation matrix to the coordinate system.

Transformations such as translate(), rotate(), and scale() use matrix-vector multiplication behind the scenes. A table of numbers, called a matrix, encodes each transformation. The values in the matrix then multiply each point on the canvas, which is represented by a vector.

`applyMatrix()`

allows for many transformations to be applied at once. See Wikipedia and MDN for more details about transformations.

There are two ways to call `applyMatrix()`

in two and three dimensions.

In 2D mode, the parameters `a`

, `b`

, `c`

, `d`

, `e`

, and `f`

, correspond to elements in the following transformation matrix:

The numbers can be passed individually, as in `applyMatrix(2, 0, 0, 0, 2, 0)`

. They can also be passed in an array, as in `applyMatrix([2, 0, 0, 0, 2, 0])`

.

In 3D mode, the parameters `a`

, `b`

, `c`

, `d`

, `e`

, `f`

, `g`

, `h`

, `i`

, `j`

, `k`

, `l`

, `m`

, `n`

, `o`

, and `p`

correspond to elements in the following transformation matrix:

The numbers can be passed individually, as in `applyMatrix(2, 0, 0, 0, 0, 2, 0, 0, 0, 0, 2, 0, 0, 0, 0, 1)`

. They can also be passed in an array, as in `applyMatrix([2, 0, 0, 0, 0, 2, 0, 0, 0, 0, 2, 0, 0, 0, 0, 1])`

.

By default, transformations accumulate. The push() and pop() functions can be used to isolate transformations within distinct drawing groups.

Note: Transformations are reset at the beginning of the draw loop. Calling `applyMatrix()`

inside the draw() function won't cause shapes to transform continuously.

## Examples

## Syntax

`applyMatrix(arr)`

`applyMatrix(a, b, c, d, e, f)`

`applyMatrix(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p)`

## Parameters

an array containing the elements of the transformation matrix. Its length should be either 6 (2D) or 16 (3D).

an element of the transformation matrix.

an element of the transformation matrix.

an element of the transformation matrix.

an element of the transformation matrix.

an element of the transformation matrix.

an element of the transformation matrix.

an element of the transformation matrix.

an element of the transformation matrix.

an element of the transformation matrix.

an element of the transformation matrix.

an element of the transformation matrix.

an element of the transformation matrix.

an element of the transformation matrix.

an element of the transformation matrix.

an element of the transformation matrix.

an element of the transformation matrix.