Full version: jsB@nk » Utility » 2D Boids in JavaScript
URL: https://www.javascriptbank.com/2d-boids-javascript.html
This JavaScript Boids effect is a simulation of flocking/schooling behavior (e.g. birds, fish). A very helpful JavaScript code to practice yourself.
Full version: jsB@nk » Utility » 2D Boids in JavaScript
URL: https://www.javascriptbank.com/2d-boids-javascript.html
<script src="boids.js" type="text/javascript"></script><!--[if IE]><script type="text/javascript" src="excanvas.js"></script><![endif]-->
<p><a href="http://www.red3d.com/cwr/boids/">Boids</a> in JS (2 dimensional). Boids are a simulation of flocking behavior.</p>Attraction: (m1) <input size="3" id="m1" type="text" onchange="m1 = this.value;">Repulsion: (m2) <input size="3" id="m2" type="text" onchange="m2 = this.value;"><br/>Alignment: (m3) <input size="3" id="m3" type="text" onchange="m3 = this.value;">Stay on screen: (m4) <input size="3" id="m4" type="text" onchange="m4 = this.value;"><br/>Chase: (m5) <input size="3" id="m5" type="text" onchange="m5 = this.value;">Fear: (m6) <input size="3" id="m6" type="text" onchange="m6 = this.value;"><br/><input type="checkbox" onchange="predator(this.checked);" checked="checked"> Predator<br/><input type="button" onclick="go()" value="go"><input type="button" onclick="init();" value="reset"><br/> </div> <canvas id="theCanvas" width="1024" height="768" style="border: 1px solid black">Get a better browser (SeaMonkey, Firefox, Opera, Safari)</canvas>
/javascript/utility/2D_Boids_in_JavaScript/boids.js/javascript/utility/2D_Boids_in_JavaScript/excanvas.js