Options
All
  • Public
  • Public/Protected
  • All
Menu

Excalibur Matrix helper for 4x4 matrices

Useful for webgl 4x4 matrices

Hierarchy

  • Matrix

Index

Constructors

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

  • 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

    Returns Matrix

  • getBasisDeterminant(): number
  • getRotation(): number
  • getScaleX(): number
  • getScaleY(): number
  • isIdentity(): boolean
  • Resets the current matrix to the identity matrix, mutating it

    Returns Matrix

    Current matrix as identity

  • Applies rotation to the current matrix mutating it

    Parameters

    • angle: number

      in Radians

    Returns Matrix

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

    Parameters

    • x: number
    • y: number

    Returns Matrix

  • setPosition(x: number, y: number): void
  • setRotation(angle: number): void
  • setScaleX(val: number): void
  • setScaleY(val: number): 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

    Parameters

    • x: number
    • y: number

    Returns Matrix

  • ortho(left: number, right: number, bottom: number, top: number, near: number, far: number): Matrix
  • rotation(angleRadians: number): Matrix
  • Creates a brand new rotation matrix with the specified angle

    Parameters

    • angleRadians: number

    Returns Matrix

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

    Parameters

    • sx: number
    • sy: number

    Returns Matrix

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

    Parameters

    • x: number
    • y: number

    Returns Matrix