AffineTransform Class
AffineTransform class represent an affine transform matrix. It's composed basically by translation, rotation, scale transformations.
Index
Methods
createCreate a AffineTransform object with all contents in the matrix.identityCreate a identity transformation matrix: ...cloneClone a AffineTransform object from the specified transform.concatConcatenate a transform matrix to anotherinvertGet the invert transform of an AffineTransform object.invertGet an AffineTransform object from a given matrix 4x4.transformVec2Apply the affine transformation on a point.transformSizeApply the affine transformation on a size.transformRectApply the affine transformation on a rect.transformObbApply 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
outAffineTransform Out object to store the concat resultt1AffineTransform The first transform object.t2AffineTransform 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
outAffineTransformmatMat4
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:173 |
Parameters
outVec2 The output point to store the resultpointVec2 | Number Point to apply transform or x.transOrYAffineTransform | Number transform matrix or y.tAffineTransform 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:200 |
Parameters
outSize The output point to store the resultsizeSizetAffineTransform
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:217 |
Parameters
outRectrectRectanAffineTransformAffineTransform
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:254 |