Skip to content

textmode.js / Textmodifier / clamp

Method: clamp() ​

ts
clamp(
   value, 
   low, 
   high): number;

Clamp a value between a minimum and maximum range.

Alias for constrain.

Parameters ​

ParameterTypeDescription
valuenumberValue to clamp.
lownumberMinimum allowable value.
highnumberMaximum allowable value.

Returns ​

number

The clamped value.

Example ​