Lab · Canvas 2D

Flow Field

Particles drift along a field of smoothly changing angles, leaving fading trails. Move your cursor across the canvas to stir them.

How it works

Each particle reads an angle from a function of its position and time (layered sine waves standing in for Perlin noise), takes a small step in that direction, and draws a line segment. Painting a translucent background each frame turns the segments into fading trails. About 2 KB of JavaScript, no dependencies.