math.Remap

From Garry's Mod
Jump to: navigation, search
 math.Remap( )

Contents

Description

Remaps the value from one range to another

Arguments

number value

The value

Arguments

number inMin

The minimum of the initial range

Arguments

number inMax

The maximum of the initial range

Arguments

number outMin

The minimum of new range

Arguments

number outMax

The maximum of new range

Returns

number

The number in the new range

Examples

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
Personal tools
Navigation