Function clamp
pub fn clamp(value: &Variant, min: &Variant, max: &Variant) -> VariantExpand description
Clamps the value, returning a Variant not less than min and not more than max. Any values that can be compared with the less than and greater than operators will work.
var a = clamp(-10, -1, 5)
# a is -1
var b = clamp(8.1, 0.9, 5.5)
# b is 5.5Note: For better type safety, use [method clampf], [method clampi], clamp, clamp, clamp, clamp, clamp, clamp, or clamp (not currently supported by this method).
Note: When using this on vectors it will not perform component-wise clamping, and will pick min if value < min or max if value > max. To perform component-wise clamping use the methods listed above.