Value to clamp
value (inclusive)
value (inclusive)
Clamped value
// 0.5 - just fine, within default of 0 to 1
clamp(0.5);
// 1 - above default max of 1
clamp(1.5);
// 0 - below range
clamp(-50, 0, 100);
// 50 - within range
clamp(50, 0, 50);
For clamping integer ranges, consider clampIndex
For clamping { x, y }
points, consider Geometry.Points.clamp.
For clamping bipolar values: Bipolar.clamp
Clamps a value between min and max (both inclusive) Defaults to a 0-1 range, useful for percentages.