Class: Matrix

Matrix

Matrix クラスは、2 つの座標空間の間におけるポイントのマッピング方法を決定する変換マトリックスを表します。
Matrix オブジェクトのプロパティを設定し、Matrix オブジェクトを Transform オブジェクトの matrix プロパティに適用し、
次に Transform オブジェクトを表示オブジェクトの transform プロパティとして適用することで、表示オブジェクトに対する各種グラフィック変換を実行できます。
これらの変換機能には、平行移動(x と y の位置変更)、回転、拡大 / 縮小、傾斜などが含まれます。

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.

new next2d.geom.Matrix (a, b, c, d, tx, ty)

NameTypeDefaultDescription
anumber1optional
bnumber0optional
cnumber0optional
dnumber1optional
txnumber0optional
tynumber0optional
Example

Example usage of Matrix.

// new Matrix
const {Matrix} = next2d.geom;
const matrix   = new Matrix();
// set new Matrix
const {MovieClip} = next2d.display;
const movieClip   = new MovieClip();
movieClip.transform.matrix = matrix;

Members

next2d.geom.Matrix.namespace string staticconstant

指定されたクラスの空間名を返します。
Returns the space name of the specified class.

Default Value:
  • next2d.geom.Matrix

a number

イメージを拡大 / 縮小または回転するときに x 軸方向のピクセルの配置に影響を与える値です。
The value that affects the positioning
of pixels along the x axis when scaling or rotating an image.

Default Value:
  • 1

b number

イメージを回転または傾斜させるときに y 軸方向のピクセルの配置に影響を与える値です。
The value that affects the positioning
of pixels along the y axis when rotating or skewing an image.

Default Value:
  • 0

c number

イメージを回転または傾斜させるときに x 軸方向のピクセルの配置に影響を与える値です。
The value that affects the positioning
of pixels along the x axis when rotating or skewing an image.

Default Value:
  • 0

d number

イメージを拡大 / 縮小または回転するときに y 軸方向のピクセルの配置に影響を与える値です。
The value that affects the positioning
of pixels along the y axis when scaling or rotating an image.

Default Value:
  • 1

namespace string constant

指定されたオブジェクトの空間名を返します。
Returns the space name of the specified object.

Default Value:
  • next2d.geom.Matrix

tx number

x 軸方向に各ポイントを平行移動する距離です。
The distance by which to translate each point along the x axis.

Default Value:
  • 0

ty number

y 軸方向に各ポイントを平行移動する距離です。
The distance by which to translate each point along the y axis.

Default Value:
  • 0

Methods

next2d.geom.Matrix.toString ()string static

指定されたクラスのストリングを返します。
Returns the string representation of the specified class.

Default Value:
  • [class Matrix]
Returns:
TypeDescription
string

clone ()Matrix

新しい Matrix オブジェクトとして、このマトリックスのクローンを返します。
含まれるオブジェクトはまったく同じコピーになります。
Returns a new Matrix object that is a clone of this matrix,
with an exact copy of the contained object.

Returns:
TypeDescription
Matrix

concat (m)void

マトリックスを現在のマトリックスと連結して、
2 つのマトリックスの図形効果を効果的に組み合わせます。
Concatenates a matrix with the current matrix,
effectively combining the geometric effects of the two.

NameTypeDescription
mMatrix
Returns:
TypeDescription
void

copyFrom (source_matrix)void

すべてのマトリックスデータを、ソース Matrix オブジェクトから、
呼び出し元の Matrix オブジェクトにコピーします。

NameTypeDescription
source_matrixMatrix
Returns:
TypeDescription
void

createBox (scale_x, scale_y, rotation, tx, ty)void

拡大 / 縮小、回転、平行移動に関するパラメーターなどがあります。
Includes parameters for scaling, rotation, and translation.

NameTypeDefaultDescription
scale_xnumber
scale_ynumber
rotationnumber0optional
txnumber0optional
tynumber0optional
Returns:
TypeDescription
void

createGradientBox (width, height, rotation, tx, ty)void

Graphics クラスの beginGradientFill() メソッドで使用する特定のスタイルを作成します。
Creates the specific style of matrix expected
by the beginGradientFill() and lineGradientStyle() methods of the Graphics class.

NameTypeDefaultDescription
widthnumber
heightnumber
rotationnumber0optional
txnumber0optional
tynumber0optional
Returns:
TypeDescription
void

deltaTransformPoint (point)Point

変換前の座標空間内のポイントが指定されると、そのポイントの変換後の座標を返します。
Given a point in the pretransform coordinate space,
returns the coordinates of that point after the transformation occurs.

NameTypeDescription
pointPoint
Returns:
TypeDescription
Point

identity ()void

各行列プロパティを null 変換になる値に設定します。
Sets each matrix property to a value that causes a null transformation.

Returns:
TypeDescription
void

invert ()void

元のマトリックスの逆の変換を実行します。
Performs the opposite transformation of the original matrix.

Returns:
TypeDescription
void

rotate (rotation)void

Matrix オブジェクトに回転変換を適用します。
Applies a rotation transformation to the Matrix object.

NameTypeDescription
rotationnumber
Returns:
TypeDescription
void

scale (sx, sy)void

行列に拡大 / 縮小の変換を適用します。
Applies a scaling transformation to the matrix.

NameTypeDescription
sxnumber
synumber
Returns:
TypeDescription
void

setTo (a, b, c, d, tx, ty)void

Matrix のメンバーを指定の値に設定します。
Sets the members of Matrix to the specified values

NameTypeDescription
anumber
bnumber
cnumber
dnumber
txnumber
tynumber
Returns:
TypeDescription
void

toString ()string

指定されたオブジェクトのストリングを返します。
Returns the string representation of the specified object.

Returns:
TypeDescription
string

transformPoint (point)Point

Matrix オブジェクトで表現される図形変換を、指定されたポイントに適用した結果を返します。
Returns the result of applying the geometric transformation represented
by the Matrix object to the specified point.

NameTypeDescription
pointPoint
Returns:
TypeDescription
Point

translate (dx, dy)void

行列を x 軸と y 軸に沿って、
dx パラメーターと dy パラメーターで指定された量だけ平行移動します。
Translates the matrix along the x and y axes,
as specified by the dx and dy parameters.

NameTypeDescription
dxnumber
dynumber
Returns:
TypeDescription
void