← Back to Portfolio
Boids
Interactive boid swarm simulation: watch tiny triangular insects walk, bounce, and swarm across the canvas.
  • Add button spawns ten new boids at random positions & orientations.
  • Clear button removes all boids for a fresh start.
  • Boids maintain constant speed using unit-length velocity vectors.
  • Edges are treated as walls—boids bounce off rather than wrapping around.
  • Collisions with walls or other boids trigger a brief color flash.
  • Each boid is drawn with a body and six animated legs that swing in mirrored pairs to mimic walking.
  • Speed slider adjusts the global pace of the swarm in real-time.
  • Built with a Boid class and the HTML5 Canvas 2D API.