06.21 · 3D & Advanced
Flocking
Birds swirl and turn together as one flock. Best for calm backgrounds.
Watch it
It moves by itself, and the birds swerve away from your pointer or finger. Pause it to look closely, or turn on slow motion.
One bird (orange) sees only the birds in its ring (the rest fade) and follows three pulls: keep apart (red), fly the same way (blue) and stay close (green). Every bird does the same.
On their own: the same birds with no flock rules fly straight and scatter. As a flock: each follows its neighbors, so groups form and turn together.
Try it
Change a setting and see the difference as it moves.
Flock size
How many birds fly; phones show about half as many.
How close they fly
Tight flocks bunch up and turn together; loose ones spread out.
Birds swerve away from your pointer or finger.
Copy the prompt
Paste it into an AI assistant such as ChatGPT, Claude or Cursor to build this in your own project.
Add a flock of birds to [the section you want it behind]. Draw each bird as a small arrowhead on a canvas, pointing the way it flies. Each bird sees only the birds near it and follows three rules: keep a little room from the closest ones, turn the way its neighbors fly, and drift toward their middle, so the flock swirls and turns as one. Turn birds back before they reach the edges, and move them by the time since the last frame so the speed is the same on every screen. Use fewer birds on phones. When the settings include it, birds swerve away from the pointer or a finger. If the visitor has reduced motion turned on, show the flock still. Match the settings listed below.
Your settings
Replace the words in brackets with your own element. Your settings are added at the end.
Free and open source. If this helped, a star on GitHub helps other people find it.
Star on GitHubWhat it is
The full explanation is in README.md.