Saturday, February 17, 2018

the chaos game

I've been upgrading a lot of my old Processing toys and games so they run in modern browsers. I had to put a bit of extra effort into one I call Sier Chaos, the Chaos Game way of making Sierpinski Triangles. (You can play with the online editor version of it as well.)

It's magical and hypnotic to watch the complex fractal of Sierpinski Triangle (like the Legend of Zelda Triforce sign taking acid) emerge from the simple rule of "draw a point, and then the next point is halfway between that last point and any one of the 3 corners, and repeat."

I ran into one clever little bit of p5 I hadn't seen before (and based on the trouble I ran into when I tried to use an old version of the library, must be new) - the random() function now can also take an array-like argument (rather than the typical numeric rangers) and it will return an item randomly selected from that array... very handy!

No comments:

Post a Comment