These are 5th-order "Sierpiński Carpet" fractals, rendered by a surprisingly simple recursive function: a single square is painted at the center of the drawing area, which is then divided into a 3x3 grid; the function then iterates over the 9 cells, calling itself with a constrained drawing area. The recursion goes 5 levels deep to achieve the finer details of the carpets.
A seeded pseudo-random number generator is used to create the color patterns in a deterministic way, meaning a given seed will always generate the same carpet. The seed value is shown at the bottom, whenever you move the mouse over the canvas.
Click the canvas to generate a new random seed or type a 6-digit number to use it as a seed.
Use the Left and Right arrows to navigate through previously generated seeds.
Press the 'S' key to save your favorite carpet and it will be reloaded the next time you open or refresh the page. NOTE: the favorite is saved in your browser storage; if you *really* like a pattern, write the seed down so you won't lose it.
Press the 'X' key to delete a saved favorite and display a random carpet on every page refresh.
Some of my favorite seeds:
762761, 413714, 751053, 261831, 177496, 366370, 980236