AffineTransform
Class
Module: cc
AffineTransform class represent an affine transform matrix. It's composed basically by translation, rotation, scale transformations.
Index
Methods
create
Create a AffineTransform object with all contents in the matrix.identity
Create a identity transformation matrix: ...clone
Clone a AffineTransform object from the specified transform.concat
Concatenate a transform matrix to anotherinvert
Get the invert transform of an AffineTransform object.invert
Get an AffineTransform object from a given matrix 4x4.transformVec2
Apply the affine transformation on a point.transformSize
Apply the affine transformation on a size.transformRect
Apply the affine transformation on a rect.transformObb
Apply the affine transformation on a rect, and truns to an Oriented Bounding Box.
Details
Methods
create
Create a AffineTransform object with all contents in the matrix.
meta | description |
---|---|
Returns | AffineTransform |
Defined in | cocos2d/core/utils/affine-transform.js:55 |
Parameters
identity
Create a identity transformation matrix:
[ 1, 0, 0,
0, 1, 0 ]
meta | description |
---|---|
Returns | AffineTransform |
Defined in | cocos2d/core/utils/affine-transform.js:72 |
clone
Clone a AffineTransform object from the specified transform.
meta | description |
---|---|
Returns | AffineTransform |
Defined in | cocos2d/core/utils/affine-transform.js:90 |
Parameters
concat
Concatenate a transform matrix to another The results are reflected in the out affine transform out = t1 * t2 This function is memory free, you should create the output affine transform by yourself and manage its memory.
meta | description |
---|---|
Returns | AffineTransform |
Defined in | cocos2d/core/utils/affine-transform.js:102 |
Parameters
out
AffineTransform Out object to store the concat resultt1
AffineTransform The first transform object.t2
AffineTransform The transform object to concatenate.
invert
Get the invert transform of an AffineTransform object. This function is memory free, you should create the output affine transform by yourself and manage its memory.
meta | description |
---|---|
Returns | AffineTransform |
Defined in | cocos2d/core/utils/affine-transform.js:129 |
Parameters
invert
Get an AffineTransform object from a given matrix 4x4. This function is memory free, you should create the output affine transform by yourself and manage its memory.
meta | description |
---|---|
Returns | AffineTransform |
Defined in | cocos2d/core/utils/affine-transform.js:152 |
Parameters
out
AffineTransformmat
Mat4
transformVec2
Apply the affine transformation on a point. This function is memory free, you should create the output Vec2 by yourself and manage its memory.
meta | description |
---|---|
Returns | Vec2 |
Defined in | cocos2d/core/utils/affine-transform.js:172 |
Parameters
out
Vec2 The output point to store the resultpoint
Vec2 | Number Point to apply transform or x.transOrY
AffineTransform | Number transform matrix or y.t
AffineTransform transform matrix.
transformSize
Apply the affine transformation on a size. This function is memory free, you should create the output Size by yourself and manage its memory.
meta | description |
---|---|
Returns | Size |
Defined in | cocos2d/core/utils/affine-transform.js:199 |
Parameters
out
Size The output point to store the resultsize
Sizet
AffineTransform
transformRect
Apply the affine transformation on a rect. This function is memory free, you should create the output Rect by yourself and manage its memory.
meta | description |
---|---|
Returns | Rect |
Defined in | cocos2d/core/utils/affine-transform.js:216 |
Parameters
out
Rectrect
RectanAffineTransform
AffineTransform
transformObb
Apply the affine transformation on a rect, and truns to an Oriented Bounding Box. This function is memory free, you should create the output vectors by yourself and manage their memory.
meta | description |
---|---|
Defined in | cocos2d/core/utils/affine-transform.js:253 |