Clamp a vector by min and max limits.
Target object.
Minimum vector.
Maximum vector.
Error - When a computed component is NaN or non-finite.
clamp({ x: 5, y: -5 }, -1, 1); // -> { x: 1, y: -1 } Copy
clamp({ x: 5, y: -5 }, -1, 1); // -> { x: 1, y: -1 }
Destination object to store the values.
const result = { x: 0, y: 0 };clamp({ x: 5, y: -5 }, -1, 1, result); // result -> { x: 1, y: -1 } Copy
const result = { x: 0, y: 0 };clamp({ x: 5, y: -5 }, -1, 1, result); // result -> { x: 1, y: -1 }
Clamp a vector by min and max limits.