Skip to content

Function.mapRange

github-actions[bot] edited this page Nov 18, 2026 · 13 revisions

umt / mapRange

Function: mapRange()

mapRange(value, inMin, inMax, outMin, outMax): number

Defined in: Math/mapRange.ts:16

Maps a value from one range to another without clamping

Parameters

value

number

Value in the input range

inMin

number

Start of the input range

inMax

number

End of the input range

outMin

number

Start of the output range

outMax

number

End of the output range

Returns

number

The mapped value, or outMin when inMin equals inMax

Examples

mapRange(5, 0, 10, 0, 100); // 50
mapRange(0.5, 0, 1, 10, 20); // 15
mapRange(15, 0, 10, 0, 100); // 150

API

Classes

Interfaces

Type Aliases

Variables

Functions

Clone this wiki locally