Size Class

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.

Index

Properties
  • width Number
  • height Number
  • ZERO Size return a Size object with width = 0 and height = 0.
Methods

Details

Properties

width
meta description
Type Number
Defined in https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/value-types/CCSize.js:63
height
meta description
Type Number
Defined in https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/value-types/CCSize.js:66
ZERO

return a Size object with width = 0 and height = 0.

meta description
Type Size
Defined in https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/value-types/CCSize.js:70

Methods

constructor
meta description
Defined in https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/value-types/CCSize.js:47
Parameters
clone

TODO

meta description
Returns Size
Defined in https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/value-types/CCSize.js:84
Examples
var a = new cc.size(10, 10);
a.clone();// return Size {width: 0, height: 0};
equals

TODO

meta description
Returns Boolean
Defined in https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/value-types/CCSize.js:97
Parameters
Examples
var a = new cc.size(10, 10);
a.equals(new cc.size(10, 10));// return true;
lerp

TODO

meta description
Returns Size
Defined in https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/value-types/CCSize.js:113
Parameters
  • to Rect
  • ratio Number the interpolation coefficient.
  • out Size optional, the receiving vector.
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

TODO

meta description
Returns String
Defined in https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/value-types/CCSize.js:140
Examples
var a = new cc.size(10, 10);
a.toString();// return "(10.00, 10.00)";

results matching ""

    No results matching ""