Gradient Triangles

This program uses vector mathematics and colors to create triangular gradient. By simply left-clicking you create three points which then will be filled in with color.


  • Left click adds a new position
  • Space saves a screenshot

A nearly filled canvas Scattered triangles Colors like autumn

# Python 2.7.7 Code
# Pygame 1.9.1 (for Python 2.7.7)
# Jonathan Frech  6th of October, 2015
#         edited  9th of October, 2015
#         edited 10th of October, 2015

Continue reading

Sierpinski Triangle

Having recently heard something about chaos theory, I was interested in the sierpinski triangle. Specifically in the random generation. To proof, if it can really be generated using a dice, I wrote this program.

How it works

  • You start with any point inside the triangle (I chose the center)
  • A triangle has three points, let us call them A, B and C
  • You choose randomly between one of those three points, go half the distance and set a pixel right there
  • Repeating this process over and over again (always starting at your last point), you eventually get the sierpinski triangle


  • Space toggles if the triangle is generated
  • m toggles if the current position is shown (indicated by a blue circle)

Starting with an empty triangle Slowly but surely... Finished sierpinski triangle

# Python 2.7.7 Code
# Pygame 1.9.1 (for Python 2.7.7)
# Jonathan Frech 15th of July, 2015

Continue reading