Stochasticity #5 – Etch-A-Sketch

A screenshot of the Stochasticity #5 programming poem.

 Launch the poem. Fork it on GitHub.

This poem is a little bit of a departure form the last ones. There is a vector field that spreads across the entire screen. Each vector is randomly pointed in a direction according to the simplex noise algorithm (comparable to Perlin noise). Essentially the algorithm takes into account 3 dimensions, with the third being time. What’s interesting about this is that the noise can be thought to be a 2d slice moving through 3d space.

After the vector field has been calculated, a separate canvas layer is drawn onto for the color “walker”. This walker moves a set distance evenly through this vector field in the direction that the vector is pointing. If you dive into the source code, it’s fun to tweak all of the various values to play around and explore how the simulation changes. This would be a nice one to do some sliders on top of.

One thing that would be nice to change, but I didn’t take the time to wrap my head around would be a repeating simplex noise, so that the edges of the space would wrap. Sometimes the color “walker” gets stuck at the sides of the simulation a for a little while.

More From Interactive