A generative art application featuring flocking arrows that simulate natural flocking behavior using the Boids algorithm.
This Processing sketch creates a mesmerizing display of arrow-shaped objects that move together in a flock, similar to birds or fish in nature. The arrows follow three simple rules:
- Separation - Avoid crowding nearby arrows
- Alignment - Steer towards the average heading of nearby arrows
- Cohesion - Move towards the average position of nearby arrows
- 🎨 Colorful arrows with trailing effects
- 🖱️ Interactive mouse controls
- ✨ Beautiful emergent flocking behavior
- 🎯 Dynamic adding/removal of arrows
- 📸 Screenshot capability
| Input | Action |
|---|---|
| Move Mouse | Arrows avoid the cursor |
| Left Click | Attract arrows to cursor |
| Right Click | Strongly repel arrows from cursor |
| SPACE | Add 10 more arrows to the flock |
| R | Reset to default flock size (100 arrows) |
| S | Save screenshot |
- Open
FlockingArrows.pdein Processing - Click the Run button
- Move your mouse to interact with the flock!
- Algorithm: Boids (Craig Reynolds, 1986)
- Default flock size: 100 arrows
- Canvas size: 1200x800 pixels
- Language: Processing (Java mode)
You can adjust these parameters in the code:
- Arrow count: Change the loop in
setup()(line 21) - Canvas size: Modify
size()insetup()(line 18) - Flocking weights: Adjust multipliers in
flock()method (Arrow.pde lines 31-33) - Arrow appearance: Modify
arrowSizeandarrowColorin Arrow constructor
Current flocking behavior weights:
- Separation: 1.5x
- Alignment: 1.0x
- Cohesion: 1.0x
- Mouse avoidance: 1.0x
- Mouse attraction: 0.5x (when clicking)
- Mouse repulsion: 2.0x (when right-clicking)
Based on Craig Reynolds' Boids algorithm (1986) Implementation inspired by Daniel Shiffman's Nature of Code
Enjoy the flocking arrows! 🎯✨