In this project I implemented the boid algorithm which simulates the flocking behaviour of birds.
You must include the script boidsMain.js and link boids.cssin your html file. Also, include the canvas element with the id 'boidsCanvas'.
<head>
<link rel="stylesheet" href="boids.css">
<script type="module" src="boidsMain.js"></script>
</head>
<body>
<canvas id="boidsCanvas"></canvas>
</body>
An example of the animation is on my personal website http://www.jakenieto.com. If you click the background a new flock of boids is generated.
I got my inspiration for this project here https://p5js.org/examples/simulate-flocking.html.