Skip to content

Boids API

Boids

Extends Effect.

Factory Function

typescript
createBoids(config?: BoidsConfig)

Methods

See Effect for the full method reference: mount(), start(), pause(), resume(), configure(), withFade(), and destroy().


BoidsConfig

typescript
interface BoidsConfig {
    count?: number;
    speed?: number;
    separation?: number;
    alignment?: number;
    cohesion?: number;
    color?: string;
    size?: number;
    scale?: number;
}
PropertyTypeDefaultDescription
countnumber80Number of boids in the flock. Halved on small screens.
speednumber1Overall movement speed multiplier.
separationnumber1Strength of the separation steering rule (avoid crowding).
alignmentnumber1Strength of the alignment steering rule (match neighbors).
cohesionnumber1Strength of the cohesion steering rule (move toward group).
colorstring'#44aaff'CSS color string for boid shapes.
sizenumber6Boid triangle size in pixels.
scalenumber1Scales boid sizes proportionally.