Reference mat4()

mat4()

This API is experimental

Its behavior may change in a future version of p5.js.

Creates a 4x4 matrix inside a p5.strands shader callback.

mat4() is the same function as transform3D(), named the way it is in GLSL.

Passing a 3x3 matrix to mat4() extends it with the identity matrix, which turns a 2D transform into a 3D one that leaves the z-axis alone.

Note: mat4() can only be used inside a p5.strands shader callback.

Examples

Syntax

mat4(values1, values2, ..., valuesn)

Parameters

values1, ..., valuesn
Number: nothing for the identity matrix, one number, one matrix, 4 column vectors, or 16 values in column-major order.

Returns

a 4x4 matrix.

Related References