A Processing 3 sketch of four slowly evolving polygons and a meditative soundscape created by a few Tibetan Singing Bowls.
The algorithm is very simple:
- place each vertex of each polygon in a random position
- assign to each vertex a random direction (all polygons have the same scalar velocity)
- at every frame move each vertex, if the new position is outside a border, simply make it bounce (reverse the velocity component orthogonal to the border)
- assign a different color to each polygon and draw only its outer border (no fill)
The source code can be dowloaded here.
I made a video of the animation (starting from 4 rectangles) and added a soundscape made with sampled Tibetan Singing Bowls.
Other implementation ideas:
- change the speed of each vertex
- slowly change the color of each polygon
- generate a MIDI message each time a vertex hits a border and send it to a virtual instrument or synth
If you improve the code or implement other variations let me know in the comments below.