如何将2D矩阵转换为变换

时间:2014-12-23 09:35:10

标签: actionscript-3 flash matrix 2d graphic

我正在使用Flash AS3。 如果我有一组变换数据(x,y,scaleX,scaleY,skewX,skewY),我可以将它转换为矩阵:

matrix.a = transform.scaleX * Math.cos(transform.skewY)
matrix.b = transform.scaleX * Math.sin(transform.skewY)
matrix.c = -transform.scaleY * Math.sin(transform.skewX);
matrix.d = transform.scaleY * Math.cos(transform.skewX);
matrix.tx = transform.x;
matrix.ty = transform.y;

我的问题是现在我有一个矩阵,如何将其转换为变换?有没有lib或框架提供这样的功能?

1 个答案:

答案 0 :(得分:0)

来自变换对象的documentation

To apply two-dimensional transformations: create a Matrix object, set the matrix's two-dimensional transformation, and then assign the transform.matrix property of the display object to the new Matrix object.

因此,编辑对象现有转换矩阵的过程应如下所示:

var newMatrix:Matrix = aDisplayObject.transform.matrix
newMatrix.a = 123
aDisplayObject.transform.matrix = newMatrix