#

API Docs for: 3.10.3
Show: Inherited Protected Private Deprecated

# Matrix Class

Defined in: `matrix/js/Matrix.js:1`
Module: matrix

Matrix is a class that allows for the manipulation of a transform matrix. This class is a work in progress.

## Constructor

### `Matrix`

()

Defined in `matrix/js/Matrix.js:1`

- Index
- Methods
- Properties

## Item Index

### Methods

- _round
- applyCSSText
- decompose
- deg2rad
- getContentRect
- getDeterminant
- getMatrixArray
- getTransformArray
- identity
- init
- inverse
- multiple
- rad2deg
- rotate
- scale
- skew
- skewX
- skewY
- toCSSText
- toFilterText
- translate
- translateX
- translateY
- transpose

### Properties

- _defaults
- _rounder

## Methods

### `_round`

() private

Defined in `matrix/js/Matrix.js:110`

Rounds values

### `applyCSSText`

(

- `val`

)

Defined in `matrix/js/Matrix.js:51`

Parses a string and updates the matrix.

#### Parameters:

- `val` String

  A css transform string

### `decompose`

()

Defined in `matrix/js/Matrix.js:442`

Returns an array of transform commands that represent the matrix.

#### Returns:

Array

### `deg2rad`

(

- `deg`

)

Defined in `matrix/js/Matrix.js:251`

Converts a degree value to a radian.

#### Parameters:

- `deg` Number

  Degree value to be converted to radian.

#### Returns:

Number

### `getContentRect`

(

- `width`
- `height`
- `x`
- `y`

)

Defined in `matrix/js/Matrix.js:366`

Returns the left, top, right and bottom coordinates for a transformed item.

#### Parameters:

- `width` Number

  The width of the item.

- `height` Number

  The height of the item.

- `x` Number

  The x-coordinate of the item.

- `y` Number

  The y-coordinate of the item.

#### Returns:

Object

### `getDeterminant`

()

Defined in `matrix/js/Matrix.js:409`

Returns the determinant of the matrix.

#### Returns:

Number

### `getMatrixArray`

()

Defined in `matrix/js/Matrix.js:343`

Returns a 3x3 Matrix array

/ \ | matrix[0][0] matrix[1][0] matrix[2][0] | | matrix[0][1] matrix[1][1] matrix[2][1] | | matrix[0][2] matrix[1][2] matrix[2][2] | \ /

#### Returns:

Array

### `getTransformArray`

(

- `val`

)

Defined in `matrix/js/Matrix.js:71`

Parses a string and returns an array of transform arrays.

#### Parameters:

- `val` String

  A css transform string

#### Returns:

Array

### `identity`

()

Defined in `matrix/js/Matrix.js:324`

Returns an identity matrix.

#### Returns:

Object

### `init`

(

- `config`

)

Defined in `matrix/js/Matrix.js:121`

Initializes a matrix.

#### Parameters:

- `config` Object

  Specified key value pairs for matrix properties. If a property is not explicitly defined in the config argument, the default value will be used.

### `inverse`

()

Defined in `matrix/js/Matrix.js:420`

Returns the inverse (in array form) of the matrix.

#### Returns:

Array

### `multiple`

(

- `a`
- `b`
- `c`
- `d`
- `dx`
- `dy`

)

Defined in `matrix/js/Matrix.js:22`

Updates the matrix.

#### Parameters:

- `a` Number
- `b` Number
- `c` Number
- `d` Number
- `dx` Number
- `dy` Number

### `rad2deg`

(

- `rad`

)

Defined in `matrix/js/Matrix.js:239`

Converts a radian value to a degree.

#### Parameters:

- `rad` Number

  Radian value to be converted.

#### Returns:

Number

### `rotate`

(

- `deg`

)

Defined in `matrix/js/Matrix.js:273`

Applies a rotate transform.

#### Parameters:

- `deg` Number

  The degree of the rotation.

### `scale`

(

- `val`

)

Defined in `matrix/js/Matrix.js:144`

Applies a scale transform

#### Parameters:

- `val` Number

### `skew`

(

- `x`
- `y`

)

Defined in `matrix/js/Matrix.js:155`

Applies a skew transformation.

#### Parameters:

- `x` Number

  The value to skew on the x-axis.

- `y` Number

  The value to skew on the y-axis.

### `skewX`

(

- `x`

)

Defined in `matrix/js/Matrix.js:179`

Applies a skew to the x-coordinate

#### Parameters:

- `x` Number

  x-coordinate

### `skewY`

(

- `y`

)

Defined in `matrix/js/Matrix.js:190`

Applies a skew to the y-coordinate

#### Parameters:

- `y` Number

  y-coordinate

### `toCSSText`

()

Defined in `matrix/js/Matrix.js:201`

Returns a string of text that can be used to populate a the css transform property of an element.

#### Returns:

String

### `toFilterText`

()

Defined in `matrix/js/Matrix.js:219`

Returns a string that can be used to populate the css filter property of an element.

#### Returns:

String

### `translate`

(

- `x`
- `y`

)

Defined in `matrix/js/Matrix.js:287`

Applies translate transformation.

#### Parameters:

- `x` Number

  The value to transate on the x-axis.

- `y` Number

  The value to translate on the y-axis.

### `translateX`

(

- `x`

)

Defined in `matrix/js/Matrix.js:301`

Applies a translate to the x-coordinate

#### Parameters:

- `x` Number

  x-coordinate

### `translateY`

(

- `y`

)

Defined in `matrix/js/Matrix.js:312`

Applies a translate to the y-coordinate

#### Parameters:

- `y` Number

  y-coordinate

### `transpose`

()

Defined in `matrix/js/Matrix.js:431`

Returns the transpose of the matrix

#### Returns:

Array

## Properties

### `_defaults`

Unknown private

Defined in `matrix/js/Matrix.js:95`

Default values for the matrix

### `_rounder`

Unknown private

Defined in `matrix/js/Matrix.js:14`

Used as value for the _rounding method.