Who doesn't like triangles? Nobody. Especially hipsters ;-)
Here is an example:
var mySVG = new Triangulr (600, 500, 60, 0);
Triangulr constructor needs these attributes:
counter triangle number
x column index
y line index
lines number of lines in the SVG
cols number of columns in the SVG
points array of triangle points
The engine is quite simple to understand, even if at the start, it looks confusing to build this random triangles.
To begin, we use the value given to the constructor to create a regular pattern with proper equilateral triangles. To do that, the script start by generate lines of dots. Then a second pass use these points to generate triangles, and also the color function to generate the color code.
Then the last pass use the data to render it in a SVG DOM object.
Here is the basic code. Break it, test it.
Yes, the stuff below is a little editor, don't forget to press 'update'.