Draw My Canvas / studio

Truchet Tiles

Quarter-arc tiles re-rolling, one at a time, into a single continuous meander.

Plate 09truchet

Waiting for the animation above to load…

What lands in the file, and what the width does

One click writes whatever the animation is drawing at that moment to a PNG, with the drawmycanvas.com mark drawn into the picture rather than laid over it. Leave the width box empty and you get the stage exactly as your browser rasterised it — your window’s width times its device pixel ratio, which is about 1,600 px across from a 1280‑px window on a HiDPI laptop and about 353 px from a 390‑px phone.

Type a width instead, or take a preset, and the frame is redrawn into a canvas that wide: the height follows the stage’s own shape and the mark scales with it. The stage is 16:9 on a wide window and 4:3 below 560 px, so a width of 1200 saves 1200×675 on a laptop and 1200×900 on a phone. 1200 px is the width Open Graph and X link cards are cut from — the canonical card is 1200×630, and a card crops the extra height rather than letterboxing it.

Honest limits. Asking for more pixels than the stage was drawn at resamples pixels that were never drawn: a 1920‑px file exported from a 353‑px phone stage is bigger, not sharper. For a big file that is sharp, use Save as wallpaper: it draws the plate again from scratch at exactly 1179×2556 or 1290×2796 (phones), 1920×1080, 2560×1440 or 3840×2160 (4K), so every line is rasterised at that size and the shape is the screen’s, never stretched. Because the plate restarts, a wallpaper is a fresh run of it rather than the exact frame on screen; it is given as long as the stage has been running, up to 20 seconds, to develop. A very large width is a real memory allocation and a browser is allowed to refuse it; when that happens the line above says so plainly and nothing else on the page changes. Stills are PNG only — no JPEG, no WebP. On browsers that can record video, Record a clip saves 5, 10 or 20 seconds of the running animation as MP4 or WebM (whichever this browser can encode) at the same width, with the mark in every frame. A clip is not a seamless loop, it has no audio, and a width bigger than the stage is resampled rather than sharper — only the wallpaper is redrawn at its size. Where a browser cannot record video the button never appears and a PNG is the only export. And nothing is uploaded: the frame or clip is assembled in your own browser, so no frame of this plate ever reaches us.

Live on an HTML canvas · vanilla JavaScript · no dependencies Open fullscreen

About this piece

Every cell of this grid carries the same tile: two quarter circles of radius half a cell, centred on opposite corners. Only the tile’s rotation differs from cell to cell — and because a 180° turn maps the tile onto itself, there are only two distinct orientations. One bit per cell decides the whole picture.

The reason it does not look like a grid of tiles is a single geometric fact: an arc of that radius, centred on a corner, begins and ends exactly at the midpoint of an edge. Its neighbour’s arcs land on the same midpoints, whichever way that neighbour is turned. So the joins are always seamless, and curves wander across the entire frame even though no cell knows anything about the cells around it.

Sébastien Truchet catalogued the patterns from a single rotatable square tile in a 1704 memoir for the French Royal Academy of Sciences; the quarter-arc version drawn here comes from Cyril Stanley Smith’s 1987 paper on Truchet. Both tiles, and a 17-line program that draws the second, are below.

What to look for

About seven cells a second re-roll their target rotation, and each one eases into the new angle over roughly a second rather than snapping. Pick a long meander and watch it get cut and re-routed as a cell somewhere along it turns.

Roughly one cell in seven is coral. Colour belongs to the tile, not to the curve — so a single continuous loop will often change ink halfway round, which is a good way to see that the curves really are an accident of the tiling.

Honest limit: this is a grid, and the piece needs width to read. In a narrow phone-portrait frame you get about six cells across, and at that size it looks more like a pattern swatch than a meander. It is at its best wide.

Truchet’s original tile

The idea is older than the arcs. In 1704 Father Sébastien Truchet (1657–1729), an honorary member of the French Royal Academy of Sciences since 1699, published Mémoire sur les combinaisons in the Mémoires de l’Académie Royale des Sciences (pages 363–372). He explains how it started: on a trip to the Canal d’Orléans he found, at a château near Orléans, ceramic tiles waiting to be laid in a chapel floor that were “of square shape, divided by a diagonal line into two coloured parts”, and he set out to count the ways such tiles could be joined, “always in checkerboard array”.

That tile has no rotational symmetry, so it can be laid in four orientations: the coloured triangle can sit in any of the four corners. Two tiles side by side already give 4 × 4 = 16 arrangements, and a whole floor is a choice of one of four per square. Tiling floors was nothing new; what Truchet did first, as Jacques André and Denis Girou put it in a 1999 TUGboat article on Truchet, was to publish a systematic study of all the combinations.

