map()
Convert a number from one range to another, including values outside the source range.
map(value, minValue, maxValue, minResult, maxResult)
For example, 5 in the range 0 to 10 maps to 50 in the range 0 to 100. The number may lie outside the source range: it is then carried just as far outside the destination range (for example, 15 in the range 0 to 10 maps to 150 in the range 0 to 100). To require the number to stay within the source range instead, use mapValue().
Parameters
map(value, minValue, maxValue, minResult, maxResult)
| Parameter | Type | Default | Description |
|---|---|---|---|
value |
int or float |
required | The number to convert. |
minValue |
int or float |
required | The low end of the source range (inclusive). |
maxValue |
int or float |
required | The high end of the source range (inclusive). |
minResult |
int or float |
required | The low end of the destination range (inclusive). |
maxResult |
int or float |
required | The high end of the destination range (inclusive). |
Returns
return mappedValue
| Value | Type | Description |
|---|---|---|
| mappedValue | int or float |
The number's matching place relative to the destination range. It is an int if minResult is an int, otherwise a float. |