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
  • ZERO Size return a Size object with width = 0 and height = 0.
  • width Number
  • height Number
Methods

Details

Properties

ZERO

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

meta description
Type Size
Defined in cocos2d/core/value-types/size.ts:55
width
meta description
Type Number
Defined in cocos2d/core/value-types/size.ts:66
height
meta description
Type Number
Defined in cocos2d/core/value-types/size.ts:70

Methods

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

TODO

meta description
Returns Size
Defined in cocos2d/core/value-types/size.ts:87
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/size.ts:100
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/size.ts:116
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/size.ts:149
Examples
var a = new cc.size(10, 10);
a.toString();// return "(10.00, 10.00)";

results matching ""

    No results matching ""