Koch Snowflake

The Koch snowflake is a fractal curve. In fact, it's one of the earliest fractals ever described.

The snowflake is constructed from three Koch curves. With each iteration (which you can initiate with a click or a tap), each segment is replaced with four segments, each of them one third the original curve's length, forming a snowflake pattern.

The cool thing is that the area enclosed by the curve approaches a finite limit, but the perimeter increases without limit. The true Koch snowflake has an infinite perimeter.

I also couldn't resist making this a rainbow.

Note: to avoid your browser catching fire, this one isn't actually infinite.

Code