Clamp
Last updated
Last updated
Restricts a value to stay within a specified minimum and maximum range. If the value is below the minimum, it returns the minimum; if it's above the maximum, it returns the maximum; otherwise, it returns the original value.
value
The number to clamp
Number
No
min
The lower boundary
Number
No
max
The upper boundary
Number
No
value
The clamped result
Number
Drag the Clamp node into your graph.
Set "value" to the number you want to restrict (e.g., 12).
Set "min" to the lower bound (e.g., 5).
Set "max" to the upper bound (e.g., 10).
Run the graph—with the example values, your output will be 10 (since 12 exceeds the max).
Make sure min is less than max, or the clamp will always return the min value.
Clamp is useful for ensuring values stay within valid ranges before passing to other nodes.
For colors and other non-numeric values, use specialized constraint nodes instead.
Boundary Enforcement: Ensure values stay within acceptable limits.
Input Validation: Sanitize user inputs to prevent extreme values.
Responsive Sizing: Limit element sizes between minimum and maximum constraints.
Animation Control: Prevent objects from moving outside defined areas.
: For transforming values from one range to another.