Sierpinski: A Chaos Game Implementation

Chaos game animation canvas.

Settings:

What is happening?

The initial image contains colored pixels corresponding only to the vertices of a regular polygon and a randomly chosen starting point on the image called the "trace". On each iteration of the game, a vertex V on the polygon is chosen at random and the trace is moved some distance D toward V. D is determined by the "Jump Factor". A jump factor of 0 entails that the trace is not moved at all toward V. A jump factor of 1 entails that the trace is moved 100% of the distance toward V. Clearly, these two settings produce trivial images. But for certain values of the Jump Factor between 0 and 1, interesting fractal patterns emerge!

Try these pairings of the Vertex Number and the Jump Factor:


Vertex NumberJump Factor
4≈ 0.558
5≈ 0.618
6≈ 0.667
7≈ 0.692
8≈ 0.707
9≈ 0.742
10≈ 0.764

Discussion of the math behind these pairings and some alternate versions of the game coming soon!