map Value
fun Float.mapValue( inMin: Float, inMax: Float, outMin: Float, outMax: Float): Float
Content copied to clipboard
Re-maps a number from one range to another. That is, a value of inMin would get mapped to outMin, a value of inMax to outMax, values in-between to values in-between, etc.
For example, inMin = 0, inMax = 1, outMin = 0, outMin = 255 - In this case, the input value must be between 0 and 1, and it will be mapped to an output between 0 and 255. If the value input is 0.5, output is 127.5. In this same example, a value of 2 would result in 510, since it is double according to the established values.
Parameters
in Min
The lower bound of the value’s current range.
in Max
The upper bound of the value’s current range.
out Min
The lower bound of the value’s target range.
out Max
The upper bound of the value’s target range.