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
affineTransformMake
Create a cc.AffineTransform object with all contents in the matrix.affineTransformClone
Clone a cc.AffineTransform object from the specified transform.pointApplyAffineTransform
Apply the affine transformation on a point.sizeApplyAffineTransform
Apply the affine transformation on a size.affineTransformMakeIdentity
Create a identity transformation matrix:
[ 1, 0, 0,
0, 1, 0 ]rectApplyAffineTransform
Apply the affine transformation on a rect.obbApplyAffineTransform
Apply the affine transformation on a rect, and truns to an Oriented Bounding Box.affineTransformTranslate
Create a new affine transformation with a base transformation matrix and a translation based on it.affineTransformScale
Create a new affine transformation with a base transformation matrix and a scale based on it.affineTransformRotate
Create a new affine transformation with a base transformation matrix and a rotation based on it.affineTransformConcat
Concatenate a transform matrix to another and return the result:
t' = t1 * t2affineTransformConcatIn
Concatenate a transform matrix to another
The results are reflected in the first matrix.
t' = t1 * t2affineTransformEqualToTransform
Return true if an affine transform equals to another, false otherwise.affineTransformInvert
Get the invert transform of an AffineTransform object.affineTransformInvert
Put 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
point
Vec2 | Number or x.transOrY
AffineTransform | Number transform matrix or y.t
AffineTransform 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
size
Sizet
AffineTransform
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
rect
RectanAffineTransform
AffineTransform
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
t
AffineTransform The base affine transform object.tx
Number The translation on x axis.ty
Number 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
t
AffineTransform The base affine transform object.sx
Number The scale on x axis.sy
Number 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
aTransform
AffineTransform The base affine transform object.anAngle
Number 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
t1
AffineTransform The first transform object.t2
AffineTransform 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
t1
AffineTransform The first transform object.t2
AffineTransform 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 |