{
  "$schema": "../../schema.json",
  "id": "launch",
  "type": "recipe",
  "title": "Launch",
  "summary": "Something new exists: hook, problem, reveal, three proof moments and a close, in 24 s.",
  "tags": [
    "recipe",
    "launch",
    "product",
    "16:9"
  ],
  "version": "1.0.0",
  "license": "MIT",
  "params": [
    {
      "name": "hook",
      "type": "string",
      "default": "Something new is here.",
      "description": "the boldest claim",
      "group": "main",
      "control": "text"
    },
    {
      "name": "problem",
      "type": "string",
      "default": "The situation it changes, in the brand’s words.",
      "description": "the problem line",
      "group": "main",
      "control": "text"
    },
    {
      "name": "what",
      "type": "string",
      "default": "",
      "description": "what it is; empty reads IDENTITY.md",
      "group": "main",
      "control": "text"
    },
    {
      "name": "action",
      "type": "string",
      "default": "your.site",
      "description": "where to get it",
      "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"
    },
    {
      "name": "format",
      "type": "enum",
      "default": "1920x1080",
      "options": [
        "1920x1080",
        "1080x1920",
        "1080x1080"
      ],
      "description": "output size",
      "group": "main",
      "control": "segmented"
    },
    {
      "name": "proof1Label",
      "type": "string",
      "default": "01 · fast",
      "description": "proof 1 label",
      "group": "advanced",
      "control": "text"
    },
    {
      "name": "proof1Title",
      "type": "string",
      "default": "Fact one",
      "description": "proof 1 title",
      "group": "advanced",
      "control": "text"
    },
    {
      "name": "proof1Body",
      "type": "string",
      "default": "A real number or a real result.",
      "description": "proof 1 line",
      "group": "advanced",
      "control": "text"
    },
    {
      "name": "proof2Label",
      "type": "string",
      "default": "02 · simple",
      "description": "proof 2 label",
      "group": "advanced",
      "control": "text"
    },
    {
      "name": "proof2Title",
      "type": "string",
      "default": "Fact two",
      "description": "proof 2 title",
      "group": "advanced",
      "control": "text"
    },
    {
      "name": "proof2Body",
      "type": "string",
      "default": "What it replaces, in one line.",
      "description": "proof 2 line",
      "group": "advanced",
      "control": "text"
    },
    {
      "name": "proof3Label",
      "type": "string",
      "default": "03 · yours",
      "description": "proof 3 label",
      "group": "advanced",
      "control": "text"
    },
    {
      "name": "proof3Title",
      "type": "string",
      "default": "Fact three",
      "description": "proof 3 title",
      "group": "advanced",
      "control": "text"
    },
    {
      "name": "proof3Body",
      "type": "string",
      "default": "Who it is for, and why now.",
      "description": "proof 3 line",
      "group": "advanced",
      "control": "text"
    }
  ],
  "install": {
    "kind": "scene"
  },
  "files": [
    {
      "path": "pieces/launch/scene.html",
      "content": "<!doctype html>\n<html>\n<head>\n<meta charset=\"utf-8\">\n<title>launch</title>\n<!--\n  Recipe · launch (24 s). Something new exists: hook, problem, reveal, three proofs, close.\n  One idea carries it: the words and the cards stand in a corridor of space and ONE camera travels through them,\n  front to back. Each beat is a place; the previous one slides past the lens and out of focus as the camera arrives\n  at the next. Angles change on the way (yaw, a little pitch), the proofs stand at different sides of the path, and\n  the close is the camera coming to rest.\n  Hook 0–2.4 s · Problem 2.4–5.8 s · Reveal 5.8–9 s · Proof 9–19.6 s · Close 19.6–24 s.\n  Look, fonts, pace and sound come from /brand (serve from the project root). Edit CONFIG first; put real material\n  in the proof cards when there is some (a screenshot, a number).\n-->\n<style>\n  #stage { overflow: hidden; }\n  .abs { position: absolute; box-sizing: border-box; }\n  .place { display: flex; flex-direction: column; align-items: center; text-align: center; box-sizing: border-box; }\n  .card { box-sizing: border-box; display: flex; flex-direction: column; align-items: flex-start; text-align: left; overflow: hidden; }\n</style>\n</head>\n<body>\n<main id=\"stage\">\n  <div id=\"bg\" class=\"abs\" style=\"inset:0\"></div>\n  <div id=\"vig\" class=\"abs\" style=\"inset:0\"></div>\n  <div id=\"world\">\n    <div id=\"p-hook\" class=\"place\"><div id=\"hook\"></div></div>\n    <div id=\"p-problem\" class=\"place\"><div id=\"problem\"></div></div>\n    <div id=\"p-reveal\" class=\"place\"><div id=\"name\"></div><div id=\"what\"></div></div>\n    <div id=\"p-close\" class=\"place\"><div id=\"mark\"></div><div id=\"action\"></div></div>\n  </div>\n</main>\n<script type=\"module\">\nimport { scene, progress, ease } from 'paper-motion';\nimport { wordRise, blurIn, popIn } from 'paper-motion/moves';\nimport { camera } from 'paper-motion/kit';\nimport { loadBrand } from 'paper-motion/brand';\n\nconst CONFIG = {\n  background: null,                      // a shader-set id, or null for the brand's first entry\n  backgroundOpacity: 0.5,                // the field behind the corridor; the type stays readable\n  hook: 'Something new is here.',\n  problem: 'The situation it changes, in the brand’s words.',\n  what: null,                            // what the brand is, in plain words; null reads IDENTITY.md\n  proof: [\n    { label: '01 · fast', title: 'Fact one', body: 'A real number or a real result.' },\n    { label: '02 · simple', title: 'Fact two', body: 'What it replaces, in one line.' },\n    { label: '03 · yours', title: 'Fact three', body: 'Who it is for, and why now.' },\n  ],\n  action: 'your.site',\n  format: [1920, 1080],\n};\n\nconst B = await loadBrand();\nconst [W, H] = CONFIG.format, SHORT = Math.min(W, H), D = 24;\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);\nconst bg = document.querySelector('#bg'); bg.style.opacity = CONFIG.backgroundOpacity;\ndocument.querySelector('#vig').style.background = 'radial-gradient(ellipse at 50% 55%, rgba(0,0,0,0) 30%, rgba(0,0,0,0.6) 100%)';\nconst $ = (id) => document.getElementById(id);\n\n// the corridor: one place per beat, a step of STEP along -z; the camera looks from DIST in front of each place\nconst STEP = SHORT * 1.3, DIST = SHORT * 0.65, K = 1 + DIST / (SHORT * 1.7);   // K: type sized up for the distance\nconst cam = camera($('stage'), $('world'), { perspective: SHORT * 1.7 });\nconst hook = B.style($('hook'), 'display', { short: SHORT * K }), problem = B.style($('problem'), 'title', { short: SHORT * K, color: 'muted' });\nconst name = B.style($('name'), 'display', { short: SHORT * K }), what = B.style($('what'), 'title', { short: SHORT * K, color: 'muted' });\nconst mark = B.style($('mark'), 'display', { short: SHORT * K }), action = B.style($('action'), 'body', { short: SHORT * K, color: 'figure' });\nObject.assign(action.style, { fontFamily: B.font('mono'), fontSize: `${SHORT * K * 0.028}px`, letterSpacing: '0em', marginTop: `${SHORT * 0.03}px` });\nwhat.style.marginTop = `${SHORT * 0.03}px`;\nfor (const el of [hook, problem, name, what]) el.style.maxWidth = '18ch';\nhook.textContent = CONFIG.hook; problem.textContent = CONFIG.problem;\nname.textContent = mark.textContent = B.name;\nwhat.textContent = CONFIG.what ?? ((B.identity['In one line'] ?? '').split('\\n')[0] || '');\naction.textContent = CONFIG.action;\nfor (const el of ['p-hook', 'p-problem', 'p-reveal', 'p-close']) $(el).style.width = `${W * 0.9}px`;\n\n// the places: the words straight ahead, the proofs on alternating sides of the path, each turned toward it\nconst Z = (i) => -i * STEP;\ncam.place($('p-hook'), { z: Z(0) });\ncam.place($('p-problem'), { z: Z(1), x: SHORT * 0.08, yaw: -5 });\ncam.place($('p-reveal'), { z: Z(2) });\nconst R = (B.tokens?.shape?.radius ?? 12) * (SHORT / 1080) * K;\nconst cw = SHORT * 0.92 * K, ch = cw * 0.58;\nconst cards = CONFIG.proof.map((p, i) => {\n  const c = document.createElement('div');\n  c.className = 'card';\n  const light = i === 1;\n  Object.assign(c.style, { width: `${cw}px`, height: `${ch}px`, padding: `${cw * 0.07}px`, borderRadius: `${R}px`, background: light ? B.color('accent', '#E9E4D8') : B.surface(), color: light ? B.color('ground') : B.color('figure'), border: `1.5px solid ${light ? 'transparent' : B.color('muted') + '55'}`, boxShadow: `0 ${SHORT * 0.03}px ${SHORT * 0.1}px rgba(0,0,0,0.45)` });\n  c.innerHTML = `<div data-part=\"label\"></div><div data-part=\"title\"></div><div data-part=\"body\"></div>`;\n  B.style(c.children[0], 'caption', { short: SHORT * K, color: light ? 'ground' : 'muted' }).textContent = p.label;\n  B.style(c.children[1], 'title', { short: SHORT * K, color: light ? 'ground' : 'figure' }).textContent = p.title;\n  B.style(c.children[2], 'body', { short: SHORT * K, color: light ? 'ground' : 'muted' }).textContent = p.body;\n  c.children[1].style.marginTop = `${SHORT * 0.02}px`; c.children[2].style.marginTop = 'auto';\n  Object.assign(c.children[2].style, { fontSize: `${SHORT * K * 0.03}px`, lineHeight: 1.35, maxWidth: '26ch' });\n  $('world').append(c);\n  // left of the path, right of the path, left again; each card turned a little toward the camera's way in\n  cam.place(c, { z: Z(3 + i), x: [-1, 1, -0.6][i] * SHORT * 0.22, y: [0, 0.05, -0.04][i] * SHORT, yaw: [14, -16, 10][i], pitch: [0, 2, -2][i] });\n  return c;\n});\ncam.place($('p-close'), { z: Z(6) });\nawait document.fonts.ready;\nfor (const el of [hook, name, mark]) { el.style.whiteSpace = 'nowrap'; const k = (W * 0.84) / el.scrollWidth; if (k < 1) el.style.fontSize = `${parseFloat(el.style.fontSize) * k}px`; }\n\n// the camera's path: at rest in front of each place, travelling between them; the angle changes on the way\nconst T = { problem: 2.4, reveal: 5.8, proof: 9.0, card2: 12.6, card3: 16.2, close: 19.6 };\nconst at = (i, extra = {}) => ({ z: Z(i) + DIST, ...extra });\nconst path = [\n  [0, at(0, { x: 0, y: 0, yaw: 3, pitch: -1, zoom: 1 })],\n  [T.problem - 0.6, at(0, { yaw: 3 })],\n  [T.problem + 0.9, at(1, { x: SHORT * 0.08, yaw: -4, pitch: 1 }), ease.inOutCubic],\n  [T.reveal - 0.5, at(1, { yaw: -4 })],\n  [T.reveal + 1.0, at(2, { x: 0, yaw: 0, pitch: 0 }), ease.inOutCubic],\n  [T.proof - 0.5, at(2)],\n  [T.proof + 0.9, at(3, { x: -SHORT * 0.16, y: 0, yaw: 10, pitch: 0 }), ease.inOutCubic],\n  [T.card2 - 0.6, at(3, { yaw: 12 })],\n  [T.card2 + 0.9, at(4, { x: SHORT * 0.14, y: SHORT * 0.04, yaw: -12, pitch: 2 }), ease.inOutCubic],\n  [T.card3 - 0.6, at(4, { yaw: -14 })],\n  [T.card3 + 0.9, at(5, { x: -SHORT * 0.08, y: -SHORT * 0.03, yaw: 7, pitch: -2 }), ease.inOutCubic],\n  [T.close - 0.6, at(5, { yaw: 8 })],\n  [T.close + 1.2, at(6, { x: 0, y: 0, yaw: 0, pitch: 0 }), ease.inOutQuart],\n  [D, at(6, { z: Z(6) + DIST * 0.92 }), ease.inOutSine],\n];\ns.update((t) => {\n  cam.travel(t, path);\n  cam.focus(DIST, SHORT * 0.9, 10);\n  // the field drifts with the journey, slower than the world: depth without a third layer\n  bg.style.transform = `scale(${1.08 + 0.1 * progress(t, 0, D)}) translateX(${-SHORT * 0.03 * progress(t, 0, D)}px)`;\n  // each place wakes as the camera arrives\n  wordRise(hook, t, { start: 0.2, each: B.pace.stagger, duration: 0.9 });\n  blurIn(problem, t, { start: T.problem - 0.1, duration: 0.9 });\n  wordRise(name, t, { start: T.reveal - 0.05, each: B.pace.stagger, duration: 0.9 });\n  blurIn(what, t, { start: T.reveal + 0.5, duration: 0.8 });\n  const starts = [T.proof - 0.1, T.card2 - 0.1, T.card3 - 0.1];\n  cards.forEach((c, i) => { popIn(c.children[1], t, { start: starts[i] }); blurIn(c.children[2], t, { start: starts[i] + 0.35, duration: 0.6 }); });\n  wordRise(mark, t, { start: T.close - 0.1, each: B.pace.stagger, duration: 0.9 });\n  blurIn(action, t, { start: T.close + 0.7, duration: 0.8 });\n});\nB.cue(s, 'land', 0.2); B.cue(s, 'transition', T.problem); B.cue(s, 'text', T.problem + 0.5); B.cue(s, 'transition', T.reveal); B.cue(s, 'land', T.reveal + 0.6);\nB.cue(s, 'transition', T.proof); B.cue(s, 'land', T.proof + 0.5); B.cue(s, 'transition', T.card2); B.cue(s, 'land', T.card2 + 0.5); B.cue(s, 'transition', T.card3); B.cue(s, 'land', T.card3 + 0.5);\nB.cue(s, 'transition', T.close); B.cue(s, 'land', T.close + 0.8);\nB.sound(s);\nawait s.start();\n</script>\n</body>\n</html>\n"
    },
    {
      "path": "pieces/launch/brief.md",
      "content": "# Launch\n\nRecipe: launch (24 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/launch/scene.html --count 8` and look at the contact sheet.\n- `npx paper-motion render pieces/launch/scene.html --motion-blur 5`\n"
    }
  ],
  "requires": {
    "engine": ">=0.2.0"
  },
  "usage": "npx paper-motion add launch --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: zoom-through, flip-lift, whip-pan, flash, word-rise, blur-in, pop-in."
  ],
  "related": [
    "zoom-through",
    "flip-lift",
    "whip-pan"
  ],
  "preview": {
    "video": "previews/launch.webm",
    "poster": "previews/launch.jpg",
    "at": 8.2,
    "values": {
      "hook": "Your agent can direct.",
      "problem": "Motion tools were made for hands. Agents have none.",
      "what": "Brand videos, made by your coding agent.",
      "action": "paper-motion.app",
      "proof1Label": "01 · named",
      "proof1Title": "Resources with a name",
      "proof1Body": "Moves, backgrounds, palettes, fonts, recipes.",
      "proof2Label": "02 · yours",
      "proof2Title": "Code you own",
      "proof2Body": "npx paper-motion add magic-move",
      "proof3Label": "03 · exact",
      "proof3Title": "Every frame rendered",
      "proof3Body": "Same input, same pixels."
    }
  },
  "mood": [
    "bold",
    "editorial"
  ],
  "duration": 24,
  "formats": [
    "16:9",
    "9:16",
    "1:1"
  ],
  "when": [
    "announcing something new",
    "you have proof: facts, UI, a command"
  ],
  "beats": [
    {
      "name": "Hook",
      "from": 0,
      "to": 2.4,
      "what": "one striking line over the brand's field, already moving"
    },
    {
      "name": "Problem",
      "from": 2.4,
      "to": 5.8,
      "what": "the situation it changes, in the brand's words"
    },
    {
      "name": "Reveal",
      "from": 5.8,
      "to": 9,
      "what": "the name and what it is, through a zoom"
    },
    {
      "name": "Proof",
      "from": 9,
      "to": 19.6,
      "what": "three cards, one component that flips and whips"
    },
    {
      "name": "Close",
      "from": 19.6,
      "to": 24,
      "what": "the wordmark and the action"
    }
  ]
}