Skip to main content

Function: clamp()

clamp(value, min, max): number

Defined in: math/clamp.ts:9

Clamps a number to be within a specified range.

Parameters

value

number

The number to clamp.

min

number

The minimum value to clamp to.

max

number

The maximum value to clamp to.

Returns

number

The clamped value, which will be within the range [min, max].