@tempots/std
wrapCircular() function
Similar to wrap
, it works for numbers between 0 and max
.
Signature:
wrapCircular: (v: number, max: number) => number
Parameters
Parameter |
Type |
Description |
---|---|---|
v |
number |
The value to wrap. |
max |
number |
The maximum value of the range. |
Returns: number
The wrapped value.
Example
wrapCircular(5, 10) // returns 5
wrapCircular(15, 10) // returns 5
wrapCircular(-5, 10) // returns 5