identity (Matrix.identity メソッド)

public identity() : Void

変換されたムービークリップや図形が元と同一になる値を各マトリックスプロパティに設定します。

identity() メソッドを呼び出すと、結果として得られる行列のプロパティは、a=1, b=0, c=0, d=1, tx=0, ty=0 になります。

マトリックス表記の場合、単位マトリックス (単位行列) は次のようになります。



対応バージョン : ActionScript 1.0、Flash Player 8

次の例では、identity() メソッドを呼び出すことで、呼び出し先の Matrix オブジェクトを単位 Matrix オブジェクトに変換します。元の Matrix オブジェクトに事前に適用する変換の回数や種類に関係なく、identity() を呼び出すと、マトリックスの値が (a=1, b=0, c=0, d=1, tx=0, ty=0) に変換されます。

import flash.geom.Matrix;

var myMatrix:Matrix = new Matrix(2, 0, 0, 2, 0 ,0);
trace(myMatrix.toString()); // (a=2, b=0, c=0, d=2, tx=0, ty=0)

myMatrix.rotate(Math.atan(3/4));
trace(myMatrix.toString()); // (a=1.6, b=1.2, c=-1.2, d=1.6, tx=0, ty=0)

myMatrix.translate(100,200);
trace(myMatrix.toString()); // (a=1.6, b=1.2, c=-1.2, d=1.6, tx=100, ty=200)

myMatrix.scale(2, 2);
trace(myMatrix.toString()); // (a=3.2, b=2.4, c=-2.4, d=3.2, tx=200, ty=400)

myMatrix.identity();
trace(myMatrix.toString()); // (a=1, b=0, c=0, d=1, tx=0, ty=0)

 

このページに新しいコメントが追加された場合に、電子メールでの通知を希望する。 | コメントレポート

現在のページ: http://livedocs.adobe.com/flash/9.0_jp/main/00001853.html