Then I started looking into how to make them exhibit flocking behaviour, like a group of birds or fish. I was greatly helped by this article on the three main rules of simple flocking.
I started with some attraction principles, which makes these dots gradually draw towards each other.
Then I looked at making them try to keep a distance from their neighbours, so they tend to jostle for position. This looked very nice. I also added a behaviour to make them avoid the mouse cursor.
This last example should also work on tablets, as I have learned how to grab touch events as well as mouse events.
The end result is something that looks quite hypnotic, which is especially satisfying as it is based on such simple rules!