{
  "fonts": [
    { "family": "Schibsted Grotesk", "path": "fonts/SchibstedGrotesk.ttf" },
    { "family": "Schibsted Grotesk", "path": "fonts/SchibstedGrotesk-Italic.ttf" },
    { "family": "JetBrains Mono", "path": "fonts/JetBrainsMono.ttf" }
  ],
  "theme": {
    "color": {
      "ground": "#131210", "surface": "#1d1b18", "rule": "#34312b",
      "text": "#efebe2", "mute": "#8f8a7f", "pencil": "#f05a4e", "blue": "#6aa6e8"
    },
    "type": {
      "display": { "font": "Schibsted Grotesk", "size": 120, "weight": 860, "tracking": -0.045, "leading": 0.92, "fill": "$color.text" },
      "italic": { "font": "Schibsted Grotesk", "italic": true, "weight": 400, "tracking": -0.03 },
      "label": { "font": "JetBrains Mono", "size": 13, "tracking": 0.14, "uppercase": true, "fill": "$color.mute" },
      "note": { "font": "JetBrains Mono", "size": 15, "tracking": 0.01, "fill": "$color.text" }
    },
    "motion": {
      "glide": { "ease": [0.22, 1, 0.36, 1], "duration": "0.9s" },
      "settle": { "spring": 0.2, "duration": "0.8s" },
      "cut": { "ease": "easeOutQuint", "duration": "0.45s" }
    },
    "styles": {
      "plate": { "x": 64, "y": 620, "width": 820, "height": 60, "anchor": "top-left",
                 "layout": { "direction": "column", "gap": 8, "align": "start", "justify": "start" },
                 "stagger": { "over": "0.25s" } },
      "hairline": { "fill": null, "stroke": "$color.text", "strokeWidth": 1.25 }
    }
  },
  "compositions": [{
    "id": "generative-bloom",
    "description": "Generative bloom: rays, moiré line fields, a wave-interference dot field, an orrery and a guilloché rose, all breathing with the music and all written as data",
    "width": 1280, "height": 720, "fps": 30, "duration": "30s",
    "background": "$color.ground",
    "grain": 0.035,
    "markers": {
      "seed": "0s", "title": "2s", "moire": "6s", "rings": "8s", "field": "12s", "shift": "16s",
      "open": "10s", "orbit": "18s", "bloom": "24s", "data": "25s", "sign": "28s"
    },
    "layers": [
      { "id": "music", "type": "audio", "src": "assets/music.mp3", "loop": true, "duration": "30s", "volume": 0.9, "fadeOut": "1.6s" },

      { "id": "scenes", "type": "group", "series": true, "children": [

        { "id": "seed", "type": "group", "duration": "6s", "comment": "01 · a dial, a ring, 144 noise rays, the title", "children": [
          { "id": "seed-dial", "type": "ellipse", "width": 560, "fill": null, "stroke": "$color.rule", "strokeWidth": 10,
            "dash": [1.25, 9.6], "lineCap": "butt", "rotation": "=t * 3" },
          { "id": "seed-hand", "type": "arc", "width": 560, "stroke": "$color.pencil", "strokeWidth": 10, "lineCap": "butt",
            "startAngle": "=gt * 48", "endAngle": "=gt * 48 + 3 + 9 * bass" },
          { "id": "seed-ring", "type": "arc", "width": 276, "stroke": "$color.text", "strokeWidth": 1.25,
            "startAngle": 0, "endAngle": { "from": 0, "to": 360, "duration": "1.4s", "ease": "easeInOutCubic" } },
          { "id": "seed-dot", "type": "ellipse", "width": 9, "fill": "$color.text", "scale": "=1 + 0.9 * beat", "end": "@title+0.25s",
            "exit": { "to": { "scale": 0 }, "duration": "0.25s", "ease": "easeInCubic" } },
          { "id": "seed-ray", "type": "rect", "width": 2, "anchor": "bottom", "fill": "$color.text", "start": "0.6s",
            "repeat": { "count": 144, "layout": "radial", "radius": 146, "rotate": true, "stagger": { "over": "1.4s" } },
            "height": "=20 + 175 * pow(noise2(cos(i / n * tau) * 1.7 + t * 0.35, sin(i / n * tau) * 1.7), 1.6) * (0.75 + 0.5 * bass)",
            "enter": { "from": { "scaleY": 0, "opacity": 0 }, "motion": "glide" } },
          { "id": "title", "type": "text", "start": "@title", "duration": "3.5s", "style": "$type.display",
            "text": ["Generative ", { "text": "bloom.", "italic": true, "fontWeight": 400 }],
            "blendMode": "difference", "stagger": { "by": "char", "over": "0.5s" },
            "enter": { "from": { "opacity": 0, "y": "0.35em", "blur": "0.08em" }, "motion": "cut" },
            "exit": { "to": { "opacity": 0, "y": "-0.15em" }, "duration": "0.35s" } },
          { "id": "seed-plate", "type": "group", "style": "$styles.plate", "start": "0.3s", "children": [
            { "id": "seed-no", "type": "text", "style": "$type.label", "align": "left", "text": "01 — Seed", "enter": "fadeUp" },
            { "id": "seed-eq", "type": "text", "style": "$type.note", "align": "left", "enter": "fadeUp",
              "text": "rect × 144, radial · height = noise2(cos θ, sin θ)" }
          ] }
        ] },

        { "id": "moire", "type": "group", "duration": "6.5s", "comment": "02 · two line fields XOR'd inside an iris that opens from the seed ring",
          "transition": { "type": "wipeRight", "duration": "0.5s", "ease": "easeInOutCubic", "edge": { "color": "$color.pencil", "width": 6 } },
          "children": [
          { "id": "iris", "type": "group", "lint": { "ignore": ["offCanvas"] },
            "mask": { "id": "iris-matte", "type": "ellipse", "fill": "#fff",
                      "width": "=276 + 244 * glide(clamp(t / 1.6, 0, 1)) + 1080 * glide(clamp(since('open') / 1.1, 0, 1)) + 16 * bass",
                      "height": "=276 + 244 * glide(clamp(t / 1.6, 0, 1)) - 24 * glide(clamp(since('open') / 1.1, 0, 1)) + 16 * bass" },
            "children": [
              { "id": "field-a", "type": "group", "rotation": "=sin(t * 0.45) * 5", "children": [
                { "id": "line-a", "type": "rect", "width": 3, "height": 780, "fill": "$color.text",
                  "repeat": { "count": 160, "layout": "row", "spacing": 10 } }
              ] },
              { "id": "field-b", "type": "group", "rotation": "=2 - sin(t * 0.45) * 5", "scale": "=1.01 + 0.025 * bass",
                "blendMode": "difference", "children": [
                { "id": "line-b", "type": "rect", "width": 3, "height": 780, "fill": "$color.text",
                  "repeat": { "count": 160, "layout": "row", "spacing": 10 } }
              ] },
              { "id": "rings", "type": "ellipse", "start": "@rings", "blendMode": "difference", "style": "$styles.hairline",
                "strokeWidth": 3, "repeat": { "count": 22, "stagger": { "over": "0.8s", "from": "first" } },
                "width": "=24 + i * 26", "height": "=24 + i * 26", "x": "=640 + 60 * sin(t * 1.1)", "y": "=360 + 24 * cos(t * 0.8)",
                "enter": { "from": { "opacity": 0, "scale": 0.6 }, "motion": "glide" } }
            ] },
          { "id": "moire-dial", "type": "ellipse", "width": 560, "fill": null, "stroke": "$color.rule", "strokeWidth": 10,
            "dash": [1.25, 9.6], "lineCap": "butt", "end": "@open+0.5s",
            "exit": { "to": { "opacity": 0, "scale": 1.25 }, "duration": "0.5s", "ease": "easeInCubic" }, "rotation": "=gt * 3" },
          { "id": "moire-hand", "type": "arc", "width": 560, "stroke": "$color.pencil", "strokeWidth": 10, "lineCap": "butt", "end": "@open+0.5s",
            "exit": { "to": { "opacity": 0, "scale": 1.25 }, "duration": "0.5s", "ease": "easeInCubic" },
            "startAngle": "=gt * 48", "endAngle": "=gt * 48 + 3 + 9 * bass" },
          { "id": "iris-edge", "type": "ellipse", "style": "$styles.hairline",
            "width": "=276 + 244 * glide(clamp(t / 1.6, 0, 1)) + 1080 * glide(clamp(since('open') / 1.1, 0, 1)) + 16 * bass",
                      "height": "=276 + 244 * glide(clamp(t / 1.6, 0, 1)) - 24 * glide(clamp(since('open') / 1.1, 0, 1)) + 16 * bass" },
          { "id": "moire-plate", "type": "group", "style": "$styles.plate", "start": "0.3s", "children": [
            { "id": "moire-no", "type": "text", "style": "$type.label", "align": "left", "text": "02 — Interference", "enter": "fadeUp" },
            { "id": "moire-eq", "type": "text", "style": "$type.note", "align": "left", "enter": "fadeUp",
              "text": "160 + 160 lines, 22 rings · blendMode difference" }
          ] }
        ] },

        { "id": "field", "type": "group", "duration": "6s", "comment": "03 · 435 dots sized by two moving wave sources",
          "children": [
          { "id": "dot", "type": "ellipse", "x": 640, "y": 340, "width": 30,
            "repeat": { "count": 435, "layout": "grid", "cols": 29, "spacing": 36, "stagger": { "over": "0.9s", "from": "center" } },
            "scale": "=0.08 + pow((0.5 + 0.25 * sin(sqrt(pow((i % 29 - 14) * 36 + 210 * cos(t * 0.6), 2) + pow((floor(i / 29) - 7) * 36 + 60 * sin(t * 0.9), 2)) * 0.024 - t * 3.2) + 0.25 * sin(sqrt(pow((i % 29 - 14) * 36 - 210 * cos(t * 0.6), 2) + pow((floor(i / 29) - 7) * 36 - 60 * sin(t * 0.9), 2)) * 0.024 - t * 3.2)), 2) * (0.85 + 0.3 * bass)",
            "fill": "=(0.5 + 0.25 * sin(sqrt(pow((i % 29 - 14) * 36 + 210 * cos(t * 0.6), 2) + pow((floor(i / 29) - 7) * 36 + 60 * sin(t * 0.9), 2)) * 0.024 - t * 3.2) + 0.25 * sin(sqrt(pow((i % 29 - 14) * 36 - 210 * cos(t * 0.6), 2) + pow((floor(i / 29) - 7) * 36 - 60 * sin(t * 0.9), 2)) * 0.024 - t * 3.2)) > 0.86 ? (since('shift') < 0 ? $color.pencil : $color.blue) : $color.text",
            "enter": { "from": { "scale": 0 }, "motion": "settle" } },
          { "id": "field-plate", "type": "group", "style": "$styles.plate", "start": "0.3s", "children": [
            { "id": "field-no", "type": "text", "style": "$type.label", "align": "left", "text": "03 — Field", "enter": "fadeUp" },
            { "id": "field-eq", "type": "text", "style": "$type.note", "align": "left", "enter": "fadeUp",
              "text": "ellipse × 435, grid · size = sin(d₁/40 − 3.2t) + sin(d₂/40 − 3.2t)" }
          ] }
        ] },

        { "id": "orbit", "type": "group", "duration": "6s", "comment": "04 · an orrery tilted in 3D, dust from particles",
          "children": [
          { "id": "orrery", "type": "group", "lint": { "ignore": ["offCanvas"] },
            "comment": "the orbital plane: flat circles squashed by cos(tilt), so the rings can be wider than the frame is tall",
            "scaleY": "=cos(rad(64 + 5 * sin(since('orbit') * 0.5)))", "children": [
            { "id": "orbit-ring", "type": "ellipse", "style": "$styles.hairline", "dash": [2, 7],
              "repeat": { "count": 9, "stagger": { "over": "0.35s", "from": "first" } },
              "width": "=(120 + i * 72) * 1.35", "height": "=(120 + i * 72) * 1.35", "strokeWidth": "=i % 3 == 2 ? 3.2 : 1.5",
              "rotation": "=t * (30 - i * 2.6) * (i % 2 == 0 ? 1 : -1)",
              "enter": { "from": { "opacity": 0, "scale": 0.4 }, "motion": "cut" } },
            { "id": "dust", "type": "particles", "blendMode": "add",
              "emitter": { "rate": 150, "burst": 160, "lifetime": "5s", "speed": 130, "speedRandom": 0.85, "drag": 0.1,
                           "size": 4.5, "endSize": 1, "colors": ["#efebe2", "#6aa6e8"], "seed": 7 } },
            { "id": "trail", "type": "arc", "repeat": 9, "start": "0.3s", "lineCap": "butt",
              "width": "=(120 + i * 72) * 1.35", "height": "=(120 + i * 72) * 1.35",
              "stroke": "=i == 6 ? $color.blue : $color.text", "strokeWidth": "=i == 6 ? 4 : 2", "opacity": 0.85,
              "endAngle": "=deg(since('orbit') * (1.3 - i * 0.11) + i * 2.4) + 90",
              "startAngle": "=deg(since('orbit') * (1.3 - i * 0.11) + i * 2.4) + 90 - 60 * min(t / 1.5, 1)",
              "enter": { "from": { "opacity": 0 }, "motion": "glide" } }
          ] },
          { "id": "planet", "type": "ellipse", "repeat": 9, "start": "0.3s", "lint": { "ignore": ["offCanvas"] },
            "width": 7, "scale": "=i == 6 ? 3 : 1 + (i % 3) * 0.5",
            "fill": "=i == 6 ? $color.blue : $color.text",
            "x": "=640 + cos(since('orbit') * (1.3 - i * 0.11) + i * 2.4) * (60 + i * 36) * 1.35",
            "y": "=360 + sin(since('orbit') * (1.3 - i * 0.11) + i * 2.4) * (60 + i * 36) * 1.35 * cos(rad(64 + 5 * sin(since('orbit') * 0.5)))",
            "enter": { "from": { "scale": 0 }, "motion": "settle" } },
          { "id": "corona", "type": "ellipse", "style": "$styles.hairline", "stroke": "$color.blue", "blendMode": "add",
            "repeat": { "count": 5, "stagger": { "over": "0.3s", "from": "first" } },
            "width": "=30 + i * 11 + 14 * bass * (i + 1) / 5", "height": "=30 + i * 11 + 14 * bass * (i + 1) / 5", "opacity": "=1 - i * 0.16",
            "enter": { "from": { "scale": 0.2, "opacity": 0 }, "motion": "cut" } },
          { "id": "sun", "type": "ellipse", "width": 22, "fill": "$color.blue", "scale": "=1 + 0.35 * bass",
            "glow": { "radius": 30, "strength": "=0.7 + 0.9 * bass" } },
          { "id": "orbit-plate", "type": "group", "style": "$styles.plate", "start": "0.3s", "children": [
            { "id": "orbit-no", "type": "text", "style": "$type.label", "align": "left", "text": "04 — Orbit", "enter": "fadeUp" },
            { "id": "orbit-eq", "type": "text", "style": "$type.note", "align": "left", "enter": "fadeUp",
              "text": "9 rings · scaleY = cos(64° + 5°·sin(t/2)) · particles" }
          ] }
        ] },

        { "id": "bloom", "type": "group", "duration": "4s", "comment": "05 · a guilloché rose: 36 + 36 stroked ellipses and 24 petals, collapsing into the mark",
          "children": [
          { "id": "bloom-art", "type": "group", "x": "=640 + 200 * (1 - easeInOutCubic(clamp((since('sign') + 0.6) / 0.6, 0, 1)))",
            "y": "=360 - 90 * easeInOutCubic(clamp((since('sign') + 0.6) / 0.6, 0, 1))",
            "exit": { "to": { "scale": 0.39, "opacity": 0.55 }, "duration": "0.6s", "ease": "easeInOutCubic" }, "children": [
            { "id": "rose", "type": "group", "rotation": "=t * 9", "scale": "=0.96 + 0.06 * bass", "children": [
              { "id": "petal", "type": "ellipse", "width": 96, "height": 290, "fill": null, "stroke": "$color.pencil", "strokeWidth": 1.5, "blendMode": "add",
                "repeat": { "count": 24, "layout": "radial", "radius": 145, "rotate": true, "stagger": { "over": "0.4s" } },
                "enter": { "from": { "scale": 0, "opacity": 0 }, "motion": "settle" } },
              { "id": "rose-a", "type": "ellipse", "style": "$styles.hairline", "width": 132, "height": 560,
                "repeat": { "count": 36, "layout": "radial", "radius": 0, "rotate": true, "stagger": { "over": "0.7s" } },
                "enter": { "from": { "scaleY": 0, "opacity": 0 }, "motion": "glide" } }
            ] },
            { "id": "rose-b", "type": "ellipse", "style": "$styles.hairline", "stroke": "$color.blue", "width": 190, "height": 460,
              "blendMode": "difference", "rotation": "=-gt * 14",
              "repeat": { "count": 36, "layout": "radial", "radius": 0, "rotate": true, "stagger": { "over": "0.7s", "from": "last" } },
              "enter": { "from": { "scaleX": 0, "opacity": 0 }, "motion": "glide" } },
            { "id": "bloom-core", "type": "ellipse", "width": 9, "fill": "$color.text", "scale": "=1 + 0.9 * beat" }
          ] },
          { "id": "data-line1", "type": "text", "style": "$type.display", "fontSize": 68, "letterSpacing": -3,
            "align": "left", "anchor": "left", "x": 64, "y": 500, "start": "@data", "duration": "2.7s", "text": "Thirty seconds,",
            "blendMode": "difference", "stagger": "word", "enter": "rise", "exit": { "to": { "opacity": 0 }, "duration": "0.3s" } },
          { "id": "data-line2", "type": "text", "style": ["$type.display", "$type.italic"], "fontSize": 68, "letterSpacing": -2,
            "align": "left", "anchor": "left", "x": 64, "y": 564, "start": "@data+0.3s", "duration": "2.4s", "text": "written as data.",
            "blendMode": "difference", "stagger": "word", "enter": "rise", "exit": { "to": { "opacity": 0 }, "duration": "0.3s" } }
        ] },

        { "id": "sign", "type": "group", "duration": "2s", "comment": "06 · the mark",
          "children": [
          { "id": "sign-ray", "type": "rect", "width": 1.5, "anchor": "bottom", "fill": "$color.text", "y": 270,
            "comment": "the opening bloom returns, small, around the mark",
            "repeat": { "count": 144, "layout": "radial", "radius": 124, "rotate": true, "stagger": { "over": "0.5s" } },
            "height": "=6 + 64 * pow(noise2(cos(i / n * tau) * 1.7 + gt * 0.35, sin(i / n * tau) * 1.7), 1.6) * (0.8 + 0.4 * bass)",
            "enter": { "from": { "scaleY": 0, "opacity": 0 }, "motion": "glide" } },
          { "id": "sign-dial", "type": "ellipse", "width": 220, "y": 270, "fill": null, "stroke": "$color.rule", "strokeWidth": 8,
            "dash": [1.25, 6.4], "lineCap": "butt", "rotation": "=t * 12" },
          { "id": "sign-hand", "type": "arc", "width": 220, "y": 270, "stroke": "$color.pencil", "strokeWidth": 8, "lineCap": "butt",
            "startAngle": "=gt * 48", "endAngle": "=gt * 48 + 6 + 9 * bass" },
          { "id": "sign-logo", "type": "image", "src": "assets/logo.svg", "width": 140, "y": 270,
            "enter": { "from": { "scale": 0.6, "opacity": 0, "rotate": -18 }, "motion": "settle" } },
          { "id": "sign-word", "type": "text", "style": "$type.display", "fontSize": 92, "letterSpacing": -4.1, "y": 516,
            "text": "vidmake", "start": "0.15s", "enter": { "type": "wipeRight", "duration": "0.55s", "ease": "easeInOutCubic" } },
          { "id": "sign-tag", "type": "text", "style": "$type.label", "fontSize": 14, "y": 574, "start": "0.45s",
            "text": "Motion, written.", "enter": "fadeUp" }
        ] }
      ] },

      { "id": "edge", "type": "group", "comment": "film edge print, over every scene", "children": [
        { "id": "crop", "type": "path", "fill": null, "stroke": "$color.mute", "strokeWidth": 1, "lineCap": "butt",
          "d": "M24 44H44V24 M1256 44H1236V24 M24 676H44V696 M1256 676H1236V696" },
        { "id": "edge-title", "type": "text", "style": "$type.label", "anchor": "left", "align": "left", "x": 64, "y": 40,
          "text": "vidmake · reel — generative bloom" },
        { "id": "edge-tc", "type": "text", "style": "$type.label", "anchor": "right", "align": "right", "x": 1216, "y": 40,
          "text": "${pad(floor(gt / 60), 2)}:${pad(floor(gt) % 60, 2)}:${pad(gf % 30, 2)}   f ${pad(gf, 3)}" },
        { "id": "meter", "type": "group", "end": "@sign", "exit": { "to": { "opacity": 0 }, "duration": "0.3s" }, "children": [
          { "id": "meter-label", "type": "text", "style": "$type.label", "anchor": "right", "align": "right", "x": 1216, "y": 640,
            "text": "beat ${pad(beats, 3)}   bass ${bass:2}" },
          { "id": "meter-track", "type": "rect", "anchor": "right", "x": 1216, "y": 664, "width": 200, "height": 2, "fill": "$color.rule" },
          { "id": "meter-beat", "type": "rect", "anchor": "left", "x": 1016, "y": 664, "height": 2, "fill": "$color.text", "width": "=200 * beat" },
          { "id": "meter-bass", "type": "rect", "anchor": "left", "x": 1016, "y": 674, "height": 4, "width": "=200 * bass",
            "fill": "=(since('shift') < 0 ? $color.pencil : $color.blue)" }
        ] }
      ] }
    ]
  }]
}
