Boids

A living murmuration of hundreds of flocking agents drawn as crisp arrows, streaks, dots or glowing comets — separation, alignment and cohesion drive fluid, splitting-and-merging ribbons, agents flash toward an excited color when scattered, and the cursor acts as an attractor or a predator

Props

  • colorA

    Color of agents cruising calmly with the flock

    Type
    string
    Default
    #8ec5ff
  • colorB

    Color agents flash toward when agitated — scattering from the predator cursor or banking through a hard turn

    Type
    string
    Default
    #ff7ad9
  • colorSpace

    Color space for the rest→excited color ramp

    Type
    "linear" | "oklch" | "oklab" | "hsl" | "hsv" | "lch"
    Default
    oklab
  • agentShape

    What each agent is drawn as — a hard-edged arrow, streak or square pointing along its heading, a plain dot, or a soft glowing comet

    Type
    "arrow" | "streak" | "dot" | "square" | "glow"
    Default
    arrow
  • count

    Number of flocking agents

    Type
    number
    Default
    2000
  • speed

    Overall cruising speed of the flock

    Type
    number
    Default
    2
  • seed

    Re-rolls the flock's starting formation — each value spawns the murmuration in a different arrangement

    Type
    number
    Default
    0
  • size

    Size of each agent

    Type
    number
    Default
    1.5
  • trails

    How long each agent's motion trail persists — 0 draws crisp agents, 1 leaves long ribbons

    Type
    number
    Default
    0
  • separation

    How strongly agents steer away from crowding their neighbours

    Type
    number
    Default
    1.7
  • alignment

    How strongly agents match their neighbours' heading — the driver of coherent murmuration ribbons

    Type
    number
    Default
    1.5
  • cohesion

    How strongly agents steer toward the local center of the flock

    Type
    number
    Default
    1
  • perception

    How far each agent can sense its neighbours (in screen heights) — larger sees bigger, smoother flocks

    Type
    number
    Default
    0.12
  • cursorMode

    How the flock reacts to the cursor

    Type
    "none" | "attract" | "repel"
    Default
    repel
  • cursorStrength

    Strength of the cursor's pull or push on the flock

    Type
    number
    Default
    1.5

Usage

<Shader>
  <Boids />
</Shader>