# driftype > driftype makes a few words into a live piece of type that plays in the > browser on WebGPU: a title, a wordmark, a line for a page. Claude makes one > from a look you describe (paid, on the title page), or you write one in the > lab, in WGSL, against the letters' signed distance field. A piece shows each > phrase whole, on one line, and crosses from one phrase to the next. driftype > is not a reader, a text renderer or a font tool. The site is mostly a ``, so its prose is here. There is no text shaping. Each character is its own glyph, side by side on one line: Arabic letters don't join, Hebrew and Arabic run the wrong way unless typed in visual order, and Indic conjuncts don't form. ## AI pieces On the title page, `https://driftype.com/`, Claude makes a piece to order: 1. The person describes a look and gives their words, one phrase a line, up to eight. Claude may ask a question or two about the look, each answered with one tap or skipped. 2. They choose one to four versions and pay once: $5, plus $5 a version ($10 to $25), at Stripe's checkout, tax included, or with a code's units. 3. Claude makes every version at once, each from a different take on the look. The person keeps them all, side by side, each with a short caption. 4. One change is free, for any one version. It makes a new piece and keeps the one it changed. After that, a piece bought with an invite or gift code can be changed again for a unit of the code each time; one paid for at Stripe's checkout cannot. 5. Each piece plays on the page, opens in the lab, downloads as a `.lab.json` and exports as any lab piece does. 6. A piece is online for 90 days. Keeping one online for as long as driftype runs is $10. The exports are theirs to keep either way. - Time: the versions usually take about ten minutes (at most two to three hours), a change one to three minutes. - Email: Stripe's checkout asks for an address; with a code it is optional. The pieces are emailed when ready, with a link that works on any device. - The free change can be asked for within 90 days of the purchase. - Every piece is checked before delivery: it opens in the lab and sets exactly the person's words. - Refunds: a version that cannot be made is refunded at its $5; if none can, the payment is refunded in full, automatically. AI pieces are sold as is: the person pays for the making, and a piece that is broken or not as described (it does not open, or does not set their words) is refunded on request, within 60 days; a change of mind is not, and the free change is for a piece not quite as they had in mind. https://driftype.com/refunds - Sold to adults (18 or older) outside the EU, EEA and UK. A payment billed there is refunded in full. - What is kept, and for how long: https://driftype.com/privacy#ai ## The lab `https://driftype.com/lab`. A piece is one or more phrases, shaded by WGSL you write against the text's distance field, through a pipeline of render and compute passes. It exports three ways: - **export page**: one HTML file that plays opened from disk. - **export piece**: a zip for your own site, with the `` element, the piece and its engine. - **export low-res page**: one HTML file of the piece in colored cells, with no engine, and a still that shows with JavaScript off. The first two carry the engine the piece was made with, so a later build never changes it. The gallery holds driftype's own pieces: anyone can watch one and open it in the lab. ## Write a piece An AI can write a piece from this site alone: 1. Read the reference, https://driftype.com/reference.md: the piece's JSON field by field, `shade(p)` and the field, `view`, the prelude, passes and the pipeline, the limits, and five whole pieces to start from. 2. Start from a whole piece. Change the phrases (`sequence`) and the code units (`code`: each unit's WGSL and the engine capabilities it `uses`, `"glyphs"` for `field()`; `wgsl` stays `null`). The passes go in `pipeline`, each naming the unit it runs. `pipeline_js` is optional and never run to open a piece. Say what the piece is and how to play with it in `about`. Write only the fields the reference lists: the lab refuses a piece with one it does not know. 3. Name the fonts (below). Never write glyph outlines: the lab fetches the font and fills them in. 4. Hand the piece over as a file, `.lab.json`. The person drops it on the lab, or uses "open a file…". 5. It opens paused. Tell them to press **run**, in the bar at the top. 6. If the lab will not open it, or it does not build, the lab says why and offers "copy for your AI": the problem and the piece, to give back to you. ### Fonts - Name any family on Fontsource (https://fontsource.org, open licences only) as Fontsource writes it: `"fonts": ["EB Garamond"]`, or several, each phrase naming one by index (`"font": 0`). Omit `fonts` for Anton. Names ignore case. At most 8, and only fonts a phrase is set in. - A weight or style is an object, `{ "family": "Inter", "weight": 700, "style": "italic" }`, never "Inter 700". A weight is 1 to 1000; the nearest the family has is taken. - Choose a family that has the phrases' script: a character none of its files has is not drawn. Write precomposed characters (Unicode NFC). - A family Fontsource does not have is refused. System and commercial fonts are not there: for Arial name "Arimo", Helvetica "Inter", Times New Roman "Tinos", Courier New "Cousine", Georgia "Gelasio". These match the regular weights only (Arimo stops at 700). - An icon font is named by its family (`"Material Icons"`) and its icons written as codepoints (U+E838 as the character itself). A ligature name ("star") draws the letters, or nothing. - Inside the ink, `field()` is the distance to the letter's own outline, also in a font built from overlapping shapes, so bands drawn inside the letters (`abs(d) < w`) follow the letter. One limit, in every font: a notch narrower than about 1/64 em (the tip of A's counter) reads as ink. - For a font file of the person's own, write the piece in Anton and tell them the steps: open it, "keep as my piece" (which replaces the piece they had), then "file…" beside a phrase's font menu. ### host_js A piece may carry `host_js`: a script standing in for the web page around it. It writes bytes into the pipeline's `host: true` resources (`piece.write(name, new Float32Array([...]), byteOffset)`, offsets from `piece.layout(name)`) and draws its own DOM over the canvas. Only the lab runs it, so the piece must look right with those resources at their declared values. On your own page, call `el.write(...)` the same way. The reference's "host.js" entry and its last whole piece show how. ## A piece on your own page: `` The **export piece** zip holds the piece (`.json`), the element (`graffito-piece.js`), its engine (`piece.wasm`) and an `index.html` that plays it and lists what its page may write. Keep them side by side and serve the folder from a web server (a page opened from disk cannot fetch the piece): Shown when the piece cannot play. `await el.ready` (it rejects, with the reason, when the piece cannot play), then: - `el.write(name, data, byteOffset)`: a typed array into a `host: true` storage or uniform. `el.writeTexture(name, source)`: every texel of a `host: true` texture. `el.layout(name)`: each member's byte offset (`.members.m.offset`). Nothing else can be written. - `el.onFrame(cb)`: `cb` runs before every frame with `{ time, rect, item, from_item, to_item, transition, loop, ... }`. Write from it, so a shape follows its element through scrolling and reflow. - Events: `graffito-ready`, `graffito-error` (`detail.reason`), `graffito-item` (`detail.item`), `graffito-cross` (`detail.from_item`, `detail.to_item`) and `graffito-loop` (`detail.loop`), the last three with `detail.time` in seconds. - Taken off the page and put back, the element starts afresh with a new `el.ready`, and earlier onFrame callbacks are dropped. Points the page writes are CSS px from the viewport's top left, as `getBoundingClientRect()` gives. In WGSL, `page_point(point)` turns one into em and `page_length(length)` a CSS length; `view.canvas_rect` is the canvas on the page and `view.px_per_css` its pixels per CSS px. A button's rect fed into a piece whose pipeline declares `const ui = uniform({ live: f32(0), button: vec4f(0, 0, 0, 0) }, { host: true })`: In WGSL, `page_box(p, ui.button, 8.0)` is the button as a distance (corners of 8 CSS px), positive inside as `field()` is, to join with `smooth_max`. The reference's "embed" and "boxes" entries have the whole piece and the other box helpers. ### The page's elements, with no script: `data-field` Mark an element `data-field` and `` hands its box to the piece every frame: its rect, its corners and its kind. - The value is the kind: `data-field` or `data-field="shape"` (part of the field), `"clear"` (text the piece keeps calm under), `"panel"` (a section the field docks to), `"anchor"` (where the page wants the type). - `data-field-radius="12"` gives the corners in CSS px (else `border-radius` is read). `data-field-outset="8"` grows the box on every side. - `field-scope="main"` (a CSS selector) follows only marked elements that match it or sit inside one that does; `""` follows none; absent, the whole document. - Elements added later join within half a second. What the piece does with them depends on the piece: - A code unit that uses `"page"` (the reference's "page-join" entry): the engine hands it at most 64 boxes, lays the type into the first anchor, and `field()` joins the shapes and panels to the letters. - A pipeline that declares `page_boxes` (the "page-boxes" entry): the boxes are written every frame with hover and press (0 to 1, eased), and the piece decides what each kind does. - Any other piece: `` has the engine join shapes and panels to the type and cut clears, at most 32. The value is how far they melt in, in CSS px. The exported piece's JSON must say `"engine_level": 2` or more. A page that marks elements the piece will not draw gets one `console.warn`. The kit's `index.html` says which of these its piece takes.

