Cocos Creator API

1.5.x

Cocos Creator is the game engine for the future.

Size

Module: cc
Parent Module: cc

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

Properties

width Number

height Number

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

constructor
(
  • width
  • [height ]
)

name type description
width Number | Size
height optional Number

clone ( ) Size

TODO

returns:

type: Size

examples:

var a = new cc.size(10, 10);
a.clone();// return Size {width: 0, height: 0};

equals
(
  • other
)
Boolean

TODO

name type description
other Size

returns:

type: Boolean

examples:

var a = new cc.size(10, 10);
a.equals(new cc.size(10, 10));// return true;

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

TODO

name type description
to Rect
ratio Number

the interpolation coefficient.

out optional Size

optional, the receiving vector.

returns:

type: Size

examples:

var a = new cc.size(10, 10);
var b = new cc.rect(50, 50, 100, 100);
update (dt) {
   // method 1;
   var c = a.lerp(b, dt * 0.1);
   // method 2;
   a.lerp(b, dt * 0.1, c);
}

toString ( ) String

TODO

returns:

type: String

examples:

var a = new cc.size(10, 10);
a.toString();// return "(10.00, 10.00)";

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