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 cocos2d/core/value-types/CCSize.js:64
height
meta description
Type Number
Defined in cocos2d/core/value-types/CCSize.js:67
ZERO

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

meta description
Type Size
Defined in cocos2d/core/value-types/CCSize.js:71

Methods

constructor
meta description
Defined in cocos2d/core/value-types/CCSize.js:48
Parameters
clone

TODO

meta description
Returns Size
Defined in cocos2d/core/value-types/CCSize.js:85
Examples
var a = new cc.size(10, 10);
a.clone();// return Size {width: 0, height: 0};
equals

TODO

meta description
Returns Boolean
Defined in cocos2d/core/value-types/CCSize.js:98
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 cocos2d/core/value-types/CCSize.js:114
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 cocos2d/core/value-types/CCSize.js:141
Examples
var a = new cc.size(10, 10);
a.toString();// return "(10.00, 10.00)";

results matching ""

    No results matching ""