Math
Helper functions that have to do with math.
Functions
clamp()
function clamp(
num,
min,
max): number
Helper function to normalize a number, ensuring that it is within a certain range.
- If
num
is less thanmin
, then it will be clamped tomin
. - If
num
is greater thanmax
, then it will be clamped tomax
.
Parameters
Parameter | Type |
---|---|
num | number |
min | number |
max | number |
Returns
number