Skip to main content

$clamp

The $clamp operator constrains a value within minimum and maximum bounds.

Input

  • An array containing exactly three numeric values: the value to clamp, the minimum bound, and the maximum bound

Output

  • The clamped value within the specified bounds

Examples

Clamp Value Within Range

Result: 10 (since 15 is above the max of 10, it gets clamped to 10)

Clamp Value Below Range

Result: 0 (since -5 is below the min of 0, it gets clamped to 0)

Value Within Range

Result: 5 (since 5 is within the range, it remains unchanged)

From Fields

Result: The value field clamped between the min and max field values