{
  "$schema": "../../schema.json",
  "id": "readme-loop",
  "type": "recipe",
  "title": "README loop",
  "summary": "A silent 6 s loop for a repo or a landing hero: wordmark, one line, the install command typing and erasing.",
  "tags": [
    "recipe",
    "loop",
    "readme",
    "hero",
    "silent"
  ],
  "version": "1.0.0",
  "license": "MIT",
  "params": [
    {
      "name": "line",
      "type": "string",
      "default": "",
      "description": "one plain line; empty reads IDENTITY.md",
      "group": "main",
      "control": "text"
    },
    {
      "name": "command",
      "type": "string",
      "default": "npx skills add your/repo",
      "description": "the install command",
      "group": "main",
      "control": "text"
    },
    {
      "name": "background",
      "type": "string",
      "default": "",
      "description": "a background id from the registry; empty uses the brand's first",
      "group": "main",
      "control": "select"
    }
  ],
  "install": {
    "kind": "scene"
  },
  "files": [
    {
      "path": "pieces/readme-loop/scene.html",
      "content": "<!doctype html>\n<html>\n<head>\n<meta charset=\"utf-8\">\n<title>readme loop</title>\n<!--\n  Recipe · README loop (6 s, seamless, 1600×900). For a repository or a landing page hero; silent.\n  Field: a calm shader behind the wordmark · What: the wordmark and one plain line · Command 0.4–2 s: the install\n  command types in and holds · Erase 5–5.5 s: it erases, so the loop closes on an empty prompt.\n  Deliver mp4 and gif: pamo render scene.html --format gif --gif-width 800. Edit CONFIG first.\n-->\n<style>\n  #stage { overflow: hidden; }\n  .abs { position: absolute; box-sizing: border-box; }\n  #cur { display: inline-block; width: 0.55em; height: 1em; vertical-align: -0.15em; margin-left: 3px; }\n</style>\n</head>\n<body>\n<main id=\"stage\">\n  <div id=\"bg\" class=\"abs\" style=\"inset:0\"></div>\n  <div class=\"abs\" style=\"inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center\">\n    <div id=\"mark\"></div><div id=\"line\"></div><div id=\"cmdrow\"><span id=\"pr\">$ </span><span id=\"cmd\"></span><span id=\"cur\"></span></div>\n  </div>\n</main>\n<script type=\"module\">\nimport { scene } from 'paper-motion';\nimport { typeOn, typingTimes } from 'paper-motion/moves';\nimport { loadBrand } from 'paper-motion/brand';\n\nconst CONFIG = {\n  background: null,                       // a calm shader-set id, or null for the brand's first entry\n  backgroundOpacity: 0.85,                 // the shader behind the type; 1 for a field with no words over it\n  line: null,                             // null reads IDENTITY.md \"In one line\"\n  command: 'npx skills add your/repo',\n};\n\nconst B = await loadBrand();\nconst W = 1600, H = 900, SHORT = H, D = 6;\nconst s = scene({ width: W, height: H, fps: 30, duration: D, background: B.color('ground') });\nconst bgId = CONFIG.background ?? B.set.entries.find((e) => e.shader && !e.image)?.id;\nif (bgId) B.shader(s, '#bg', bgId, { loop: D });\ndocument.querySelector('#bg').style.opacity = CONFIG.backgroundOpacity;   // the material sits behind the type, never over it\n\nconst mark = B.style(document.querySelector('#mark'), 'display', { short: SHORT });\nconst line = B.style(document.querySelector('#line'), 'body', { short: SHORT, color: 'muted' });\nline.style.fontSize = `${SHORT * 0.03}px`;\nconst row = document.querySelector('#cmdrow'), cmd = document.querySelector('#cmd'), cur = document.querySelector('#cur');\nObject.assign(row.style, { fontFamily: B.font('mono'), fontSize: `${SHORT * 0.026}px`, color: B.color('figure'), marginTop: `${SHORT * 0.06}px` });\ndocument.querySelector('#pr').style.color = B.color('muted');\nline.style.marginTop = `${SHORT * 0.02}px`;\ncur.style.background = B.color('figure');\nmark.textContent = B.name;\nline.textContent = CONFIG.line ?? ((B.identity['In one line'] ?? '').split('\\n')[0] || '');\nawait document.fonts.ready;\nconst fit = (W * 0.8) / mark.scrollWidth;\nif (fit < 1) mark.style.fontSize = `${parseFloat(mark.style.fontSize) * fit}px`;\n\nconst times = typingTimes(CONFIG.command, { start: 0.4, cps: 20, seed: 5 });\nconst N = CONFIG.command.length;\ns.update((t) => {\n  if (t < 5) typeOn(cmd, CONFIG.command, t, { times, cursor: cur });\n  else { const k = Math.max(0, N - Math.floor((t - 5) / 0.5 * N)); cmd.textContent = CONFIG.command.slice(0, k); cur.style.opacity = 1; }\n});\nawait s.start();\n</script>\n</body>\n</html>\n"
    },
    {
      "path": "pieces/readme-loop/brief.md",
      "content": "# README loop\n\nRecipe: readme loop (6 s), from paper-motion.app. The look, fonts, pace and sound come from `brand/`.\n\n## Before building\n- Agree the brief with the user: what the brand is in plain words, the one action at the end, the format.\n- Edit `CONFIG` at the top of scene.html: the copy, the background id, the format.\n- Swap the moves for the ones the user picked (`npx paper-motion add <id>`) and put real material where there is some.\n\n## Check and render\n- `npx paper-motion still pieces/readme-loop/scene.html --count 8` and look at the contact sheet.\n- `npx paper-motion render pieces/readme-loop/scene.html --motion-blur 5`\n"
    }
  ],
  "requires": {
    "engine": ">=0.2.0"
  },
  "usage": "npx paper-motion add readme-loop --name my-piece\n# edit CONFIG in pieces/my-piece/scene.html, then:\nnpx paper-motion render pieces/my-piece/scene.html --motion-blur 5",
  "notes": [
    "Wired to the brand folder: needs brand/tokens.json (a palette and a font pair work: pamo add sage-night instrument) and, for the background, a shader-set entry (pamo add mesh-sage).",
    "Structure and timing only; the look always comes from the brand.",
    "Uses these moves from the engine: type-on."
  ],
  "related": [
    "type-on"
  ],
  "preview": {
    "video": "previews/readme-loop.webm",
    "poster": "previews/readme-loop.jpg",
    "at": 3.5,
    "values": {
      "line": "Brand videos, made by your coding agent.",
      "command": "npx skills add solanodz/paper-motion"
    }
  },
  "mood": [
    "technical",
    "minimal"
  ],
  "duration": 6,
  "formats": [
    "16:9"
  ],
  "when": [
    "a repo or landing hero",
    "a silent loop with the install command"
  ],
  "beats": [
    {
      "name": "Field",
      "from": 0,
      "to": 6,
      "what": "a calm background behind the wordmark"
    },
    {
      "name": "Command",
      "from": 0.4,
      "to": 2,
      "what": "the install command types in"
    },
    {
      "name": "Erase",
      "from": 5,
      "to": 5.5,
      "what": "it erases; the loop closes on an empty prompt"
    }
  ]
}