Skip to content

textmode.synth.js / ModulatedArray / fit

Method: fit()

ts
fit(low, high): ModulatedArray;

Fit (remap) array values to a new range.

Takes the minimum and maximum values in the array and linearly maps them to the specified low and high values. All intermediate values are scaled proportionally. The original array is not modified.

Preserves any modulation settings (speed, smooth, ease, offset) from the original array.

Parameters

ParameterTypeDescription
lownumberNew minimum value
highnumberNew maximum value

Returns

ModulatedArray

A new ModulatedArray with remapped values

Example