class openfl.geom.Matrix3D
Available on all platforms
The Matrix class represents a transformation matrix that determines how to
map points from one coordinate space to another. You can perform various
graphical transformations on a display object by setting the properties of
a Matrix object, applying that Matrix object to the matrix
property of a Transform object, and then applying that Transform object as
the transform
property of the display object. These
transformation functions include translation(x and y
repositioning), rotation, scaling, and skewing.
Together these types of transformations are known as affine transformations. Affine transformations preserve the straightness of lines while transforming, so that parallel lines stay parallel.
To apply a transformation matrix to a display object, you create a
Transform object, set its matrix
property to the
transformation matrix, and then set the transform
property of
the display object to the Transform object. Matrix objects are also used as
parameters of some methods, such as the following:
- The
draw()
method of a BitmapData object - The
beginBitmapFill()
method,beginGradientFill()
method, orlineGradientStyle()
method of a Graphics object
A transformation matrix object is a 3 x 3 matrix with the following contents:
In traditional transformation matrixes, the u
,
v
, and w
properties provide extra capabilities.
The Matrix class can only operate in two-dimensional space, so it always
assumes that the property values u
and v
are 0.0,
and that the property value w
is 1.0. The effective values of
the matrix are as follows:
You can get and set the values of all six of the other properties in a
Matrix object: a
, b
, c
,
d
, tx
, and ty
.
The Matrix class supports the four major types of transformations: translation, scaling, rotation, and skewing. You can set three of these transformations by using specialized methods, as described in the following table:
Each transformation function alters the current matrix properties so
that you can effectively combine multiple transformations. To do this, you
call more than one transformation function before applying the matrix to
its display object target(by using the transform
property of
that display object).
Use the new Matrix()
constructor to create a Matrix object
before you can call the methods of the Matrix object.
Class Fields
static function createOrtho(x0:Float, x1:Float, y0:Float, y1:Float, zNear:Float, zFar:Float):Matrix3D
Instance Fields
function new(?v:Vector<Float> = null):Void
Creates a new Matrix object with the specified parameters. In matrix notation, the properties are organized like this:
If you do not provide any parameters to the new Matrix()
constructor, it creates an identity matrix with the following
values:
In matrix notation, the identity matrix looks like this:
Returns a new Matrix object that is a clone of this matrix, with an exact copy of the contained object.
returns | A Matrix object. |
function decompose(?orientationStyle:Orientation3D = null):Vector<Vector3D>
Returns the transformation matrix's translation, rotation, and scale settings as a Vector of three Vector3D objects.