{
  "$schema": "../../schema.json",
  "version": "1.0.0",
  "license": "MIT",
  "id": "pass-over",
  "type": "shot",
  "title": "Pass over",
  "summary": "The camera glides across a component at a low angle, close and tilted at the edges, straight at the centre; a caption rides the pass, in 5 s.",
  "tags": [
    "shot",
    "camera",
    "glide",
    "component",
    "ui",
    "caption"
  ],
  "params": [
    {
      "name": "image",
      "type": "string",
      "default": "",
      "description": "the component (path); empty draws a placeholder UI",
      "group": "main",
      "control": "text"
    },
    {
      "name": "caption",
      "type": "string",
      "default": "One board. Every choice adds up.",
      "description": "the line that rides the pass",
      "group": "main",
      "control": "text"
    },
    {
      "name": "direction",
      "type": "enum",
      "default": "right",
      "options": [
        "right",
        "left"
      ],
      "description": "enter from the left and leave right, or the reverse",
      "group": "main",
      "control": "segmented"
    },
    {
      "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/pass-over/scene.html",
      "content": "<!doctype html>\n<html>\n<head>\n<meta charset=\"utf-8\">\n<title>pass-over</title>\n<!--\n  Shot · pass over (5 s). The camera glides across a component at a low angle, like a hand passing over a table:\n  it enters from one side, close and tilted, straightens as it crosses the centre, and leaves the other side. The\n  component stays still; only the camera moves. A caption rides the pass.\n  Enter 0–1.2 s · Cross 1.2–3.8 s · Leave 3.8–5 s.\n  Look, fonts and sound come from /brand. Edit CONFIG: the component (a screenshot, or the drawn placeholder), the\n  caption. Ask your agent to point it at your real UI, flip the direction, or chain it before a recipe.\n-->\n<style>\n  #stage { overflow: hidden; }\n  .abs { position: absolute; box-sizing: border-box; }\n  #comp { overflow: hidden; }\n  #comp img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: top left; }\n  .ui { position: absolute; inset: 0; display: grid; grid-template-columns: 22% 1fr; }\n  .ui .side { display: flex; flex-direction: column; gap: 6%; padding: 7% 14%; }\n  .ui i { display: block; height: 0.55em; border-radius: 999px; opacity: 0.45; }\n  .ui .main { display: flex; flex-direction: column; gap: 4%; padding: 5%; }\n  .ui .row { display: grid; gap: 3%; }\n  .ui .box { border-radius: 0.6em; }\n</style>\n</head>\n<body>\n<main id=\"stage\">\n  <div id=\"bg\" class=\"abs\" style=\"inset:0\"></div>\n  <div id=\"world\">\n    <div id=\"comp\"></div>\n  </div>\n  <div id=\"caption\" class=\"abs\"></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  image: '',                             // the component (path); empty draws a placeholder UI\n  caption: 'One board. Every choice adds up.',\n  direction: 'right',                    // 'right' (enter left, leave right) or 'left'\n  format: [1920, 1080],\n};\n\nconst B = await loadBrand();\nconst [W, H] = CONFIG.format, SHORT = Math.min(W, H), D = 5, dir = CONFIG.direction === 'left' ? -1 : 1;\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);\ndocument.querySelector('#bg').style.opacity = 0.35;\nconst $ = (id) => document.getElementById(id);\n\nconst DIST = SHORT * 0.55, K = 1 + DIST / (SHORT * 1.7);\nconst cam = camera($('stage'), $('world'), { perspective: SHORT * 1.7 });\nconst comp = $('comp'), cw = W * 0.7 * K, ch = cw * 0.56, R = (B.tokens?.shape?.radius ?? 12) * (SHORT / 1080) * K;\nObject.assign(comp.style, { width: `${cw}px`, height: `${ch}px`, borderRadius: `${R}px`, background: B.surface(), border: `1.5px solid ${B.color('muted')}55`, boxShadow: `0 ${SHORT * 0.04}px ${SHORT * 0.12}px rgba(0,0,0,0.5)` });\nif (CONFIG.image) { const img = document.createElement('img'); img.src = CONFIG.image; comp.append(img); }\nelse {\n  const ui = document.createElement('div'); ui.className = 'ui'; ui.style.fontSize = `${cw * 0.012}px`;\n  const line = (w, c = B.color('muted')) => `<i style=\"width:${w}%;background:${c}\"></i>`;\n  const box = (h, c = B.color('ground')) => `<div class=\"box\" style=\"height:${h}px;background:${c};border:1px solid ${B.color('muted')}33\"></div>`;\n  ui.innerHTML = `<div class=\"side\" style=\"background:${B.color('ground')}\">${line(60, B.color('figure'))}${line(80)}${line(55)}${line(70)}${line(40)}</div><div class=\"main\">${line(28, B.color('figure'))}<div class=\"row\" style=\"grid-template-columns:1fr 1fr 1fr\">${box(ch * 0.2)}${box(ch * 0.2, B.color('accent'))}${box(ch * 0.2)}</div>${box(ch * 0.38)}</div>`;\n  comp.append(ui);\n}\ncam.place(comp, { x: 0, y: 0, z: 0, pitch: -8 });           // the component lies back a little, a table\nconst caption = B.style($('caption'), 'title', { short: SHORT, color: 'figure' });\nObject.assign(caption.style, { left: `${W * 0.07}px`, bottom: `${H * 0.09}px`, maxWidth: `${W * 0.6}px`, textAlign: 'left', textShadow: '0 2px 24px rgba(0,0,0,0.75)' });\ncaption.textContent = CONFIG.caption;\nawait document.fonts.ready;\n\n// the pass: low and close at the edge, high and straight at the centre, low again at the far edge\nconst T = { enter: 1.2, leave: 3.8 };\ns.update((t) => {\n  const p = progress(t, 0, D, ease.inOutSine);\n  const x = (-cw * 0.42 + cw * 0.84 * p) * dir;\n  const arc = Math.sin(p * Math.PI);                                           // 0 at the edges, 1 at the centre\n  cam.at({ x: x * 0.8, y: ch * 0.02 - ch * 0.04 * arc, z: DIST * 0.95 + DIST * 0.3 * arc, yaw: dir * (-16 + 32 * p), pitch: -4 + 2 * arc, roll: dir * (2 - 4 * p) * 0.5 });\n  cam.focus(cam.pos.z, SHORT * 1.4, 6);\n  blurIn(caption, t, { start: T.enter, duration: 0.8 });\n  const out = progress(t, T.leave, T.leave + 0.8, ease.inCubic);\n  if (out > 0) caption.style.opacity = String(Math.min(Number(caption.style.opacity || 1), 1 - out));\n});\nB.cue(s, 'transition', 0.1); B.cue(s, 'text', T.enter); B.cue(s, 'transition', T.leave);\nB.sound(s);\nawait s.start();\n</script>\n</body>\n</html>\n"
    },
    {
      "path": "pieces/pass-over/brief.md",
      "content": "# Pass over\n\nShot: pass-over (5 s), from paper-motion.app. The look, fonts and sound come from `brand/`.\n\nA shot is one gesture. Put the real component in `CONFIG.image`, write the caption, pick the direction; check `npx paper-motion still` at 0.6, 2.5 and 4.4 s; render.\n"
    }
  ],
  "requires": {
    "engine": ">=0.2.6"
  },
  "usage": "npx paper-motion add pass-over --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.",
    "Only the camera moves; the component is still. Swap `image` for a real screenshot and the pass reads as a product shot."
  ],
  "related": [
    "product-demo",
    "drift"
  ],
  "preview": {
    "video": "previews/pass-over.webm",
    "poster": "previews/pass-over.jpg",
    "at": 2.5,
    "values": {
      "caption": "One board. Every choice adds up."
    }
  },
  "mood": [
    "calm",
    "technical",
    "luxury"
  ],
  "duration": 5,
  "formats": [
    "16:9",
    "9:16",
    "1:1"
  ],
  "beats": [
    {
      "name": "Enter",
      "from": 0,
      "to": 1.2,
      "what": "low and close at one edge"
    },
    {
      "name": "Cross",
      "from": 1.2,
      "to": 3.8,
      "what": "high and straight over the centre; the caption lands"
    },
    {
      "name": "Leave",
      "from": 3.8,
      "to": 5,
      "what": "low again at the far edge"
    }
  ],
  "when": [
    "a product surface worth looking at",
    "a quiet establishing shot before the words"
  ],
  "needs": [
    {
      "kind": "screen",
      "has": [
        "caption"
      ],
      "fill": {
        "image": "$image",
        "caption": "$caption"
      }
    }
  ]
}