Optimizing Particle Background Performance with Quadtrees

thumbnail image for Optimizing Particle Background Performance with Quadtrees
I have been recently looking at some Javascript libraries to make particle-based backgrounds. I found 2 promising libraries, Particleground and particles.js. Before jumping in and copy/pasting sample code, I figured I’d do some thinking of my own and see if I really need a library to achieve a simple particle background where the particles are connected by lines, depending on their distance. So - okay, simple enough, 100% width/height canvas at the background, put out some randomly placed dots, then link the dots depending on the distance.