Matrix
Index
Constructors
constructor
Returns Matrix
Properties
publicdata
4x4 matrix in column major order
data[0] | data[4] | data[8] | data[12] |
data[1] | data[5] | data[9] | data[13] |
data[2] | data[6] | data[10] | data[14] |
data[3] | data[7] | data[11] | data[15] |
Methods
publicclone
publicgetAffineInverse
publicgetBasisDeterminant
Determinant of the upper left 2x2 matrix
Returns number
publicgetPosition
Returns Vector
publicgetRotation
Returns number
publicgetScale
Get the scale of the matrix
Returns Vector
publicgetScaleX
Returns number
publicgetScaleY
Returns number
publicisIdentity
Returns boolean
multiply
publicreset
Resets the current matrix to the identity matrix, mutating it
Returns Matrix
Current matrix as identity
rotate
Applies rotation to the current matrix mutating it
Parameters
angle: number
in Radians
Returns Matrix
scale
Applies scaling to the current matrix mutating it
Parameters
x: number
y: number
Returns Matrix
publicsetPosition
Parameters
x: number
y: number
Returns void
publicsetRotation
Parameters
angle: number
Returns void
publicsetScale
Parameters
scale: Vector
Returns void
publicsetScaleX
Parameters
val: number
Returns void
publicsetScaleY
Parameters
val: number
Returns void
publictoDOMMatrix
Converts the current matrix into a DOMMatrix
This is useful when working with the browser Canvas context
Returns DOMMatrix
DOMMatrix
publictoString
Returns string
translate
Applies translation to the current matrix mutating it
Parameters
x: number
y: number
Returns Matrix
publicstaticfromFloat32Array
Parameters
data: Float32Array
Returns Matrix
publicstaticidentity
Creates a new identity matrix (a matrix that when applied does nothing)
Returns Matrix
publicstaticortho
Creates an orthographic (flat non-perspective) projection https://en.wikipedia.org/wiki/Orthographic_projection
Parameters
left: number
right: number
bottom: number
top: number
near: number
far: number
Returns Matrix
publicstaticrotation
Creates a brand new rotation matrix with the specified angle
Parameters
angleRadians: number
Returns Matrix
publicstaticscale
Creates a brand new scaling matrix with the specified scaling factor
Parameters
sx: number
sy: number
Returns Matrix
publicstatictranslation
Creates a brand new translation matrix at the specified 3d point
Parameters
x: number
y: number
Returns Matrix
Excalibur Matrix helper for 4x4 matrices
Useful for webgl 4x4 matrices