fn is expected to map (0..1) => (0..1), such as an easing function. The input to the
fn is the relative position of an element. Thus the first element will be 0, the middle 0.5 and so on.
The output of fn is then multiplied by the original value.
In the below example (which is also the default if fn is not specified), the relative position is
how values are weighted:
Applies a function
fnto the elements of an array, weighting them based on their relative position.fnis expected to map (0..1) => (0..1), such as an easing function. The input to thefnis the relative position of an element. Thus the first element will be 0, the middle 0.5 and so on. The output offnis then multiplied by the original value.In the below example (which is also the default if
fnis not specified), the relative position is how values are weighted:Throws TypeError if
datais not an array or for any element not a number.