{
  "$schema": "../../schema.json",
  "id": "release",
  "type": "recipe",
  "title": "Release",
  "summary": "A record, a single, an episode: the cover art rises in, who and what, a pulse on the track's beat, the date and where to listen, in 15 s.",
  "tags": [
    "recipe",
    "music",
    "podcast",
    "release",
    "cover",
    "1:1",
    "9:16"
  ],
  "version": "1.0.0",
  "license": "MIT",
  "params": [
    {
      "name": "title",
      "type": "string",
      "default": "Title",
      "description": "the record, the single, the episode",
      "group": "main",
      "control": "text"
    },
    {
      "name": "artist",
      "type": "string",
      "default": "",
      "description": "who; empty uses the brand's name",
      "group": "main",
      "control": "text"
    },
    {
      "name": "what",
      "type": "string",
      "default": "the debut EP",
      "description": "what this is, in plain words",
      "group": "main",
      "control": "text"
    },
    {
      "name": "action",
      "type": "string",
      "default": "Out 21 Nov · everywhere you listen",
      "description": "the date and where to listen",
      "group": "main",
      "control": "text"
    },
    {
      "name": "bpm",
      "type": "number",
      "default": 96,
      "min": 50,
      "max": 180,
      "step": 1,
      "description": "the track's tempo: the cover and the bars move on it",
      "group": "main"
    },
    {
      "name": "cover",
      "type": "string",
      "default": "",
      "description": "the square cover art (path); empty fills the sleeve with the brand's shader",
      "group": "main",
      "control": "text"
    },
    {
      "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": "1080x1080",
      "options": [
        "1080x1080",
        "1080x1920",
        "1080x1350",
        "1920x1080"
      ],
      "description": "output size",
      "group": "main",
      "control": "segmented"
    }
  ],
  "install": {
    "kind": "scene"
  },
  "files": [
    {
      "path": "pieces/release/scene.html",
      "content": "<!doctype html>\n<html>\n<head>\n<meta charset=\"utf-8\">\n<title>release</title>\n<!--\n  Recipe · release (15 s, square). A record, a single, an episode: the cover art, who and what, when and where.\n  One idea: the sleeve is an OBJECT. It arrives turning in space (edge first, then its face), the camera orbits it\n  slowly the whole piece, the words stand a step behind it and the bars a step in front, so everything parallaxes on\n  the beat. Pulse: the sleeve breathes on the track's BPM. Close: the camera settles straight on the action.\n  Cover 0–1.5 s · Words 1.5–6 s · Pulse whole piece · Action 9–15 s.\n  Look, fonts, pace and sound come from /brand (serve from the project root). Edit CONFIG first: the cover (a square\n  image), the names, the BPM. Render with the music: `pamo render scene.html --audio track.wav --loudness -14`.\n-->\n<style>\n  #stage { overflow: hidden; }\n  .abs { position: absolute; box-sizing: border-box; }\n  #glow { inset: -20%; filter: blur(70px); opacity: 0.55; background-size: cover; background-position: center; }\n  #sleeve { overflow: hidden; }\n  #sleeve img, #sleeve .fill { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }\n  #bars { display: flex; align-items: flex-end; gap: 4%; }\n  #bars i { flex: 1; display: block; border-radius: 999px; }\n  #words { display: flex; flex-direction: column; align-items: flex-start; text-align: left; }\n  #words.center { align-items: center; text-align: center; }\n</style>\n</head>\n<body>\n<main id=\"stage\">\n  <div id=\"bg\" class=\"abs\" style=\"inset:0\"></div>\n  <div id=\"glow\" class=\"abs\"></div>\n  <div id=\"vig\" class=\"abs\" style=\"inset:0\"></div>\n  <div id=\"world\">\n    <div id=\"words\"><div id=\"title\"></div><div id=\"artist\"></div><div id=\"what\"></div></div>\n    <div id=\"sleeve\"></div>\n    <div id=\"bars\"></div>\n    <div id=\"action\"></div>\n  </div>\n  <div id=\"mark\" class=\"abs\"></div>\n</main>\n<script type=\"module\">\nimport { scene, progress, ease, noise, fract } from 'paper-motion';\nimport { wordRise, blurIn, trackIn } 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 behind everything, or null for the brand's first entry\n  cover: '',                             // the square cover art (path); empty fills the sleeve with the brand's shader\n  title: 'Title',                        // the record, the single, the episode\n  artist: '',                            // who; empty uses the brand's name\n  what: 'the debut EP',                  // what this is, in plain words (\"the debut EP\", \"episode 12\", \"a single\")\n  action: 'Out 21 Nov · everywhere you listen',\n  bpm: 96,                               // the track's tempo: the cover and the bars move on it\n  format: [1080, 1080],\n};\n\nconst B = await loadBrand();\nconst [W, H] = CONFIG.format, SHORT = Math.min(W, H), D = 15, tall = H >= W;   // square and portrait stack the words under the sleeve\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.3;\ndocument.querySelector('#vig').style.background = 'radial-gradient(ellipse at 50% 50%, rgba(0,0,0,0) 35%, rgba(0,0,0,0.65) 100%)';\nconst $ = (id) => document.getElementById(id);\n\nconst DIST = SHORT * 0.75, K = 1 + DIST / (SHORT * 1.8);\nconst cam = camera($('stage'), $('world'), { perspective: SHORT * 1.8 });\n// the sleeve: an object at the origin; the words a step behind it, the bars a step in front\nconst R = (B.tokens?.shape?.radius ?? 12) * (SHORT / 1080) * K;\nconst side = (H > W ? SHORT * 0.56 : tall ? SHORT * 0.34 : SHORT * 0.5) * K;\nconst sleeve = $('sleeve');\nObject.assign(sleeve.style, { width: `${side}px`, height: `${side}px`, borderRadius: `${R * 0.6}px`, background: B.surface(), boxShadow: `0 ${SHORT * 0.04}px ${SHORT * 0.12}px rgba(0,0,0,0.55)` });\nconst sleevePos = { x: tall ? 0 : -SHORT * 0.2 * K, y: tall ? -SHORT * (H > W ? 0.2 : 0.24) * K : -SHORT * 0.04 * K, z: 0 };\nif (CONFIG.cover) {\n  const img = document.createElement('img'); img.src = CONFIG.cover; sleeve.append(img);\n  $('glow').style.backgroundImage = `url(${CONFIG.cover})`;\n} else {\n  const fill = document.createElement('div'); fill.className = 'fill'; sleeve.append(fill);\n  if (bgId) B.shader(s, fill, bgId);\n  const mono = document.createElement('div');\n  Object.assign(mono.style, { position: 'absolute', left: '8%', bottom: '7%', fontFamily: B.font('mono'), fontSize: `${side * 0.05}px`, color: B.color('figure'), letterSpacing: '0.04em' });\n  mono.textContent = (CONFIG.artist || B.name).toUpperCase();\n  sleeve.append(mono);\n  $('glow').style.background = `radial-gradient(circle at 35% 50%, ${B.color('accent')} 0%, ${B.color('ground')} 60%)`;\n}\nconst words = $('words');\nconst ww = (tall ? W * 0.84 : W * 0.42) * K;\nwords.style.width = `${ww}px`; if (tall) words.classList.add('center');\nconst title = B.style($('title'), 'display', { short: SHORT * K }), artist = B.style($('artist'), 'title', { short: SHORT * K, color: 'figure' }), what = B.style($('what'), 'body', { short: SHORT * K, color: 'muted' });\ntitle.textContent = CONFIG.title; artist.textContent = CONFIG.artist || B.name; what.textContent = CONFIG.what;\nartist.style.marginTop = `${SHORT * 0.025}px`; what.style.marginTop = `${SHORT * 0.015}px`;\nObject.assign(what.style, { fontSize: `${SHORT * K * 0.03}px`, lineHeight: 1.35 });\nconst bars = $('bars'), bh = SHORT * 0.07 * K;\nObject.assign(bars.style, { width: `${Math.min(ww, SHORT * 0.4 * K)}px`, height: `${bh}px` });\nbars.innerHTML = Array.from({ length: 12 }, (_, i) => `<i style=\"background:${i === 7 ? B.color('accent') : B.color('figure')};opacity:${i === 7 ? 1 : 0.55}\"></i>`).join('');\nconst barEls = [...bars.children];\nconst action = B.style($('action'), 'body', { short: SHORT * K, color: 'figure' });\nObject.assign(action.style, { fontFamily: B.font('mono'), fontSize: `${SHORT * K * 0.03}px`, letterSpacing: '0em', lineHeight: 1.3, width: `${W * 0.84 * K}px`, textAlign: tall ? 'center' : 'left' });\naction.textContent = CONFIG.action;\nconst mark = B.style($('mark'), 'caption', { short: SHORT, color: 'muted' });\nObject.assign(mark.style, { right: `${W * 0.08}px`, bottom: `${H * 0.085}px`, fontFamily: B.font('mono'), letterSpacing: '0.06em' });\nmark.textContent = B.name.toUpperCase();\nawait document.fonts.ready;\nfor (const el of [title, artist]) { el.style.whiteSpace = 'nowrap'; const k = ww / el.scrollWidth; if (k < 1) el.style.fontSize = `${parseFloat(el.style.fontSize) * Math.max(k, 0.4)}px`; }\n// places: words behind and beside (or under) the sleeve, bars in front, action low in front\nif (tall) sleevePos.y = -(side + SHORT * 0.06 * K + words.offsetHeight + SHORT * 0.05 * K + bh) / 2 + side / 2;\nconst wordsPos = tall ? { x: 0, y: sleevePos.y + side / 2 + SHORT * 0.06 * K + words.offsetHeight / 2, z: -SHORT * 0.12 } : { x: sleevePos.x + side / 2 + SHORT * 0.06 * K + ww / 2, y: sleevePos.y - side * 0.12, z: -SHORT * 0.14 };\ncam.place(words, wordsPos);\nconst barsY = tall ? wordsPos.y + words.offsetHeight / 2 + SHORT * 0.05 * K + bh / 2 : sleevePos.y + side / 2 - bh / 2;\ncam.place(bars, { x: tall ? 0 : wordsPos.x - ww / 2 + Math.min(ww, SHORT * 0.4 * K) / 2, y: barsY, z: SHORT * 0.1 });\n// square and portrait: the action takes the bars' place when it lands (the bars step aside)\ncam.place(action, { x: 0, y: tall ? barsY : H * 0.42 * K, z: SHORT * 0.14 });\n\n// the orbit: a slow arc around the sleeve, settling straight for the action\nconst T = { cover: [0.1, 1.4], title: 1.5, artist: 2.3, what: 3.0, bars: 3.3, action: 9.4, mark: 10.6 };\nconst beat = 60 / CONFIG.bpm;\nconst path = [\n  [0, { x: SHORT * 0.06, y: 0, z: DIST * 1.12, yaw: 10, pitch: 0 }],\n  [T.cover[1] + 0.4, { x: SHORT * 0.02, z: DIST, yaw: 5, pitch: 0 }, ease.outCubic],\n  [T.action, { x: -SHORT * 0.02, yaw: -5, pitch: 0 }, ease.inOutSine],                 // the orbit, slow, through the words\n  [T.action + 1.4, { x: 0, y: 0, z: DIST * 0.98, yaw: 0, pitch: 0 }, ease.inOutCubic],   // straight for the action\n  [D, { z: DIST * 0.94 }, ease.inOutSine],\n];\ns.update((t) => {\n  cam.travel(t, path);\n  cam.focus(DIST, SHORT * 1.4, 6);\n  // the sleeve turns in, edge first, then breathes on the beat\n  const inP = progress(t, ...T.cover, ease.outExpo);\n  const ph = t < T.bars ? 1 : fract((t - T.bars) / beat);\n  const pulse = 1 + 0.014 * Math.exp(-7 * ph) * (t >= T.bars ? 1 : 0);\n  cam.place(sleeve, { ...sleevePos, yaw: (1 - inP) * -70 + Math.sin(t * 0.6) * 2, x: sleevePos.x + (1 - inP) * SHORT * 0.1, scale: pulse * (0.9 + 0.1 * inP) });\n  sleeve.style.opacity = String(Math.min(1, inP * 1.6));\n  $('glow').style.opacity = String(0.5 * inP);\n  wordRise(title, t, { start: T.title, each: B.pace.stagger, duration: 0.9 });\n  trackIn(artist, t, { start: T.artist, duration: 1.0 });\n  blurIn(what, t, { start: T.what, duration: 0.8 });\n  const barsIn = progress(t, T.bars, T.bars + 0.8, ease.outCubic);\n  bars.style.opacity = String(barsIn * (tall ? 1 - progress(t, T.action + 0.3, T.action + 0.9) : 1));\n  barEls.forEach((b, i) => { const n = noise(i * 0.9, t * 1.7), hit = Math.exp(-6 * fract((t - T.bars) / beat + i * 0.05)); b.style.height = `${(0.18 + 0.62 * n + 0.2 * hit) * 100 * barsIn}%`; });\n  blurIn(action, t, { start: T.action + 0.8, duration: 0.9 });\n  blurIn(mark, t, { start: T.mark, duration: 0.8 });\n});\nB.cue(s, 'land', T.cover[1] - 0.2); B.cue(s, 'text', T.title); B.cue(s, 'text', T.artist); B.cue(s, 'transition', T.action); B.cue(s, 'land', T.action + 1.2);\nB.sound(s);\nawait s.start();\n</script>\n</body>\n</html>\n"
    },
    {
      "path": "pieces/release/brief.md",
      "content": "# Release\n\nRecipe: release (15 s, square by default), from paper-motion.app. The look, fonts, pace and sound come from `brand/`.\n\n## Before building\n- Agree the brief with the user: who it is and what this is in plain words (\"the debut EP of an ambient producer\",\n  \"episode 12 of a design podcast\"), the date, where to listen, the format.\n- Get the cover art (a square PNG or JPG) and the track or an excerpt. Put the cover next to this file or under\n  `brand/assets/` and write its path into `CONFIG.cover`; write the track's BPM into `CONFIG.bpm` so the cover and\n  the bars move on its beat.\n- Edit the rest of `CONFIG`: title, artist, what, action, the background id.\n\n## Check and render\n- `npx paper-motion still pieces/release/scene.html --count 6` and look at the contact sheet: cover, words, date.\n- `npx paper-motion render pieces/release/scene.html --audio track.wav --loudness -14 --motion-blur 4`\n  (the music is the user's; the brand's cues sit under it.)\n"
    }
  ],
  "requires": {
    "engine": ">=0.2.1"
  },
  "usage": "npx paper-motion add release --name my-piece\n# put the cover in, edit CONFIG in pieces/my-piece/scene.html, then:\nnpx paper-motion render pieces/my-piece/scene.html --audio track.wav --loudness -14",
  "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).",
    "Made for a cover and a track: render with --audio; the pulse follows CONFIG.bpm, not the audio.",
    "Uses these moves from the engine: word-rise, track-in, blur-in."
  ],
  "related": [
    "social-loop",
    "end-card",
    "word-rise"
  ],
  "preview": {
    "video": "previews/release.webm",
    "poster": "previews/release.jpg",
    "at": 4,
    "values": {
      "title": "Boards",
      "artist": "paper-motion",
      "what": "release 0.2",
      "action": "Out now · paper-motion.app",
      "bpm": 96
    }
  },
  "mood": [
    "calm",
    "editorial",
    "warm"
  ],
  "duration": 15,
  "formats": [
    "1:1",
    "9:16",
    "4:5",
    "16:9"
  ],
  "when": [
    "a record, a single or an episode comes out",
    "you have cover art and the track"
  ],
  "beats": [
    {
      "name": "Cover",
      "from": 0,
      "to": 1.5,
      "what": "the sleeve rises through a mask"
    },
    {
      "name": "Words",
      "from": 1.4,
      "to": 4,
      "what": "title, who, what it is"
    },
    {
      "name": "Pulse",
      "from": 3.2,
      "to": 15,
      "what": "the cover and a row of bars move on the beat"
    },
    {
      "name": "Action",
      "from": 9.4,
      "to": 15,
      "what": "the date and where to listen, then the wordmark"
    }
  ]
}