メインコンテンツまでスキップ

Interface: Scale

Defined in: scales.ts:18

How a value is distributed across the travel of a control.

normalize and denormalize are inverses of each other: the position is 0 at min and 1 at max, and everything in between is up to the scale.

min and max are arguments rather than baked into the scale, so a scale holds no state and can be a module level constant. Passing the same object on every render therefore costs nothing.

Example​

exponentialScale.denormalize(0.5, 20, 20000) // 632.45…

Properties​

denormalize​

denormalize: (position, min, max) => number;

Defined in: scales.ts:22

Position on the travel, 0-1, back to a value.

Parameters​

ParameterType
positionnumber
minnumber
maxnumber

Returns​

number


normalize​

normalize: (value, min, max) => number;

Defined in: scales.ts:20

Value to its position on the travel, 0-1.

Parameters​

ParameterType
valuenumber
minnumber
maxnumber

Returns​

number