The Sierpiński triangle (sometimes spelled Sierpinski), also called the Sierpiński gasket or Sierpiński sieve, is a fractal attractive fixed set with the overall shape of an equilateral triangle, subdivided recursively into smaller equilateral triangles.
To create this fractal, shape I used the "chaos game" method:
-
Take three points in a plane to form a triangle.
-
Randomly select any point inside the triangle and consider that your current position.
-
Randomly select any one of the three vertex points.
-
Move half the distance from your current position to the selected vertex.
-
Plot the current position.
-
Repeat from step 3.
The script is implemented in JavaScript. The canvas resets after 3000 iterations.
See my personal blog for the result.