ReferenceSamplersFunction
gradient()
Picks random colors from a gradient.
function gradient( colors: (string | Color)[] | GradientStop[],): SamplerFn<Color>;Creates a sampler that picks a random color from a gradient.
Each particle gets a random position along the gradient, with every position being equally likely. This means that the colors appear in the proportions the gradient gives them. Plain colors are spaced evenly, and one can use stops to give some colors a higher chance than others.
Parameters
Section titled “Parameters”colors(string|Color)[] |GradientStop[]The colors, evenly spaced, or explicit stops.
Returns
Section titled “Returns”Throws
Section titled “Throws”- PartyJSError
If no colors or stops are given, if a stop’s offset is outside
[0, 1], or if a color string is invalid.