Garry's Mod Wiki

math.Remap

  number math.Remap( number value, number inMin, number inMax, number outMin, number outMax )

Description

Remaps the value from one range to another

Arguments

1 number value
The value
2 number inMin
The minimum of the initial range
3 number inMax
The maximum of the initial range
4 number outMin
The minimum of new range
5 number outMax
The maximum of new range

Returns

1 number
The number in the new range

Example

Example usage, converts a value from range 0-1, to range 0-255.

print( math.Remap( 0.5, 0, 1, 0, 255 ) )
Output: 127.5