Options
All
• Public
• Public/Protected
• All

# Class Matrix

Excalibur Matrix helper for 4x4 matrices

Useful for webgl 4x4 matrices

• Matrix

## Properties

data: Float32Array = ...

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

• Creates a new Matrix with the same data as the current 4x4

#### Returns Matrix

• 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

#### Returns Matrix

• getBasisDeterminant(): number
• Determinant of the upper left 2x2 matrix

#### Returns number

• getRotation(): number
• Get the scale of the matrix

#### Returns Vector

• getScaleX(): number
• getScaleY(): number
• isIdentity(): boolean
• Multiply the current matrix by a vector producing a new vector

#### Returns Vector

• Multiply the current matrix by another matrix producing a new matrix

#### Returns Matrix

• Resets the current matrix to the identity matrix, mutating it

#### Returns Matrix

Current matrix as identity

• Applies rotation to the current matrix mutating it

#### Returns Matrix

• scale(x: number, y: number): Matrix
• Applies scaling to the current matrix mutating it

#### Returns Matrix

• setPosition(x: number, y: number): void

#### Returns void

• setRotation(angle: number): void

#### Returns void

• setScaleX(val: number): void

#### Returns void

• setScaleY(val: number): void

#### Returns void

• toDOMMatrix(): DOMMatrix
• Converts the current matrix into a DOMMatrix

This is useful when working with the browser Canvas context

#### Returns DOMMatrix

DOMMatrix

• toString(): string
• translate(x: number, y: number): Matrix
• Applies translation to the current matrix mutating it

#### Returns Matrix

• Creates a new identity matrix (a matrix that when applied does nothing)

#### Returns Matrix

• ortho(left: number, right: number, bottom: number, top: number, near: number, far: number): Matrix
• Creates an orthographic (flat non-perspective) projection https://en.wikipedia.org/wiki/Orthographic_projection

#### Returns Matrix

• Creates a brand new rotation matrix with the specified angle

#### Returns Matrix

• scale(sx: number, sy: number): Matrix
• Creates a brand new scaling matrix with the specified scaling factor

#### Returns Matrix

• translation(x: number, y: number): Matrix
• Creates a brand new translation matrix at the specified 3d point