{
  "$schema": "../../schema.json",
  "version": "1.0.0",
  "license": "MIT",
  "id": "push-in",
  "type": "shot",
  "title": "Push in",
  "summary": "One word or the wordmark and a slow push of the camera onto it, the field sliding slower behind; a small line lands as it stops, in 4 s.",
  "tags": [
    "shot",
    "camera",
    "push",
    "wordmark",
    "opening",
    "title"
  ],
  "params": [
    {
      "name": "word",
      "type": "string",
      "default": "",
      "description": "the word; empty takes the brand's name",
      "group": "main",
      "control": "text"
    },
    {
      "name": "line",
      "type": "string",
      "default": "paper-motion.app",
      "description": "a small line that lands as the push stops",
      "group": "main",
      "control": "text"
    },
    {
      "name": "closeness",
      "type": "number",
      "default": 0.62,
      "min": 0.3,
      "max": 1,
      "step": 0.01,
      "description": "where the push stops: 1 fills the frame, 0.5 leaves air",
      "group": "main"
    },
    {
      "name": "background",
      "type": "string",
      "default": "",
      "description": "a background id from the registry; empty uses the brand's first",
      "group": "advanced",
      "control": "select"
    },
    {
      "name": "format",
      "type": "enum",
      "default": "1920x1080",
      "options": [
        "1920x1080",
        "1080x1920",
        "1080x1080"
      ],
      "description": "output size",
      "group": "main",
      "control": "segmented"
    }
  ],
  "install": {
    "kind": "scene"
  },
  "files": [
    {
      "path": "pieces/push-in/scene.html",
      "content": "<!doctype html>\n<html>\n<head>\n<meta charset=\"utf-8\">\n<title>push-in</title>\n<!--\n  Shot · push in (4 s). One word or the wordmark, and a slow push of the camera onto it: it grows from a line in the\n  distance to the whole frame, the field behind it sliding slower (parallax), and the focus staying on the word.\n  Far 0–0.6 s · Push 0.6–3.2 s · Hold 3.2–4 s.\n  Look, fonts and sound come from /brand. Edit CONFIG: the word (empty takes the brand's name), where the push\n  stops, a small line that lands as it stops. Ask your agent to make it the opening of a piece.\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</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-word\" class=\"place\"><div id=\"word\"></div><div id=\"line\"></div></div>\n  </div>\n</main>\n<script type=\"module\">\nimport { scene, progress, ease } from 'paper-motion';\nimport { blurIn } 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  word: '',                              // the word; empty takes the brand's name\n  line: 'paper-motion.app',              // a small line that lands as the push stops; empty for none\n  closeness: 0.9,                       // where the push stops: 1 fills the frame, 0.5 leaves air\n  format: [1920, 1080],\n};\n\nconst B = await loadBrand();\nconst [W, H] = CONFIG.format, SHORT = Math.min(W, H), D = 4;\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 = 0.5;\ndocument.querySelector('#vig').style.background = 'radial-gradient(ellipse at 50% 50%, rgba(0,0,0,0) 35%, rgba(0,0,0,0.6) 100%)';\nconst $ = (id) => document.getElementById(id);\n\nconst FAR = SHORT * 5, NEAR = SHORT * 0.5 / CONFIG.closeness, K = 1 + NEAR / (SHORT * 1.7);\nconst cam = camera($('stage'), $('world'), { perspective: SHORT * 1.7 });\nconst word = B.style($('word'), 'display', { short: SHORT * K }), line = B.style($('line'), 'body', { short: SHORT * K, color: 'muted' });\nObject.assign(line.style, { fontFamily: B.font('mono'), fontSize: `${SHORT * K * 0.026}px`, marginTop: `${SHORT * 0.03}px` });\nword.textContent = CONFIG.word || B.name; line.textContent = CONFIG.line;\n$('p-word').style.width = `${W * 0.9 * K}px`;\ncam.place($('p-word'), { x: 0, y: 0, z: 0 });\nawait document.fonts.ready;\nword.style.whiteSpace = 'nowrap'; { const k = (W * 0.84 * K * CONFIG.closeness) / word.scrollWidth; word.style.fontSize = `${parseFloat(word.style.fontSize) * k * 1.45}px`; }   // the word fills the frame when the push stops\n\nconst T = { push: [0.6, 3.2] };\ns.update((t) => {\n  const p = progress(t, ...T.push, ease.inOutQuart);\n  cam.at({ x: SHORT * 0.04 * (1 - p), y: 0, z: FAR + (NEAR - FAR) * p, yaw: 4 * (1 - p), pitch: 0 });\n  cam.focus(cam.pos.z, SHORT * 1.6, 5);\n  bg.style.transform = `scale(${1.25 - 0.18 * p})`;                              // the field pushes slower: parallax\n  word.style.opacity = String(progress(t, 0, 0.5));\n  blurIn(line, t, { start: T.push[1] - 0.1, duration: 0.6 });\n});\nB.cue(s, 'transition', T.push[0]); B.cue(s, 'land', T.push[1]);\nB.sound(s);\nawait s.start();\n</script>\n</body>\n</html>\n"
    },
    {
      "path": "pieces/push-in/brief.md",
      "content": "# Push in\n\nShot: push-in (4 s), from paper-motion.app. The look, fonts and sound come from `brand/`.\n\nA shot is one gesture. Edit `CONFIG`: the word (empty takes the brand's name), the line, how close the push ends; check `npx paper-motion still` at 0.3 and 3.4 s; render.\n"
    }
  ],
  "requires": {
    "engine": ">=0.2.6"
  },
  "usage": "npx paper-motion add push-in --name my-shot\n# edit CONFIG in pieces/my-shot/scene.html, then:\nnpx paper-motion render pieces/my-shot/scene.html --motion-blur 6",
  "notes": [
    "Wired to the brand folder: needs brand/tokens.json (a palette and a font pair work) and, for the field, a shader-set entry.",
    "Parallax comes from the field scaling slower than the camera approaches."
  ],
  "related": [
    "zoom-through",
    "end-card"
  ],
  "preview": {
    "video": "previews/push-in.webm",
    "poster": "previews/push-in.jpg",
    "at": 3.4,
    "values": {
      "line": "paper-motion.app"
    }
  },
  "mood": [
    "bold",
    "minimal",
    "calm"
  ],
  "duration": 4,
  "formats": [
    "16:9",
    "9:16",
    "1:1"
  ],
  "beats": [
    {
      "name": "Far",
      "from": 0,
      "to": 0.6,
      "what": "the word small in the distance"
    },
    {
      "name": "Push",
      "from": 0.6,
      "to": 3.2,
      "what": "the camera pushes in; the field lags"
    },
    {
      "name": "Hold",
      "from": 3.2,
      "to": 4,
      "what": "the word holds; the line lands"
    }
  ],
  "when": [
    "the opening of a piece on the name",
    "one word that deserves the whole frame"
  ],
  "needs": [
    {
      "kind": "name",
      "fill": {
        "line": "$brief.action"
      }
    }
  ]
}