Various 2d math functions.
Methods
(static) make2DProjection(width, height) → {module:webgl-2d-math.Matrix3}
Creates a 2D projection matrix
Parameters:
Name | Type | Description |
---|---|---|
width |
number
|
width in pixels |
height |
number
|
height in pixels |
Returns:
a projection matrix that converts from pixels to clipspace with Y = 0 at the top.
(static) makeRotation(angleInRadians) → {module:webgl-2d-math.Matrix3}
Creates a 2D rotation matrix
Parameters:
Name | Type | Description |
---|---|---|
angleInRadians |
number
|
amount to rotate in radians |
(static) makeScale(sx, sy) → {module:webgl-2d-math.Matrix3}
Creates a 2D scaling matrix
Parameters:
Name | Type | Description |
---|---|---|
sx |
number
|
amount to scale in x |
sy |
number
|
amount to scale in y |
(static) makeTranslation(tx, ty) → {module:webgl-2d-math.Matrix3}
Creates a 2D translation matrix
Parameters:
Name | Type | Description |
---|---|---|
tx |
number
|
amount to translate in x |
ty |
number
|
amount to translate in y |
(static) matrixMultiply(a, b) → {module:webgl-2d-math.Matrix3}
Takes twoMatrix3s, a and b, and computes the product in the order
that pre-composes b with a. In other words, the matrix returned will
Parameters:
Name | Type | Description |
---|---|---|
a |
module:webgl-2d-math.Matrix3
|
A matrix. |
b |
module:webgl-2d-math.Matrix3
|
A matrix. |
Type Definitions
Matrix3
An array or typed array with 9 values.
Type:
-
Array.<number>
|TypedArray