normalize

Commons
stable

Re-maps a number from one numeric range to another. First normalises to [0, 1] relative to the current scale, then projects onto the new scale.

API

Signature

Signature TypeScript complète, extraite du fichier util.

typescript

API

Paramètres

Paramètres d'entrée acceptés par cet util.

number
requis
number
The value to re-map.
currentScaleMin
requis
number
The lower bound of the input range.
currentScaleMax
requis
number
The upper bound of the input range.
newScaleMin
number
0
The lower bound of the output range. Defaults to 0.
newScaleMax
number
1
The upper bound of the output range. Defaults to 1.

API

Valeur de retour

La valeur retournée par cet util.

The re-mapped value in [newScaleMin, newScaleMax].

Usage

Exemples

Extraits de code prêts à coller.

Map a slider value to an opacity

typescript