ReferenceSamplersFunction
cone()
Creates velocities in a direction, with some random spread.
function cone( angle: number, deviation: number, speed: Sampler<number>,): SamplerFn<Vec3>;Creates a sampler for velocities that point in a direction, with some deviation.
Angles are in degrees, measured counter-clockwise from +x in particle space, so 0 points right and 90 points up.
The angle is chosen with spread(), so a burst fans out evenly across the cone. A deviation
of 0 sends every particle in exactly the same direction.
Parameters
Section titled “Parameters”anglenumberThe direction of the cone’s center, in degrees.
deviationnumberHow far a particle’s direction may lie from
angle, in degrees, in either direction.speedSampler<number>The speed, in px/s. Can itself be a sampler.
Returns
Section titled “Returns”Example
Section titled “Example”// Upwards, fanning out 30° to either side, with constant speed.cone(90, 30, 400);
// Straight down, at varying speeds.cone(-90, 0, range(60, 120));