Skip to main content

functions/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 than min, then it will be clamped to min.
  • If num is greater than max, then it will be clamped to max.

Parameters

ParameterType
numnumber
minnumber
maxnumber

Returns

number

Defined in

functions/math.ts:13