Class: Matrix

Matrix

new JC.Matrix()

矩阵对象,用来描述和记录对象的tansform 状态信息

Methods

append(matrix){this}

矩阵相乘

Name Type Description
matrix matrix
Returns:
Type Description
this

apply(pos, newPos){object}

将坐标点与矩阵左乘

Name Type Description
pos object

原始点

newPos object

变换之后的点

Returns:
Type Description
object 返回数组

applyInverse(pos, newPos){object}

将坐标点与转置矩阵左乘

Name Type Description
pos object

原始点

newPos object

变换之后的点

Returns:
Type Description
object 变换之后的点

fromArray(array)

从数组设置一个矩阵

Name Type Description
array array

identity(){this}

单位矩阵

Returns:
Type Description
this

rotate(angle){this}

旋转操作

Name Type Description
angle number
Returns:
Type Description
this

scale(x, y){this}

缩放操作

Name Type Description
x number
y number
Returns:
Type Description
this

setTransform(x, y, pivotX, pivotY, scaleX, scaleY, rotation, skewX, skewY, originX, originY){this}

快速设置矩阵各个分量

Name Type Description
x number
y number
pivotX number
pivotY number
scaleX number
scaleY number
rotation number
skewX number
skewY number
originX number
originY number
Returns:
Type Description
this

toArray(transpose){Array.<number>}

将对象的数据以数组的形式导出

Name Type Description
transpose boolean

是否对矩阵进行转置

Returns:
Type Description
Array.<number> 返回数组

translate(x, y){this}

位移操作

Name Type Description
x number
y number
Returns:
Type Description
this