Triangles are my favorite shape.
JavaScript
Latest commit 6510dfd Aug 2, 2015 @kevinwuhoo Bug fixes, rename randomColor opt to coloringFunction
Cast int parameters to prevent weird errors. Add stroke between
triangles to fix weird white gaps created from antialiasing. Reset
triangleIndex count on each new row. Fix bug where if random start
selected, it's only applied to the first row.
Permalink
Failed to load latest commit information.
img
README.md
tessellate.js

README.md

tessellate

Triangles are my favourite shape

Three points where two lines meet

∆ (Alt-J) - Tessellate

Purpose

Generate tessellated equilateral triangles with nice colors on to a canvas.

See a demo: http://kevinwuhoo.github.io/tessellate/.

Usage

// returns a canvas element
tessellate({
  size: size of triangles
  colors: array of colors that are randomly chosen from

  width (optional): width of canvas returned, defaults to window.innerWidth
  height (optional): height of canvas returned, defaults to window.innerHeight
  randomColor (optional): function that returns a color, overrides the color option,
                          passed the current row and triangle index it's on for better
                          control over color placement
  disableRandomStart (optional): starts triangle generation at (0, 0)
})

Things That Need Thinking

  • Make a playground.
  • Should there be built in color schemes? (ColorBrewer, ColourLovers)
  • Other shapes? (squares, hexagons)
  • Support various module definition APIs.
  • Add image exporting?

Inspirations

Brina Lee's Photo

One of my classmates, Brina Lee, had press coverage as the first #womeng at Instagram [1, 2]. The photo for this press release was a photo of her standing in front of a wall(?) where there were tessellated triangles.

I really want to visit where ever this is in person.

iPhone Backgrounds

Tess Rinearson

When we met, Tess was wearing a necklace with triangles on it. I made a stupid joke about her name being Tess and triangles and whether she only wears shapes that tessellate.

Alt-J - Tessellate

I really like this song: ∆ (Alt-J) - Tessellate.

Other Cool Libraries Like This