Truchet’s triangle tile in its four orientations, and a patch built from them Four squares, each split on a diagonal into a coloured and a plain triangle, with the coloured triangle in the top-left, top-right, bottom-right and bottom-left corner in turn, labelled 0, 90, 180 and 270 degrees. Beside them, a four-by-four patch of the same tiles turned so that every group of four points its coloured corners inward, which makes four coloured diamonds. 0° 90° 180° 270°
Truchet’s tile, turned through its four orientations (left), and a 4 × 4 patch that repeats one 2 × 2 choice of them (right). Change any one tile in the patch and the diamond it belonged to breaks.

Smith’s quarter-arc version

The tile this piece draws came later. In 1987 Cyril Stanley Smith published “The tiling patterns of Sebastian Truchet and the topology of structural hierarchy” in the journal Leonardo (volume 20, issue 4, pages 373–385), with an English translation of Truchet’s text by Pauline Boucher. That paper popularised Truchet tiles, and the second common form of them comes from it: each tile carries two quarter circles that connect the midpoints of adjacent sides. The same tile had already appeared in the board games Trax and the Black Path Game before Smith’s paper.

Why only two orientations. Each arc is centred on a corner and has a radius of half the tile, and the two arcs sit on opposite corners. Turn the tile 90° and the arcs move to the other pair of corners: a different tile. Turn it 180° and each arc lands exactly where the other one was, so the tile is unchanged. That leaves two distinct tiles, and the whole grid is one bit per cell, where Truchet’s triangle needed two.

Why every join is seamless. An arc of radius half the side, centred on a corner, starts at the midpoint of one edge and ends at the midpoint of the next. Two arcs with two ends each make four ends, one on each side, so every tile has an arc ending at the middle of every edge, however it is turned. The neighbour across that edge has one too, at the same point. Both arcs also cross the edge at a right angle (the radius at that point runs along the edge), so the two halves line up with no kink.

Two things you can check by eye

Every curve either closes into a loop or runs off the edge of the frame. No curve ever stops in the middle of the picture. Each edge midpoint inside the grid is the meeting point of exactly two arc ends, one from each tile, so a curve arriving there always has exactly one way on. Only where there is no next tile, at the border, can a curve end. The smallest loop is a circle of four quarter arcs round one grid corner, which you get whenever all four tiles around that corner put an arc on it.

The regions between the curves can always be coloured with two colours so that regions on opposite sides of any curve differ. A recipe that always works: number the grid corners (column + row) and colour each region by whether the corners inside it are even or odd. Inside each tile, an arc cuts off one corner from the band that holds the other two, and those two are diagonal neighbours with the same parity, the opposite of the cut-off corner. So the rule is consistent, and every curve has an even region on one side and an odd one on the other.

Honest limit: both hold for tiles at rest. While a cell is part-way through its eased turn, its arcs briefly come loose from its neighbours’, and for that second the loops are open.

Draw your own

This is the whole technique in 17 lines of HTML and plain JavaScript, with no library: a 480-pixel canvas cut into a 12 × 12 grid of 40-pixel cells, one coin flip per cell, the same two ctx.arc calls this piece makes, and the same trick of turning the tile a quarter turn (q) with ctx.rotate instead of writing out the second orientation. Save it as an .html file and open it; reload for a new pattern.

<canvas id="truchet" width="480" height="480"></canvas>
<script>
const ctx = document.getElementById('truchet').getContext('2d');
const n = 12, s = 480 / n, r = s / 2, q = Math.PI / 2;
ctx.lineWidth = s * 0.13;
ctx.strokeStyle = '#2C4ED0';
for (let row = 0; row < n; row++) {
  for (let col = 0; col < n; col++) {
    ctx.save();
    ctx.translate(col * s + r, row * s + r); // cell centre
    if (Math.random() < 0.5) ctx.rotate(q);  // the coin flip
    ctx.beginPath(); ctx.arc(-r, -r, r, 0, q); ctx.stroke();
    ctx.beginPath(); ctx.arc(r, r, r, 2 * q, 3 * q); ctx.stroke();
    ctx.restore();
  }
}
</script>
Paste it into an empty .html file.

Where to take it: change n for finer or coarser grids, or swap the colour. Replace the coin flip with a rule, such as (row + col) % 2 === 1, and the randomness is gone: alternating the two tiles closes every curve that does not touch the border into a small four-arc circle. What it does not do is the animation above (the eased re-rolling and the theme-matched palette); this is the still pattern only.

Curious how the loop and canvas fit together? Read how it works →

More from the gallery

All 32 animations in the gallery →