Clamp

The clamp function (clamp) restricts a number to a specified range between a minimum and maximum value. The minimum and maximum values are automatically swapped if they are reversed.

With vec2 inputs, this applies separately to the X and Y components.

Interface

Inputs

ParameterDetailsPossible Types
Value

The number to be clamped, which is restricted to the range between the minimum and maximum values.

Primary Input

Integer[]
Integer
Number[]
Number
String[]
String
Vec2[]
Vec2
Min

The left (smaller) side of the range. The output is never less than this number.

Default: 0

Integer[]
Integer
Number[]
Number
String[]
String
Vec2[]
Vec2
Max

The right (greater) side of the range. The output is never greater than this number.

Default: 1

Integer[]
Integer
Number[]
Number
String[]
String
Vec2[]
Vec2

Outputs

ProductDetailsPossible Types
Result

The value produced by the node operation.

Primary Output

Number
Number[]
Integer
Integer[]
String
String[]
Vec2
Vec2[]