Truchet Tiles

Truchet Tiles

January 9, 2023

example p5.js javascript images genuary

Truchet tiles are a way to make art out of interlocking square images. Each square has connection points on all four sides, which lets them fit together in any rotation or configuration.

To celebrate Genuary 6 which had a theme of “steal like an artist”, I collaborated with the lovely and talented Ariel, who drew these squares:

And then I wrote this sketch which randomly rotates the tiles and places them in a grid:

Click here to edit this code in the p5.js editor.

Here are some example outputs:

randomly colored truchet tiles small randomly colored truchet tiles pastel truchet tiles animated truchet tiles

Remix Ideas

  • Use your own images as tiles.
  • Instead of drawing images randomly, use a for loop to position them in a grid.
  • Instead of replacing images, start with one set and then rotate them over time.

Images Examples


Happy Coding is a community of folks just like you learning about coding.
Do you have a comment or question? Post it here!

Comments are powered by the Happy Coding forum. This page has a corresponding forum post, and replies to that post show up as comments here. Click the button above to go to the forum to post a comment!