AffineMatrix
Index
Constructors
constructor
Returns AffineMatrix
Properties
publicdata
data[0] | data[2] | data[4] |
data[1] | data[3] | data[5] |
0 | 0 | 1 |
Methods
publicclone
Creates a new Matrix with the same data as the current AffineMatrix
Parameters
optionaldest: AffineMatrix
Returns AffineMatrix
publicdeterminant
Returns number
publicgetPosition
Returns Vector
publicgetRotation
Returns number
publicgetScale
Get the scale of the matrix
Returns Vector
publicgetScaleX
Returns number
publicgetScaleY
Returns number
publicinverse
Return the affine inverse, optionally store it in a target matrix.
It's recommended you call .reset() the target unless you know what you're doing
Parameters
optionaltarget: AffineMatrix
Returns AffineMatrix
publicisIdentity
Returns boolean
multiply
multiplyQuadInPlace
Packed array of length 8, that contains 4 vertices, with 2 components each So: [x0, y0, x1, y1, x2, y2, x3, y3]
Parameters
quad: number[]
Returns void
publicreset
Resets the current matrix to the identity matrix, mutating it
Returns AffineMatrix
Current matrix as identity
rotate
Applies rotation to the current matrix mutating it
Parameters
angle: number
in Radians
Returns AffineMatrix
scale
Applies scaling to the current matrix mutating it
Parameters
x: number
y: number
Returns AffineMatrix
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
to4x4
Returns Matrix
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 AffineMatrix
publicstaticidentity
Returns AffineMatrix
publicstaticrotation
Creates a brand new rotation matrix with the specified angle
Parameters
angleRadians: number
Returns AffineMatrix
publicstaticscale
Creates a brand new scaling matrix with the specified scaling factor
Parameters
sx: number
sy: number
Returns AffineMatrix
publicstatictranslation
Creates a brand new translation matrix at the specified 3d point
Parameters
x: number
y: number
Returns AffineMatrix