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.

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.

More optionsFewer options

Speed

How fast the birds fly; slow is calmer behind text.

Rings one bird and links it to the neighbors it follows.

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.

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 GitHub

What it is

The full explanation is in README.md.

Good for

  • Hero sections
  • Nature and travel sites
  • Art and game pages
  • Dark backgrounds

Avoid on

  • Long reading pages
  • Busy layouts