Skip to content

Write HTML. Render video. Built for agents.

9.0 KB
Raw Blame
{"html":"<!doctype html>\n<html lang=\"en\">\n  <head><base href=\"/public/catalog/items/apple-money-count/\">\n    <meta charset=\"UTF-8\" />\n    <meta name=\"viewport\" content=\"width=1920, height=1080\" />\n    <script src=\"https://cdn.jsdelivr.net/npm/[email protected]/dist/gsap.min.js\"></script>\n    <style>\n      * {\n        margin: 0;\n        padding: 0;\n        box-sizing: border-box;\n      }\n\n      html,\n      body {\n        width: 1920px;\n        height: 1080px;\n        overflow: hidden;\n        background: var(--bg, #fdfefe);\n      }\n\n      #root {\n        position: relative;\n        width: 1920px;\n        height: 1080px;\n        overflow: hidden;\n        background: var(--bg, #fdfefe);\n        color: var(--fg, #111315);\n        font-family: var(\n          --font-display,\n          -apple-system,\n          BlinkMacSystemFont,\n          \"Helvetica Neue\",\n          Arial,\n          sans-serif\n        );\n      }\n\n      .green-flash {\n        position: absolute;\n        inset: 0;\n        z-index: 1;\n        background: var(--accent, #30d158);\n        opacity: 0;\n      }\n\n      .stage-content {\n        position: relative;\n        z-index: 5;\n        display: flex;\n        width: 100%;\n        height: 100%;\n        align-items: center;\n        justify-content: center;\n        padding: var(--space-3, 120px) var(--space-3, 160px);\n      }\n\n      .amount-wrap {\n        position: relative;\n        display: flex;\n        align-items: center;\n        justify-content: center;\n        min-width: 1080px;\n        min-height: 260px;\n      }\n\n      .amount {\n        position: relative;\n        color: var(--fg, #111315);\n        font-size: 190px;\n        font-weight: 900;\n        line-height: 0.9;\n        letter-spacing: 0;\n        font-variant-numeric: tabular-nums;\n        text-align: center;\n        white-space: nowrap;\n        text-shadow:\n          0 3px 0 var(--bg, rgba(255, 255, 255, 0.58)),\n          0 18px 36px var(--fg, rgba(17, 19, 21, 0.14)),\n          0 42px 92px var(--fg, rgba(17, 19, 21, 0.1));\n        will-change: transform, color, opacity, text-shadow;\n      }\n\n      .money-burst {\n        position: absolute;\n        inset: 0;\n        z-index: 8;\n        pointer-events: none;\n      }\n\n      .money-icon {\n        position: absolute;\n        left: 50%;\n        top: 50%;\n        display: grid;\n        place-items: center;\n        opacity: 0;\n        filter: drop-shadow(0 20px 24px var(--brand, rgba(7, 84, 31, 0.2)));\n        will-change: transform, opacity, filter;\n      }\n\n      .money-icon.bill {\n        width: 96px;\n        height: 52px;\n        border-radius: var(--radius, 10px);\n        background: var(--accent, #30d158);\n        box-shadow:\n          inset 0 0 0 3px var(--brand, rgba(7, 84, 31, 0.2)),\n          inset 0 -10px 18px var(--brand, rgba(7, 84, 31, 0.1)),\n          0 16px 26px var(--brand, rgba(7, 84, 31, 0.2)),\n          0 34px 64px var(--brand, rgba(7, 84, 31, 0.16));\n      }\n\n      .money-icon.bill::before {\n        position: absolute;\n        inset: var(--space-1, 9px) var(--space-2, 16px);\n        border: 2px solid var(--border, rgba(7, 84, 31, 0.28));\n        border-radius: 999px;\n        content: \"\";\n      }\n\n      .money-icon.coin {\n        width: 64px;\n        height: 64px;\n        border-radius: 50%;\n        background: radial-gradient(\n          circle at 34% 30%,\n          var(--accent-2, #fff7a6) 0%,\n          var(--accent, #ffd54f) 40%,\n          var(--brand, #d9a514) 100%\n        );\n        box-shadow:\n          inset 0 0 0 4px var(--brand, rgba(111, 76, 0, 0.12)),\n          inset 0 -8px 14px var(--brand, rgba(111, 76, 0, 0.1)),\n          0 16px 30px var(--brand, rgba(111, 76, 0, 0.18)),\n          0 34px 58px var(--brand, rgba(111, 76, 0, 0.12));\n      }\n\n      .money-icon .mark {\n        position: relative;\n        z-index: 1;\n        color: var(--fg, #07541f);\n        font-size: 30px;\n        font-weight: 900;\n        line-height: 1;\n      }\n\n      .money-icon.coin .mark {\n        color: var(--fg, #6f4c00);\n        font-size: 28px;\n      }\n    </style>\n  </head>\n  <body>\n    <div\n      id=\"root\"\n      data-composition-id=\"apple-money-count\"\n      data-root=\"true\"\n      data-start=\"0\"\n      data-duration=\"5\"\n      data-width=\"1920\"\n      data-height=\"1080\"\n    >\n      <div id=\"greenFlash\" class=\"green-flash\"></div>\n      <div class=\"stage-content\">\n        <div class=\"amount-wrap\">\n          <div id=\"amount\" class=\"amount\">$0</div>\n        </div>\n      </div>\n      <div id=\"moneyBurst\" class=\"money-burst\" data-layout-allow-overflow></div>\n      <audio\n        id=\"sfxTrack\"\n        data-start=\"0\"\n        data-duration=\"5\"\n        data-track-index=\"9\"\n        src=\"/public/catalog/assets/1f67e32b14a9ed2e.wav\"\n        data-volume=\"0.92\"\n      ></audio>\n    </div>\n\n    <script>\n      window.__timelines = window.__timelines || {};\n\n      const amount = document.querySelector(\"#amount\");\n      const moneyBurst = document.querySelector(\"#moneyBurst\");\n      const countState = { value: 0 };\n\n      function formatMoney(value) {\n        const bounded = Math.max(0, Math.min(10000, value));\n        const rounded = Math.round(bounded);\n        return \"$\" + rounded.toLocaleString(\"en-US\");\n      }\n\n      function renderAmount(value) {\n        amount.textContent = formatMoney(value);\n      }\n\n      const moneyIcons = [];\n      const moneySpecs = [];\n\n      for (let i = 0; i < 62; i += 1) {\n        const icon = document.createElement(\"div\");\n        const isCoin = i % 3 === 0;\n        icon.className = \"money-icon \" + (isCoin ? \"coin\" : \"bill\");\n        icon.innerHTML = '<span class=\"mark\">$</span>';\n        moneyBurst.appendChild(icon);\n        moneyIcons.push(icon);\n\n        const angle = i * 2.399963229728653;\n        const ring = i % 5;\n        const radiusX = 260 + ring * 145 + (i % 7) * 12;\n        const radiusY = 160 + ring * 78 + (i % 6) * 12;\n        const offsetX = (i % 4) * 24 - 36;\n        const offsetY = (i % 5) * 18 - 36;\n        const x = Math.max(-865, Math.min(865, Math.cos(angle) * radiusX + offsetX));\n        const y = Math.max(-465, Math.min(465, Math.sin(angle * 1.13) * radiusY + offsetY));\n\n        moneySpecs.push({\n          x,\n          y,\n          delay: (i % 8) * 0.025,\n          duration: 0.74 + (i % 5) * 0.045,\n          fadeDelay: (i % 5) * 0.05,\n          rotation: ((i * 43) % 160) - 80,\n          scale: isCoin ? 0.72 + (i % 4) * 0.08 : 0.68 + (i % 5) * 0.07,\n        });\n      }\n\n      renderAmount(0);\n\n      const tl = gsap.timeline({\n        paused: true,\n        defaults: { ease: \"power3.out\" },\n      });\n\n      gsap.set(moneyIcons, {\n        x: 0,\n        y: 0,\n        xPercent: -50,\n        yPercent: -50,\n        opacity: 0,\n        scale: 0.18,\n        transformOrigin: \"50% 50%\",\n      });\n\n      tl.from(\n        \"#amount\",\n        {\n          y: 26,\n          opacity: 0,\n          scale: 0.985,\n          duration: 0.45,\n          ease: \"power2.out\",\n        },\n        0,\n      );\n\n      tl.to(\n        countState,\n        {\n          value: 10000,\n          duration: 3.16,\n          ease: \"none\",\n          onUpdate: () => renderAmount(countState.value),\n          onComplete: () => renderAmount(10000),\n        },\n        0,\n      );\n\n      tl.to(\n        \"#amount\",\n        {\n          color: \"var(--accent, #30d158)\",\n          textShadow:\n            \"0 3px 0 var(--bg, rgba(255,255,255,0.52)), 0 18px 40px var(--accent, rgba(48,209,88,0.3)), 0 46px 96px var(--brand, rgba(7,84,31,0.2))\",\n          duration: 0.18,\n        },\n        3.16,\n      );\n      tl.to(\"#amount\", { scale: 1.06, duration: 0.16, ease: \"back.out(2.2)\" }, 3.16);\n      tl.to(\"#amount\", { scale: 1, duration: 0.23, ease: \"power2.out\" }, 3.33);\n\n      tl.to(\"#greenFlash\", { opacity: 0.34, duration: 0.08, ease: \"none\" }, 3.16);\n      tl.to(\"#greenFlash\", { opacity: 0.22, duration: 0.76, ease: \"none\" }, 3.24);\n      tl.to(\"#greenFlash\", { opacity: 0, duration: 0.16, ease: \"power2.out\" }, 4);\n\n      moneyIcons.forEach((icon, i) => {\n        const spec = moneySpecs[i];\n        tl.to(\n          icon,\n          {\n            x: spec.x,\n            y: spec.y,\n            rotation: spec.rotation,\n            scale: spec.scale,\n            opacity: 1,\n            duration: spec.duration,\n            ease: \"power4.out\",\n          },\n          3.28 + spec.delay,\n        );\n        tl.to(\n          icon,\n          {\n            y: spec.y + (spec.y < 0 ? -58 : 58),\n            scale: spec.scale * 0.54,\n            opacity: 0,\n            duration: 0.38,\n            ease: \"power2.in\",\n          },\n          4.18 + spec.fadeDelay,\n        );\n      });\n\n      tl.to(\"#amount\", { opacity: 0, scale: 0.985, duration: 0.28, ease: \"power2.in\" }, 4.36);\n\n      window.__timelines[\"apple-money-count\"] = tl;\n    </script>\n  </body>\n</html>\n"}