I started this experiment to play around with the Canvas element.

You can put particles of different sizes, having different masses, on the screen. Every particle on the screen is attracted to every other particle. Bigger particles have a stronger attractive force than smaller ones. When two particles collide they merge, creating a larger particle.

I've also added a button to generate a cloud of particles.

It will slow down significantly when there are a lot of particles on the screen. I'm looking forward to rewriting this using WebGL to handle many more particles.

It's fun to play with. So go ahead and give it a try.

See it in action