Cocos Creator API

0.7.1

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

Size

Module: cc

cc.Size is the class for size object, please do not use its constructor to create sizes, use cc.size() alias function instead. It will be deprecated soon, please use cc.Vec2 instead

Properties

ZERO Size static

return a Size object with width = 0 and height = 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

clone ( ) Size

returns:

type: Size

equals
(
  • other
)
Boolean

name type description
other Size

returns:

type: Boolean

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

name type description
to Rect
ratio Number

the interpolation coefficient.

out optional Size

optional, the receiving vector.

returns:

type: Size

toString ( ) String

returns:

type: String

size
(
  • w
  • h
)
Size

Helper function that creates a cc.Size. Please use cc.p or cc.v2 instead, it will soon replace cc.Size.

name type description
w Number | Size

width or a size object

h Number

height

returns:

type: Size

examples:

-----
var size1 = cc.size();
var size2 = cc.size(100,100);
var size3 = cc.size(size2);
var size4 = cc.size({width: 100, height: 100});

sizeEqualToSize
(
  • size1
  • size2
)
Boolean

Check whether a point's value equals to another.

name type description
size1 Size
size2 Size

returns:

type: Boolean

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