misc Class

Module: cc Parent Module: cc

misc utilities

Index

Methods
  • clampf Clamp a value between from and to.
  • clamp01 Clamp a value between 0 and 1.
  • lerp Linear interpolation between 2 numbers, the ratio sets how much it is biased to each end
  • degreesToRadians converts degrees to radians
  • radiansToDegrees converts radians to degrees

Details

Methods

clampf

Clamp a value between from and to.

meta description
Returns Number
Defined in cocos2d/core/utils/misc.js:157
Parameters
Examples
var v1 = cc.misc.clampf(20, 0, 20); // 20;
var v2 = cc.misc.clampf(-1, 0, 20); //  0;
var v3 = cc.misc.clampf(10, 0, 20); // 10;
clamp01

Clamp a value between 0 and 1.

meta description
Returns Number
Defined in cocos2d/core/utils/misc.js:183
Parameters
Examples
var v1 = cc.misc.clamp01(20);  // 1;
var v2 = cc.misc.clamp01(-1);  // 0;
var v3 = cc.misc.clamp01(0.5); // 0.5;
lerp

Linear interpolation between 2 numbers, the ratio sets how much it is biased to each end

meta description
Returns Number
Defined in cocos2d/core/utils/misc.js:198
Parameters
Examples

```Not found for the example path: temp-src/engine/docs/utils/api/engine/docs/cocos2d/core/platform/CCMacro/lerp.js

degreesToRadians

converts degrees to radians

meta description
Returns Number
Defined in cocos2d/core/utils/misc.js:211
Parameters
radiansToDegrees

converts radians to degrees

meta description
Returns Number
Defined in cocos2d/core/utils/misc.js:221
Parameters

results matching ""

    No results matching ""