#

API Docs for: 2.0.0
Show: Inherited Protected Private Deprecated

# Matrix Class

Defined in: `src/pixi/geom/Matrix.js:5`
Module: PIXI

The Matrix class is now an object, which makes it a lot faster, here is a representation of it : | a | b | tx| | c | d | ty| | 0 | 0 | 1 |

## Constructor

### `Matrix`

()

Defined in `src/pixi/geom/Matrix.js:5`

- Index
- Methods
- Properties

## Item Index

### Methods

- append
- apply
- applyInverse
- fromArray
- identity
- rotate
- scale
- toArray
- translate

### Properties

- a
- b
- c
- d
- tx
- ty

## Methods

### `append`

(

- `matrix`

)
Matrix

Defined in `src/pixi/geom/Matrix.js:225`

Appends the given Matrix to this Matrix.

#### Parameters:

- `matrix` Matrix

#### Returns:

Matrix:

This matrix. Good for chaining method calls.

### `apply`

(

- `pos`
- `[newPos]`

)
Point

Defined in `src/pixi/geom/Matrix.js:123`

Get a new position with the current transformation applied. Can be used to go from a child's coordinate space to the world coordinate space. (e.g. rendering)

#### Parameters:

- `pos` Point

  The origin

- `[newPos]` Point optional

  The point that the new position is assigned to (allowed to be same as input)

#### Returns:

Point:

The new point, transformed through this matrix

### `applyInverse`

(

- `pos`
- `[newPos]`

)
Point

Defined in `src/pixi/geom/Matrix.js:142`

Get a new position with the inverse of the current transformation applied. Can be used to go from the world coordinate space to a child's coordinate space. (e.g. input)

#### Parameters:

- `pos` Point

  The origin

- `[newPos]` Point optional

  The point that the new position is assigned to (allowed to be same as input)

#### Returns:

Point:

The new point, inverse-transformed through this matrix

### `fromArray`

(

- `array`

)

Defined in `src/pixi/geom/Matrix.js:60`

Creates a Matrix object based on the given array. The Element to Matrix mapping order is as follows:

a = array[0] b = array[1] c = array[3] d = array[4] tx = array[2] ty = array[5]

#### Parameters:

- `array` Array

  The array that the matrix will be populated from.

### `identity`

() Matrix

Defined in `src/pixi/geom/Matrix.js:250`

Resets this Matix to an identity (default) matrix.

#### Returns:

Matrix:

This matrix. Good for chaining method calls.

### `rotate`

(

- `angle`

)
Matrix

Defined in `src/pixi/geom/Matrix.js:200`

Applies a rotation transformation to the matrix.

#### Parameters:

- `angle` Number

  The angle in radians.

#### Returns:

Matrix:

This matrix. Good for chaining method calls.

### `scale`

(

- `x`
- `y`

)
Matrix

Defined in `src/pixi/geom/Matrix.js:179`

Applies a scale transformation to the matrix.

#### Parameters:

- `x` Number

  The amount to scale horizontally

- `y` Number

  The amount to scale vertically

#### Returns:

Matrix:

This matrix. Good for chaining method calls.

### `toArray`

(

- `transpose`

)
Array

Defined in `src/pixi/geom/Matrix.js:83`

Creates an array from the current Matrix object.

#### Parameters:

- `transpose` Boolean

  Whether we need to transpose the matrix or not

#### Returns:

Array:

the newly created array which contains the matrix

### `translate`

(

- `x`
- `y`

)
Matrix

Defined in `src/pixi/geom/Matrix.js:163`

Translates the matrix on the x and y.

#### Parameters:

- `x` Number
- `y` Number

#### Returns:

Matrix:

This matrix. Good for chaining method calls.

## Properties

### `a`

Number

Defined in `src/pixi/geom/Matrix.js:17`

Default: 1

### `b`

Number

Defined in `src/pixi/geom/Matrix.js:24`

Default: 0

### `c`

Number

Defined in `src/pixi/geom/Matrix.js:31`

Default: 0

### `d`

Number

Defined in `src/pixi/geom/Matrix.js:38`

Default: 1

### `tx`

Number

Defined in `src/pixi/geom/Matrix.js:45`

Default: 0

### `ty`

Number

Defined in `src/pixi/geom/Matrix.js:52`

Default: 0