JavaScript
A5.u.mathwrap Method
Syntax
A5.u.math.wrap(value,low,high)
Arguments
- valuenumber
The number to wrap.
- lownumber
The low end of the wrapping range.
- highnumber
The high end of the wrapping range.
Returns
- valuenumber
The resulting number.
Description
Wrap a number so that it fits in the given range.
Discussion
The A5.u.math.wrap method will wrap a number so that it is inside of the given range. This can be useful for when doing math on wrapping values such as an angle.
Example
var angIn = 730; var angWrap = A5.u.math.wrap(angIn,0,360); // angWrap = 10 angIn = -82; angWrap = A5.u.math.wrap(angIn,0,360); // angWrap = 278