linearCombinationOfColors MethodStatic

Compute the linear combination s of the colors and scales.

  • The result is another color if the scales are in [0,1] and sum to 1.

linearCombinationOfColors(colors: number[], scales: number[]): number

@returns s = sum(c_i * s_i), where i ranges from 0 to min(colors.length, scales.length).

Parameter Type Description
colors number[] array of colors c_i (rgba in first four bytes).
scales number[] array of scales s_i. For best results, scales should have the same length as colors.

Returns - number

s = sum(c_i * s_i), where i ranges from 0 to min(colors.length, scales.length).

Defined in

Last Updated: 14 November, 2024