Function: stretchArrayToLength()
stretchArrayToLength<
T>(array,length):T[]
Defined in: src/utils/iterables.ts:163
Resample a numeric array up to length by index duplication (favours earlier
elements). Mirrors ManimCE stretch_array_to_length.
Type Parameters
T
T
Parameters
array
readonly T[]
length
number
Returns
T[]
Throws
if length is shorter than the input (matches ManimCE, which raises).
Example
stretchArrayToLength([1, 2], 4); // [1, 1, 2, 2]