Cocos Creator API

1.0.0

Cocos Creator is a highly customizable game development tool that utilizes the power of cocos2d-x.

AffineTransform

Module: cc

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.

Methods

affineTransformMake
(
  • a
  • b
  • c
  • d
  • tx
  • ty
)
AffineTransform

Create a cc.AffineTransform object with all contents in the matrix.

name type description
a Number
b Number
c Number
d Number
tx Number
ty Number

returns:

affineTransformClone
(
  • t
)
AffineTransform

Clone a cc.AffineTransform object from the specified transform.

name type description
t AffineTransform

returns:

pointApplyAffineTransform
(
  • point
  • transOrY
  • t
)
Vec2

Apply the affine transformation on a point.

name type description
point Vec2 | Number

or x.

transOrY AffineTransform | Number

transform matrix or y.

t AffineTransform

transform matrix or y.

returns:

type: Vec2

sizeApplyAffineTransform
(
  • size
  • t
)
Size

Apply the affine transformation on a size.

name type description
size Size
t AffineTransform

returns:

type: Size

affineTransformMakeIdentity ( ) AffineTransform

Create a identity transformation matrix:
[ 1, 0, 0,
0, 1, 0 ]

returns:

rectApplyAffineTransform
(
  • rect
  • anAffineTransform
)
Rect

Apply the affine transformation on a rect.

name type description
rect Rect
anAffineTransform AffineTransform

returns:

type: Rect

affineTransformTranslate
(
  • t
  • tx
  • ty
)
AffineTransform

Create a new affine transformation with a base transformation matrix and a translation based on it.

name type description
t AffineTransform

The base affine transform object.

tx Number

The translation on x axis.

ty Number

The translation on y axis.

returns:

affineTransformScale
(
  • t
  • sx
  • sy
)
AffineTransform

Create a new affine transformation with a base transformation matrix and a scale based on it.

name type description
t AffineTransform

The base affine transform object.

sx Number

The scale on x axis.

sy Number

The scale on y axis.

returns:

affineTransformRotate
(
  • aTransform
  • anAngle
)
AffineTransform

Create a new affine transformation with a base transformation matrix and a rotation based on it.

name type description
aTransform AffineTransform

The base affine transform object.

anAngle Number

The angle to rotate.

returns:

affineTransformConcat
(
  • t1
  • t2
)
AffineTransform

Concatenate a transform matrix to another and return the result:
t' = t1 * t2

name type description
t1 AffineTransform

The first transform object.

t2 AffineTransform

The transform object to concatenate.

returns:

type: AffineTransform

The result of concatenation.

affineTransformConcatIn
(
  • t1
  • t2
)
AffineTransform

Concatenate a transform matrix to another
The results are reflected in the first matrix.
t' = t1 * t2

name type description
t1 AffineTransform

The first transform object.

t2 AffineTransform

The transform object to concatenate.

returns:

type: AffineTransform

The result of concatenation.

affineTransformEqualToTransform
(
  • t1
  • t2
)
Boolean

Return true if an affine transform equals to another, false otherwise.

name type description
t1 AffineTransform
t2 AffineTransform

returns:

type: Boolean

affineTransformInvert
(
  • t
)
AffineTransform

Get the invert transform of an AffineTransform object.

name type description
t AffineTransform

returns:

type: AffineTransform

The inverted transform object.

There are no methods that match your current filter settings. You can change your filter settings in the index section on this page. index