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

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: 30 November, 2023