Clamp the value between two points. Ensures that value is between the minimum and maximum of the provided scope.
value
scope
The value to be clamped.
The range to clamp the value between, defaulting to [0, 1].
clamp(1.5, [0.1, 0.9]); // => 0.9clamp(0.001, [0.1, 0.9]); // => 0.1clamp(0.5, [0, 1]); // => 0.5 Copy
clamp(1.5, [0.1, 0.9]); // => 0.9clamp(0.001, [0.1, 0.9]); // => 0.1clamp(0.5, [0, 1]); // => 0.5
Clamp the value between two points. Ensures that
value
is between the minimum and maximum of the providedscope
.