Module gamejs/math/matrix

Matrix manipulation, used by GameJs itself. You probably do not need this unless you manipulate a Context's transformation matrix yourself.

Functions


add (matrix, matrix)

Parameters

Array matrix
Array matrix

Returns

Array matrix sum

identity ()

Returns

Array [1, 0, 0, 1, 0, 0]

multiply (matrix, matrix)

Parameters

Array matrix A
Array matrix B

Returns

Array matrix product

rotate (matrix, angle)

Parameters

Array matrix
Number angle in radians

Returns

Array rotated matrix

rotation (matrix)

Parameters

Array matrix

Returns

Number rotation in radians

scale (matrix, vector)

Parameters

Array matrix
Array vector [a, b]

Returns

Array scaled matrix

translate (matrix, dx, dy)

Parameters

Array matrix
Number dx
Number dy

Returns

Array translated matrix