Given a number and min and max values, restrict the number to the range specified.
number
min
max
clamp(5, 1, 10); // returns 5clamp(5, 2, 4); // returns 4clamp(0, -4, -3); // returns -3 Copy
clamp(5, 1, 10); // returns 5clamp(5, 2, 4); // returns 4clamp(0, -4, -3); // returns -3
0.0.5
Given a
numberandminandmaxvalues, restrict the number to the range specified.