abstract Matrix3(Float32Array)
package lime.math
to Float32Array,
Available on all platforms
Matrix3
is a 3x3 transformation matrix particularly useful for
two-dimensional transformation. It can be used for rotation, scale
and skewing of a two-dimensional object.
Although a 3x3 matrix is represented, configurable values can be considered as a 3x2 matrix:
[ a, c, tx ]
[ b, d, ty ]
[ 0, 0, 1 ]
Values are stored in column-major order for GLSL compatibility.
Static variables
Static methods
staticinlineclone(this:Float32Array):Matrix3
staticconcat(this:Float32Array, m:Matrix3):Void
staticcopyColumnFrom(this:Float32Array, column:Int, vector4:Vector4):Void
staticcopyColumnTo(this:Float32Array, column:Int, vector4:Vector4):Void
staticcopyFrom(this:Float32Array, sourceMatrix3:Matrix3):Void
staticcopyRowFrom(this:Float32Array, row:Int, vector4:Vector4):Void
staticcopyRowTo(this:Float32Array, row:Int, vector4:Vector4):Void
staticcreateBox(this:Float32Array, scaleX:Float, scaleY:Float, rotation:Float = 0, xTranslate:Float = 0, yTranslate:Float = 0):Void
Applies a two-dimensional transformation to the current matrix.
This is the same as calling identity()
, rotate()
, scale()
then translate()
with these values.
Parameters:
scaleX | An x scale transformation value |
---|---|
scaleY | A y scale transformation value |
rotation | (Optional) A rotation value (default is 0) |
xTranslate | (Optional) A translate x value (default is 0) |
yTranslate | (Optional) A translate y value (default is 0) |
staticcreateGradientBox(this:Float32Array, width:Float, height:Float, rotation:Float = 0, xTranslate:Float = 0, yTranslate:Float = 0):Void
Creates a matrix to use for a linear gradient fill
Parameters:
width | The width of the gradient fill |
---|---|
height | The height of the gradient fill |
rotation | (Optional) A rotation for the gradient fill (default is 0) |
xTranslate | (Optional) An x offset for the gradient fill (default is 0) |
yTranslate | (Optional) A y offset for the gradient fill (default is 0) |
Returns:
A new Matrix
instance
staticdeltaTransformVector(this:Float32Array, Vector2:Vector2, ?result:Vector2):Vector2
staticequals(this:Float32Array, matrix3:Matrix3):Bool
Check if two matrices have the same values
Returns:
Whether both matrices are equal
staticinvert(this:Float32Array):Matrix3
Inverts the values of the current matrix
Returns:
The current matrix instance
staticrotate(this:Float32Array, theta:Float):Void
Applies rotation to the current matrix
Parameters:
theta | A rotation value in degrees |
---|
staticscale(this:Float32Array, sx:Float, sy:Float):Void
Scales the current matrix
Parameters:
sx | The x scale to apply |
---|---|
sy | The y scale to apply |
staticsetTo(this:Float32Array, a:Float, b:Float, c:Float, d:Float, tx:Float, ty:Float):Void
Sets the values of the current matrix
Parameters:
a | The new matrix a value |
---|---|
b | The new matrix b value |
c | The new matrix c value |
d | The new matrix d value |
tx | The new matrix tx value |
ty | The new matrix ty value |
statictransformRect(this:Float32Array, rect:Rectangle, ?result:Rectangle):Rectangle
statictransformVector(this:Float32Array, pos:Vector2, ?result:Vector2):Vector2
staticinlinetranslate(this:Float32Array, dx:Float, dy:Float):Void
Adjusts the tx
and ty
of the current matrix
Parameters:
dx | The x amount to translate |
---|---|
dy | The y amount to translate |