Cocos Creator API

1.4.x

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

Vec2

Extends ValueType
Module: cc

Representation of 2D vectors and points.

Properties

ONE Vec2 static

return a Vec2 object with x = 1 and y = 1.

ZERO Vec2 static

return a Vec2 object with x = 0 and y = 0.

UP Vec2 static

return a Vec2 object with x = 0 and y = 1.

RIGHT Vec2 static

return a Vec2 object with x = 1 and y = 0.

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

Methods

Vec2
(
  • [x =0]
  • [y =0]
)
Vec2

Constructor see Cc/vec2:method or cc.p

name type description
x optional number 0
y optional number 0

returns:

type: Vec2

clone ( ) Vec2

clone a Vec2 value

returns:

type: Vec2

set
(
  • newValue
)
Vec2

TODO

name type description
newValue Vec2

!#en new value to set. !#zh 要设置的新值

  • x number optional , default: 0
  • y number optional , default: 0

returns:

type: Vec2

returns this

equals
(
  • other
)
Boolean

TODO

name type description
other Vec2

!#en Constructor see Cc/vec2:method or cc.p !#zh 构造函数,可查看 Cc/vec2:method 或者 cc.p

  • x number optional , default: 0
  • y number optional , default: 0

returns:

type: Boolean

toString ( ) string

TODO

returns:

type: string

lerp
(
  • to
  • ratio
  • [out ]
)
Vec2

TODO

name type description