# Typewriter Terminal — `typewriter-terminal@1.0.0`

A terminal window typing commands with a human, uneven rhythm and a block caret, printing the output after each one.

A command line typing itself out. A terminal window drifts in, a prompt appears, a command is typed at a human, slightly uneven pace with a blinking block caret, the output prints in a dimmer colour and the next command follows. The typing times come from a seeded generator, so the same words always type the same way. Type two commands and their output, choose the theme (midnight, paper, phosphor or ember), the typing speed, the window title and the backdrop colour.

- Kind: text; status: published; digest sha256:03280ecb2a61e10835306b582075817389b3f08e63174f2e8197839ccf1acaed
- Role: Text scene (Canvas 2D): the developer-demo, tutorial and tech-product look.
- Implementation: canvas2d; entry `src/typewriter-terminal.js`
- Files: https://aipixelwizard.com/registry/typewriter-terminal/1.0.0/<path> (`LICENSE`, `asset.json`, `demo.js`, `index.html`, `src/typewriter-terminal.js`)
- Manifest JSON: https://aipixelwizard.com/api/v1/visuals/typewriter-terminal/versions/1.0.0
- Runnable demo: https://aipixelwizard.com/registry/typewriter-terminal/1.0.0/index.html (open over http; it imports sibling packages by relative path)
- Dependencies (exact): `apw-runtime@1.0.0` (demo) — Demo harness. The reusable source has no dependencies.

## Exports
- `createTypewriterTerminal({ steps?, title?, prompt?, theme?, speed?, start?, seed?, fontFamily? }) => { draw(ctx, info, width, height), revealDuration }` — Canvas 2D terminal layer driven by info.time (seconds); steps are [command, output] pairs.
- `THEMES: { midnight, paper, phosphor, ember }` — Colour themes: window, bar, text, prompt, dim and accent.

## Parameters
- `command1` (text, default "npm create video@latest") — First command
- `output1` (text, default "Scaffolding project… done ✓") — First output
- `command2` (text, default "node render.js --loop") — Second command
- `output2` (text, default "Rendered 240 frames in 3.2 s") — Second output
- `title` (text, default "zsh — 80×24") — Window title
- `theme` (select one of midnight | paper | phosphor | ember, default "midnight") — Theme
- `speed` (number 6–24, default 13) — Typing speed: Characters per second.
- `seed` (integer 1–999, default 7) — Seed
- `background` (color, default "#0a0d14") — Backdrop

## Composition
- Inputs: Canvas 2D context, info.time (seconds), width, height.
- Outputs: Draws the terminal on top of the canvas; does not clear it.
- Coordinates: The window is centred and 86% of the width wide; its height follows the number of lines; type size scales with the smaller side of the canvas.
- Lighting: A soft drop shadow lifts the window; the demo adds a glow of the theme's accent behind it.
- Timing: Pure function of time; the schedule of keystrokes is computed once from the seed; revealDuration says when everything is on screen.
- Works with: kinetic-title, gradient-background
- Monospace metrics are measured, so the caret always lands after the last typed character.
- Text is treated as private: it is not stored in shared packs unless you choose to include it.

## Output and loop
- 1080×1080, 30 fps, 9 s, procedural
- Seamless loop: no — Not a loop: the window arrives, both commands type and print, and the caret blinks on a fresh prompt.
- Verified 2026-10-08 in Chrome 154.0.8037.97 headless on Linux 7.0.0-38-generic (x64), Node 22.14.0 (Canvas 2D); deterministic: yes

## Use it
New project: Create the terminal once, then each frame draw your backdrop and call term.draw(ctx, { time: frame / fps }, width, height).

Existing project: Copy src/typewriter-terminal.js. Call draw on your existing 2D canvas after the rest of the frame.

Reuse ideas:
- Dev tool demo: Midnight.
- Clean docs: Paper, light.
- Hacker look: Phosphor green, fast.

## Limitations
- System fonts differ between computers; pass fontFamily and load the font first for identical renders.
- There is no scrolling: a long session needs a taller window or fewer lines.

## License
MIT. Copyright (c) 2026 AI Pixel Wizard. Released under the MIT License. See LICENSE in this folder.

Provenance: Original code written for AI Pixel Wizard in October 2026, to the catalog quality bar (docs/QUALITY.md).

