Size
Class
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
Methods
constructor
clone
TODOequals
TODOlerp
TODOtoString
TODO
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
other
Size
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
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)";