In this project, dozens of objects are pulled together through simulated Newtonian forces to form a sphere. This is not too far off from how actual planets are formed:
With the formation of the sun, the remaining gas and dust flattened into a rotating protoplanetary disk. Within this swirling debris, rocky particles began to collide, forming larger masses that soon attracted even more particles via gravity. These particles contracted under gravity to create planetesimals, which collided with one another to become the solid inner planets. Meanwhile, gases froze into giant balls that would build the outer gas giants.
It wouldn't be very interesting if the gravity was too strong and the objects in this visualization permanently stuck together, so the values are set just right so that they'll clump together, start spinning, then break apart and float around the screen for a while before eventually coming back together.
You can also click and hold anywhere to cause the objects to be pulled towards your cursor (though if you do this, it may take a few minutes before they come back together to form a planet).