·
1 min read
Flow Fields: An Interactive Playground
The particle animation that used to be this blog's background — now interactive with tweakable parameters.
This was originally the background animation for this blog. I liked it too much to just delete it, so here it is as an interactive playground. Drag sliders to change the behavior in real time.
How It Works
Flow fields use simplex noise to generate a smooth vector field across 2D space. Each point in the field has a direction, and particles follow that direction as they move.
The basic loop:
- Sample noise at each particle’s position to get an angle
- Apply the angle as a force to the particle’s velocity
- Add mouse repulsion when the cursor is nearby
- Move the particle, wrap around edges
- Fade the background slightly each frame to create trails
The noise field evolves slowly over time (the third dimension of simplex3), so the flow pattern shifts gradually even without interaction.