Play — ASCII Playground
Andreas Gysin · 2020
Andreas Gysin's browser-based live-coding "playground" (ertdfgcvb.xyz, built on the open-source play.core engine) for writing small programs whose animated visuals are composed entirely of text characters rendered into a grid.
How it works
An engine and playground in which a whole animated image is authored as one pure function: the runner calls the user program's `main()` once per cell of an auto-sized monospace grid, each call returning the character (or a styled cell) to place there, with a frame counter and pointer folded in for animation and interaction.
Grounded in the play.core engine source (`src/run.js`), not inferred from the output. `run(program, settings, userData)` starts a per-frame loop. Each frame it assembles three things a program can read: a `context` (`frame` counter, `time`, `cols`, `rows`, font `metrics`, `fps`), a `cursor` (pointer `x`/`y` in cell coordinates, `pressed`, and `p` = the previous frame's cursor), and a shared `buffer` of `cols × rows` cells, each an object `{char, …style}` defaulting to an empty cell. `cols`/`rows` are auto-sized to the element as `floor(width / cellWidth)` × `floor(height / lineHeight)` from monospace metrics (or fixed via settings), and the buffer is reallocated when they change. An optional `program.pre(context, cursor, buffer, userData)` runs first; then the core step is a nested loop `for j in rows { for i in cols }` that calls `program.main({x:i, y:j, index}, context, cursor, buffer, userData)` for every cell. The return value sets that cell: a string becomes its `char`, an object is merged over the cell (`char` plus colour/weight style), and a falsy char falls back to the empty cell. An optional `program.post(...)` runs after the grid is filled, and a renderer — the default DOM `textrenderer` or the `canvasrenderer` — paints the buffer. Because every cell is just the output of one function of `(coord, context, cursor, buffer)`, motion comes for free from `context.frame`/ `time` and interaction from `cursor`: the picture is genuinely computed character-by-character each frame.
Algorithms
- Generative Typography / ASCII primary · classification: human-reviewed
Details
Sources
- Web ertdfgcvb.xyz ↗
- GitHub github.com ↗ — The play.core engine repository — first commit 2020-08-26, dating the playground's creation to 2020 (corroborated by Gysin's August 2020 announcement). A later 2023 write-up in Holo covered it, not its release.
Related works (by shared algorithms)
Last updated 2026-07-16