AffineTransform Class
cc.AffineTransform class represent an affine transform matrix. It's composed basically by translation, rotation, scale transformations.
Please do not use its constructor directly, use cc.affineTransformMake alias function instead.
Index
Methods
affineTransformMakeCreate a cc.AffineTransform object with all contents in the matrix.affineTransformCloneClone a cc.AffineTransform object from the specified transform.pointApplyAffineTransformApply the affine transformation on a point.sizeApplyAffineTransformApply the affine transformation on a size.affineTransformMakeIdentityCreate a identity transformation matrix:
[ 1, 0, 0,
0, 1, 0 ]rectApplyAffineTransformApply the affine transformation on a rect.obbApplyAffineTransformApply the affine transformation on a rect, and truns to an Oriented Bounding Box.affineTransformTranslateCreate a new affine transformation with a base transformation matrix and a translation based on it.affineTransformScaleCreate a new affine transformation with a base transformation matrix and a scale based on it.affineTransformRotateCreate a new affine transformation with a base transformation matrix and a rotation based on it.affineTransformConcatConcatenate a transform matrix to another and return the result:
t' = t1 * t2affineTransformConcatInConcatenate a transform matrix to another
The results are reflected in the first matrix.
t' = t1 * t2affineTransformEqualToTransformReturn true if an affine transform equals to another, false otherwise.affineTransformInvertGet the invert transform of an AffineTransform object.affineTransformInvertPut the invert transform of an AffineTransform object into the out AffineTransform object.
Details
Methods
affineTransformMake
Create a cc.AffineTransform object with all contents in the matrix.
| meta | description |
|---|---|
| Returns | AffineTransform |
| Defined in | https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/value-types/CCAffineTransform.js:55 |
Parameters
affineTransformClone
Clone a cc.AffineTransform object from the specified transform.
| meta | description |
|---|---|
| Returns | AffineTransform |
| Defined in | https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/value-types/CCAffineTransform.js:71 |
Parameters
pointApplyAffineTransform
Apply the affine transformation on a point.
| meta | description |
|---|---|
| Returns | Vec2 |
| Defined in | https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/value-types/CCAffineTransform.js:82 |
Parameters
pointVec2 | Number or x.transOrYAffineTransform | Number transform matrix or y.tAffineTransform transform matrix or y.
sizeApplyAffineTransform
Apply the affine transformation on a size.
| meta | description |
|---|---|
| Returns | Size |
| Defined in | https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/value-types/CCAffineTransform.js:124 |
Parameters
sizeSizetAffineTransform
affineTransformMakeIdentity
Create a identity transformation matrix:
[ 1, 0, 0,
0, 1, 0 ]
| meta | description |
|---|---|
| Returns | AffineTransform |
| Defined in | https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/value-types/CCAffineTransform.js:136 |
rectApplyAffineTransform
Apply the affine transformation on a rect.
| meta | description |
|---|---|
| Returns | Rect |
| Defined in | https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/value-types/CCAffineTransform.js:168 |
Parameters
rectRectanAffineTransformAffineTransform
obbApplyAffineTransform
Apply the affine transformation on a rect, and truns to an Oriented Bounding Box.
| meta | description |
|---|---|
| Defined in | https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/value-types/CCAffineTransform.js:223 |
Parameters
affineTransformTranslate
Create a new affine transformation with a base transformation matrix and a translation based on it.
| meta | description |
|---|---|
| Returns | AffineTransform |
| Defined in | https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/value-types/CCAffineTransform.js:257 |
Parameters
tAffineTransform The base affine transform object.txNumber The translation on x axis.tyNumber The translation on y axis.
affineTransformScale
Create a new affine transformation with a base transformation matrix and a scale based on it.
| meta | description |
|---|---|
| Returns | AffineTransform |
| Defined in | https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/value-types/CCAffineTransform.js:277 |
Parameters
tAffineTransform The base affine transform object.sxNumber The scale on x axis.syNumber The scale on y axis.
affineTransformRotate
Create a new affine transformation with a base transformation matrix and a rotation based on it.
| meta | description |
|---|---|
| Returns | AffineTransform |
| Defined in | https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/value-types/CCAffineTransform.js:290 |
Parameters
aTransformAffineTransform The base affine transform object.anAngleNumber The angle to rotate.
affineTransformConcat
Concatenate a transform matrix to another and return the result:
t' = t1 * t2
| meta | description |
|---|---|
| Returns | AffineTransform |
| Defined in | https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/value-types/CCAffineTransform.js:310 |
Parameters
t1AffineTransform The first transform object.t2AffineTransform The transform object to concatenate.
affineTransformConcatIn
Concatenate a transform matrix to another
The results are reflected in the first matrix.
t' = t1 * t2
| meta | description |
|---|---|
| Returns | AffineTransform |
| Defined in | https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/value-types/CCAffineTransform.js:331 |
Parameters
t1AffineTransform The first transform object.t2AffineTransform The transform object to concatenate.
affineTransformEqualToTransform
Return true if an affine transform equals to another, false otherwise.
| meta | description |
|---|---|
| Returns | Boolean |
| Defined in | https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/value-types/CCAffineTransform.js:355 |
Parameters
affineTransformInvert
Get the invert transform of an AffineTransform object.
| meta | description |
|---|---|
| Returns | AffineTransform |
| Defined in | https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/value-types/CCAffineTransform.js:367 |
Parameters
affineTransformInvert
Put the invert transform of an AffineTransform object into the out AffineTransform object.
| meta | description |
|---|---|
| Defined in | https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/value-types/CCAffineTransform.js:393 |