Typography as particles

Every letter below is a particle, and the paragraph is still one ordinary block of HTML that the canvas draws in pieces. I wanted to see if the text would survive that. Blow it apart, then select it, search for it, follow the link or edit the paragraph.

Letters that fly, words that stay words.

This paragraph is editable. Type into it and the new letters join the swarm. Nothing here was split into spans; each glyph is a small rectangle cut from one picture of the whole block.

Select any phrase and the chosen letters lift off the line. The HTML-in-canvas explainer is a real link, and find-in-page still finds everything. Emoji and accents travel as one piece: 👩‍🚀 café, naïve, fine.

Move the pointer over the text, or tap it, to push the letters around.

Show the code text as particles
  1. Wrap ordinary text in <glyph-field>. No spans. Links, editing and selection keep working.
  2. Call the motions.
  3. Inside the element: find every glyph without changing the markup. A Range around each grapheme gives its rectangle with getClientRects().
  4. Inside the element: draw the text once, then one piece of that picture per glyph. drawElementImage() draws the block, createImageBitmap(canvas) keeps a copy, and each particle is a drawImage() crop of it.
  5. Inside the element: say where the real text is. So selection, links and the caret stay on the line while the glyphs fly.
  6. The whole element, with the WebGPU and WebGL renderers.

Use it

<script type="module" src="/lib/glyph-field.js"></script>

<glyph-field pointer="repel">
  <h1>Any markup at all</h1>
  <p>Links, <em>emphasis</em>, even contenteditable.</p>
</glyph-field>

<script>
  const field = document.querySelector('glyph-field');
  await field.explode({ x: 100, y: 40 });   // resolves when the text is whole again
  field.highlight('markup');                // matching glyphs lift off
</script>

Live checks

These run in your browser when this section is on screen, on the small fixtures in the box below. They don't touch the text above.

test rig

AVATAR link word

Findings