Text the piece keeps calm under.

## Retired: the document editor and `` Gone since 4 October 2026: driftype documents, their editor and presets, and the `` element (the npm package `driftype` stays at its last version). Their old addresses (`/embed/`, `/?editor`, `/schema/...`) lead to a page that says so. Pages exported from the editor still play. ## Requirements WebGPU. Chrome and Edge have it on Windows, macOS and ChromeOS (since 113), on Android 12 and later, and on Linux for some GPUs; Safari from 26, on macOS, iOS and iPadOS. driftype is tested in Chrome, Edge and Safari only. It is not tested in Firefox and may not work there. Where WebGPU is missing, the lab says so, and an exported page shows its fallback text. ## Links - [driftype](https://driftype.com/): the title page, where Claude makes an AI piece. - [The lab](https://driftype.com/lab): make a piece in WGSL, on a desktop browser. - [The lab's reference](https://driftype.com/reference.md): how to write a piece, as Markdown, with whole pieces to copy. - [The gallery](https://driftype.com/gallery): driftype's own lab pieces. - [About](https://driftype.com/about): what driftype is, what it needs, who runs it and how to reach them. - [Privacy](https://driftype.com/privacy): what the site receives, and how long an AI piece's look, words and email address are kept. - [Refunds](https://driftype.com/refunds): what is refunded. ## Notes The site's type is Anton, under the SIL Open Font License (`/Anton-OFL.txt`). The lab fetches a named family from api.fontsource.org and cdn.jsdelivr.net when it opens the piece. An exported piece carries glyph outlines from its font, whose licence is the author's question.