Skip to content

Latest commit

 

History

History
69 lines (49 loc) · 2.05 KB

File metadata and controls

69 lines (49 loc) · 2.05 KB

Flocking Arrows

A generative art application featuring flocking arrows that simulate natural flocking behavior using the Boids algorithm.

Description

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:

  1. Separation - Avoid crowding nearby arrows
  2. Alignment - Steer towards the average heading of nearby arrows
  3. Cohesion - Move towards the average position of nearby arrows

Features

  • 🎨 Colorful arrows with trailing effects
  • 🖱️ Interactive mouse controls
  • ✨ Beautiful emergent flocking behavior
  • 🎯 Dynamic adding/removal of arrows
  • 📸 Screenshot capability

Controls

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

How to Run

  1. Open FlockingArrows.pde in Processing
  2. Click the Run button
  3. Move your mouse to interact with the flock!

Technical Details

  • Algorithm: Boids (Craig Reynolds, 1986)
  • Default flock size: 100 arrows
  • Canvas size: 1200x800 pixels
  • Language: Processing (Java mode)

Customization

You can adjust these parameters in the code:

  • Arrow count: Change the loop in setup() (line 21)
  • Canvas size: Modify size() in setup() (line 18)
  • Flocking weights: Adjust multipliers in flock() method (Arrow.pde lines 31-33)
  • Arrow appearance: Modify arrowSize and arrowColor in Arrow constructor

Algorithm Weights

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)

Credits

Based on Craig Reynolds' Boids algorithm (1986) Implementation inspired by Daniel Shiffman's Nature of Code

Enjoy the flocking arrows! 🎯✨