misc 类型

模块: cc父模块: cc

misc utilities

索引

方法
  • clampf 限定浮点数的最大最小值。
  • clamp01 限定浮点数的取值范围为 0 ~ 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

方法

clampf

限定浮点数的最大最小值。数值大于 max_inclusive 则返回 max_inclusive。数值小于 min_inclusive 则返回 min_inclusive。否则返回自身。

metadescription
返回Number
定义于cocos2d/core/utils/misc.js:157
参数列表
示例
  1. var v1 = cc.misc.clampf(20, 0, 20); // 20;
  2. var v2 = cc.misc.clampf(-1, 0, 20); // 0;
  3. var v3 = cc.misc.clampf(10, 0, 20); // 10;
clamp01

限定浮点数的取值范围为 0 ~ 1 之间。

metadescription
返回Number
定义于cocos2d/core/utils/misc.js:183
参数列表
示例
  1. var v1 = cc.misc.clamp01(20); // 1;
  2. var v2 = cc.misc.clamp01(-1); // 0;
  3. 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

metadescription
返回Number
定义于cocos2d/core/utils/misc.js:198
参数列表
示例

```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

metadescription
返回Number
定义于cocos2d/core/utils/misc.js:211
参数列表
radiansToDegrees

converts radians to degrees

metadescription
返回Number
定义于cocos2d/core/utils/misc.js:221
参数列表