Waterbugs
Tuesday, 27 December 2005.
Everyone who writes graphical toy programs simply must write a water effect program at some point in their programming career: it’s simple, it’s beautiful, and it’s an excellent introduction into blurring algorithms.
This one has little water striders gliding about on the surface of the water.
This particular implementation makes use of an optimization: every 4×4 square of the map is either treated normally or ignored as a block, depending on whether or not there is activity in that block or adjacent to it. If it’s ignored, we just saved 16 blurring operations, which can really add up, especially since it’s rare for the whole of the drawing screen to be used at once.
- Source code is available here.
- Built with Processing.
