Matrix

Matrix.add(…)

Adds the given matrix to existing one

Parameters

  1. a number
  2. b number
  3. c number
  4. d number
  5. e number
  6. f number

or

Parameters

  1. matrix object Matrix

Matrix.invert()

Returns an inverted version of the matrix

Returns: object Matrix

Matrix.clone()

Returns a copy of the matrix

Returns: object Matrix

Matrix.translate(x, y)

Translate the matrix

Parameters

  1. x number horizontal offset distance
  2. y number vertical offset distance

Matrix.scale(x, [y], [cx], [cy])

Scales the matrix

Parameters

  1. x number amount to be scaled, with 1 resulting in no change
  2. y number amount to scale along the vertical axis. (Otherwise x applies to both axes.)
  3. cx number horizontal origin point from which to scale
  4. cy number vertical origin point from which to scale

Default cx, cy is the middle point of the element.

Matrix.rotate(a, x, y)

Rotates the matrix

Parameters

  1. a number angle of rotation, in degrees
  2. x number horizontal origin point from which to rotate
  3. y number vertical origin point from which to rotate

Matrix.x(x, y)

Returns x coordinate for given point after transformation described by the matrix. See also Matrix.y

Parameters

  1. x number
  2. y number

Returns: number x

Matrix.y(x, y)

Returns y coordinate for given point after transformation described by the matrix. See also Matrix.x

Parameters

  1. x number
  2. y number

Returns: number y

Matrix.determinant()

Finds determinant of the given matrix.

Returns: number determinant

Matrix.split()

Splits matrix into primitive transformations

Returns: object in format:

  1. dx number translation by x
  2. dy number translation by y
  3. scalex number scale by x
  4. scaley number scale by y
  5. shear number shear
  6. rotate number rotation in deg
  7. isSimple boolean could it be represented via simple transformations

Matrix.toTransformString()

Returns transform string that represents given matrix

Returns: string transform string