Clamps number within the inclusive range specified by start and end.
number
start
end
The number to clamp.
The start of the range.
The end of the range.
Returns the clamped number.
clamp(0, 0, 10)// => 0clamp(15, 0, 10)// => 10clamp(-5, 0, 10)// => 0 Copy
clamp(0, 0, 10)// => 0clamp(15, 0, 10)// => 10clamp(-5, 0, 10)// => 0
Clamps
number
within the inclusive range specified bystart
andend
.