# Class MathUtil

数学工具

#### Hierarchy

- MathUtil

- Defined in assets/core/utils/MathUtil.ts:2

#####
Index

### Constructors

constructor

### Properties

deg2Rad
rad2Deg

### Methods

angleTowards
clamp
lerp
lerpAngle
probability
progress
sign

## Constructors

### constructor

- new MathUtil(): MathUtil

- #### Returns MathUtil

## Properties

### `Static` deg2Rad

deg2Rad: number = ...

角度转弧度

- Defined in assets/core/utils/MathUtil.ts:6

### `Static` rad2Deg

rad2Deg: number = ...

弧度转角度

- Defined in assets/core/utils/MathUtil.ts:11

## Methods

### `Static` angleTowards

- angleTowards(current: number, target: number, speed: number): number

- 按一定的速度从一个角度转向令一个角度

  #### Parameters

  - ##### current: number

    当前角度

  - ##### target: number

    目标角度

  - ##### speed: number

    速度

  #### Returns number

  - Defined in assets/core/utils/MathUtil.ts:83

### `Static` clamp

- clamp(value: number, minLimit: number, maxLimit: number): number

- 获取方位内值，超过时获取对应边界值

  #### Parameters

  - ##### value: number

    值

  - ##### minLimit: number

    最小值

  - ##### maxLimit: number

    最大值

  #### Returns number

  - Defined in assets/core/utils/MathUtil.ts:111

### `Static` lerp

- lerp(numStart: number, numEnd: number, t: number): number

- 插值

  #### Parameters

  - ##### numStart: number

    开始数值

  - ##### numEnd: number

    结束数值

  - ##### t: number

    时间

  #### Returns number

  - Defined in assets/core/utils/MathUtil.ts:44

### `Static` lerpAngle

- lerpAngle(current: number, target: number, t: number): number

- 角度插值

  #### Parameters

  - ##### current: number

  - ##### target: number

  - ##### t: number

    时间

  #### Returns number

  - Defined in assets/core/utils/MathUtil.ts:61

### `Static` probability

- probability(value: number): boolean

- 获得一个值的概率

  #### Parameters

  - ##### value: number

    值

  #### Returns boolean

  - Defined in assets/core/utils/MathUtil.ts:127

### `Static` progress

- progress(start: number, end: number, t: number): number

- 随时间变化进度值

  #### Parameters

  - ##### start: number

    初始值

  - ##### end: number

    结束值

  - ##### t: number

    时间

  #### Returns number

  - Defined in assets/core/utils/MathUtil.ts:34

### `Static` sign

- sign(x: number): 0 | 1 | -1

- 获得随机方向

  ### Returns

  #### Parameters

  - ##### x: number

    1为左，1为右

  #### Returns 0 | 1 | -1

  - Defined in assets/core/utils/MathUtil.ts:18

Generated using TypeDoc