Module Matrix-PIXI
type transformOpaque;FIXME: lack of support for https://github.com/BuckleScript/bucklescript/issues/3949 doesn't allow recursive dependencies on JS-class bindings, so references to PIXI.Transform.t are rendered as anonymous types in Matrix context
- see /bs-pixi/PIXI/MatrixUtils-PIXI/
MatrixUtils
class type _t = { ... }type t= Js.t(_t);The PixiJS Matrix as a class makes it a lot faster (to work with matrixes). Here is a representation of it:
| a | c | tx| | b | d | ty| | 0 | 0 | 1 |
module Impl: { ... };include Impl;
let create: ?a:float => ?b:float => ?c:float => ?d:float => ?tx:float => ?ty:float => unit => t;creates a new matrix
- parameter a
x scale (default 1)
- parameter b
x skew (default 0)
- parameter c
y skew (default 0)
- parameter d
y scale (default 1)
- parameter tx
x translation (default 0)
- parameter ty
y translation (default 0)
let identity_: t;A default (identity) matrix
let tempMatrix: t;A temp matrix
let getA: Js.t(_t) => float;x scale
let setA: Js.t(_t) => float => unit;x scale
let getB: Js.t(_t) => float;x skew
let setB: Js.t(_t) => float => unit;x skew
let getC: Js.t(_t) => float;y skew
let setC: Js.t(_t) => float => unit;y skew
let getD: Js.t(_t) => float;y scale
let setD: Js.t(_t) => float => unit;y scale
let getTx: Js.t(_t) => float;x translation
let setTx: Js.t(_t) => float => unit;x translation
let getTy: Js.t(_t) => float;y translation
let setTy: Js.t(_t) => float => unit;y translation
let append: Js.t(_t) => matrix:Js.t(_t) => Js.t(_t);Appends the given Matrix to this Matrix.
- parameter matrix
The matrix to append.
- returns
This matrix. Good for chaining method calls
let apply: Js.t(_t) => pos:Js.t(PIXI.Point.#_t) => ?newPos:Js.t(PIXI.Point.#_t) => unit => Js.t(PIXI.Point.#_t);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)
- parameter pos
The origin
- parameter newPos
The point that the new position is assigned to (allowed to be same as input)
- returns
The new point, transformed through this matrix
let applyInverse: Js.t(_t) => pos:Js.t(PIXI.Point.#_t) => ?newPos:Js.t(PIXI.Point.#_t) => unit => Js.t(PIXI.Point.#_t);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)
- parameter pos
The origin
- parameter newPos
(optional) The point that the new position is assigned to (allowed to be same as input)
- returns
The new point, transformed through this matrix
let clone: Js.t(_t) => Js.t(_t);Creates a new Matrix object with the same values as this one.
- returns
A copy of this matrix. Good for chaining method calls.
let copyFrom: Js.t(_t) => matrix:Js.t(_t) => Js.t(_t);Changes the values of the matrix to be the same as the ones in given matrix
- parameter matrix
The matrix to copy from.
- returns
itself
let copyTo: Js.t(_t) => matrix:Js.t(_t) => Js.t(_t);Changes the values of the given matrix to be the same as the ones in this matrix
- parameter matrix
The matrix to copy to.
- returns
The matrix given in parameter with its values updated.
let decompose: Js.t(_t) => transform:transformOpaque => transformOpaque;Decomposes the matrix (x, y, scaleX, scaleY, and rotation) and sets the properties on to a transform.
- deprecated
Consider using MatrixUtils.decompose instead
- see /bs-pixi/PIXI/MatrixUtils-PIXI/#val-decompose
MatrixUtils.decompose
- parameter transform
The transform to apply the properties to
- returns
The transform with the newly applied properties
let fromArray: Js.t(_t) => array:array(float) => unit;Creates a Matrix object based on the given array. The Element to Matrix mapping order is as follows a = array
0b = array1c = array3d = array4tx = array2ty = array5- parameter array
The array that the matrix will be populated from.
let identity: Js.t(_t) => Js.t(_t);Resets this Matrix to an identity (default) matrix.
- returns
This matrix. Good for chaining method calls.
let invert: Js.t(_t) => Js.t(_t);Inverts this matrix
- returns
This matrix. Good for chaining method calls.
let prepend: Js.t(_t) => matrix:Js.t(_t) => Js.t(_t);Prepends the given Matrix to this Matrix.
- parameter The
matrix to prepend
- returns
This matrix. Good for chaining method calls.
let rotate: Js.t(_t) => angle:float => Js.t(_t);Applies a rotation transformation to the matrix.
- parameter angle
The angle in radians
- returns
This matrix. Good for chaining method calls.
let scale: Js.t(_t) => x:float => y:float => Js.t(_t);Applies a scale transformation to the matrix.
- parameter x
The amount to scale horizontally
- parameter y
The amount to scale vertically
- returns
This matrix. Good for chaining method calls.
let set: t => a:float => b:float => c:float => d:float => tx:float => ty:float => t;sets the matrix properties
- parameter a
Matrix component
- parameter b
Matrix component
- parameter c
Matrix component
- parameter d
Matrix component
- parameter tx
Matrix component
- parameter ty
Matrix component
- returns
This matrix. Good for chaining method calls
let setTransform: t => x:float => y:float => pivotX:float => pivotY:float => scaleX:float => scaleY:float => rotation:float => skewX:float => skewY:float => t;Sets the matrix based on all the available properties
- parameter x
Position on the x axis
- parameter y
Position on the y axis
- parameter pivotX
Pivot on the x axis
- parameter pivotY
Pivot on the y axis
- parameter scaleX
Scale on the x axis
- parameter scaleY
Scale on the y axis
- parameter rotation
rotation in radians
- parameter skewX
Skew on the x axis
- parameter skewY
Skew on the y axis
- returns
This matrix. Good for chaining method calls.
let toArray: t => transpose:bool => ?out:Js.Typed_array.Float32Array.t => unit => array(float);Creates an array from the current Matrix object
- parameter transpose
Whether we need to transpose the matrix or not
- parameter out
(optional) If provided the array will be assigned to out
- returns
the newly created array which contains the matrix