Skip to content

Write HTML. Render video. Built for agents.

8.4 KB
Raw Blame
{"html":"<!doctype html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"UTF-8\" />\n    <meta name=\"viewport\" content=\"width=1920, height=1080\" />\n    <title>Tilt Card - Demo</title>\n    <script src=\"https://cdn.jsdelivr.net/npm/[email protected]/dist/gsap.min.js\"></script>\n    <style>\n      * {\n        box-sizing: border-box;\n      }\n      html,\n      body {\n        margin: 0;\n        width: 1920px;\n        height: 1080px;\n        overflow: hidden;\n      }\n      #demo {\n        width: 1920px;\n        height: 1080px;\n        display: grid;\n        place-items: center;\n        background: #eef2ff;\n        font-family: Inter, system-ui, sans-serif;\n      }\n      .demo-frame {\n        display: grid;\n        place-items: center;\n        min-width: 760px;\n        min-height: 480px;\n        padding: 56px;\n        transform: scale(2.5); /* ponytail: card was ~16% of frame; 2.5× brings it to ~60% */\n      }\n      .hf-transition-tilt-card {\n        position: relative;\n        width: 420px;\n        height: 260px;\n        overflow: hidden;\n        border: 1px solid rgba(255, 255, 255, 0.18);\n        border-radius: 30px;\n        background: linear-gradient(135deg, #18181b, #312e81);\n        color: #ffffff;\n        font-family: Inter, system-ui, sans-serif;\n        transform-style: preserve-3d;\n        box-shadow: 0 32px 90px rgba(49, 46, 129, 0.34);\n      }\n      .hf-transition-tilt-glow {\n        position: absolute;\n        inset: -30%;\n        background: radial-gradient(circle at 30% 20%, rgba(125, 211, 252, 0.5), transparent 36%);\n      }\n      .hf-transition-tilt-content {\n        position: relative;\n        display: grid;\n        align-content: end;\n        gap: 10px;\n        height: 100%;\n        padding: 34px;\n        transform: translateZ(38px);\n      }\n      .hf-transition-tilt-content span {\n        color: #a5b4fc;\n        font-size: 13px;\n        font-weight: 900;\n        letter-spacing: 0.12em;\n        text-transform: uppercase;\n      }\n      .hf-transition-tilt-content strong {\n        max-width: 280px;\n        font-size: 34px;\n        line-height: 0.96;\n      }\n    </style>\n  </head>\n  <body>\n    <div\n      id=\"demo\"\n      data-composition-id=\"tilt-card-demo\"\n      data-start=\"0\"\n      data-width=\"1920\"\n      data-height=\"1080\"\n      data-duration=\"5\"\n    >\n      <div class=\"demo-frame\">\n        <div\n          class=\"hf-transition-tilt-card\"\n          data-composition-variables='[\n    {\"id\": \"eyebrow\", \"type\": \"string\", \"role\": \"content\", \"label\": \"Eyebrow\", \"description\": \"Small uppercase kicker above the headline.\", \"default\": \"Primitive\"},\n    {\"id\": \"headline\", \"type\": \"string\", \"role\": \"content\", \"label\": \"Headline\", \"description\": \"Large card headline.\", \"default\": \"Agent-ready motion\"},\n    {\"id\": \"glow\", \"type\": \"enum\", \"role\": \"motion\", \"label\": \"Glow\", \"description\": \"How far the corner glow reaches past the card edges, which sets both its spread at rest and how far the timeline drift carries it.\", \"default\": \"standard\", \"options\": [{\"value\": \"tight\", \"label\": \"Tight\"}, {\"value\": \"standard\", \"label\": \"Standard\"}, {\"value\": \"wide\", \"label\": \"Wide\"}]},\n    {\"id\": \"accent\", \"type\": \"enum\", \"role\": \"style\", \"label\": \"Accent\", \"description\": \"Colour family of the card gradient, corner glow, eyebrow and drop shadow.\", \"default\": \"indigo\", \"options\": [{\"value\": \"indigo\", \"label\": \"Indigo\"}, {\"value\": \"emerald\", \"label\": \"Emerald\"}, {\"value\": \"violet\", \"label\": \"Violet\"}]}\n  ]'\n        >\n          <div class=\"hf-transition-tilt-glow\"></div>\n          <div class=\"hf-transition-tilt-content\">\n            <span>Primitive</span>\n            <strong>Agent-ready motion</strong>\n          </div>\n        </div>\n      </div>\n      <script>\n        (function () {\n          \"use strict\";\n\n          var vars =\n            window.__hyperframes && window.__hyperframes.getVariables\n              ? window.__hyperframes.getVariables()\n              : {};\n\n          // Unrecognised overrides return to their declared defaults.\n          var insets = { tight: \"-18%\", standard: \"-30%\", wide: \"-46%\" };\n          var accents = {\n            indigo: {\n              accent: \"#312e81\",\n              glow: \"rgba(125, 211, 252, 0.5)\",\n              label: \"#a5b4fc\",\n              shadow: \"rgba(49, 46, 129, 0.34)\",\n            },\n            emerald: {\n              accent: \"#065f46\",\n              glow: \"rgba(110, 231, 183, 0.5)\",\n              label: \"#6ee7b7\",\n              shadow: \"rgba(6, 95, 70, 0.34)\",\n            },\n            violet: {\n              accent: \"#5b21b6\",\n              glow: \"rgba(216, 180, 254, 0.5)\",\n              label: \"#d8b4fe\",\n              shadow: \"rgba(91, 33, 182, 0.34)\",\n            },\n          };\n\n          function pick(table, value, fallback) {\n            return Object.prototype.hasOwnProperty.call(table, value) ? value : fallback;\n          }\n\n          function text(value, fallback) {\n            var resolved = value == null ? \"\" : String(value).trim();\n            return resolved.length > 0 ? resolved : fallback;\n          }\n\n          var eyebrow = text(vars.eyebrow, \"Primitive\");\n          var headline = text(vars.headline, \"Agent-ready motion\");\n          var inset = insets[pick(insets, vars.glow, \"standard\")];\n          var accent = accents[pick(accents, vars.accent, \"indigo\")];\n\n          var roots = document.querySelectorAll(\".hf-transition-tilt-card\");\n          for (var i = 0; i < roots.length; i += 1) {\n            var root = roots[i];\n            root.style.setProperty(\"--hf-tilt-glow-inset\", inset);\n            root.style.setProperty(\"--hf-tilt-accent\", accent.accent);\n            root.style.setProperty(\"--hf-tilt-glow\", accent.glow);\n            root.style.setProperty(\"--hf-tilt-label\", accent.label);\n            root.style.setProperty(\"--hf-tilt-shadow\", accent.shadow);\n            root.querySelector(\".hf-transition-tilt-content span\").textContent = eyebrow;\n            root.querySelector(\".hf-transition-tilt-content strong\").textContent = headline;\n          }\n        })();\n      </script>\n      <script>\n        const tl = gsap.timeline({ paused: true });\n        tl.fromTo(\n          \".hf-transition-tilt-card\",\n          { opacity: 0, y: 30, rotateX: 0, rotateY: 0 },\n          { opacity: 1, y: 0, duration: 0.38, ease: \"power2.out\" },\n          0.3,\n        );\n        tl.to(\n          \".hf-transition-tilt-card\",\n          { rotateX: -7, rotateY: 10, duration: 0.72, ease: \"power3.inOut\" },\n          0.75,\n        );\n        tl.to(\n          \".hf-transition-tilt-glow\",\n          { xPercent: 12, yPercent: 10, duration: 0.72, ease: \"power3.inOut\" },\n          0.75,\n        );\n        tl.set({}, {}, 5);\n        window.__timelines = window.__timelines || {};\n        window.__timelines[\"tilt-card-demo\"] = tl;\n      </script>\n    </div>\n    <style>\n      .hf-transition-tilt-card {\n        position: relative;\n        width: 420px;\n        height: 260px;\n        overflow: hidden;\n        border: 1px solid rgba(255, 255, 255, 0.18);\n        border-radius: 30px;\n        background: linear-gradient(135deg, #18181b, var(--hf-tilt-accent, #312e81));\n        color: #ffffff;\n        font-family: Inter, system-ui, sans-serif;\n        transform-style: preserve-3d;\n        box-shadow: 0 32px 90px var(--hf-tilt-shadow, rgba(49, 46, 129, 0.34));\n      }\n      .hf-transition-tilt-glow {\n        position: absolute;\n        inset: var(--hf-tilt-glow-inset, -30%);\n        background: radial-gradient(\n          circle at 30% 20%,\n          var(--hf-tilt-glow, rgba(125, 211, 252, 0.5)),\n          transparent 36%\n        );\n      }\n      .hf-transition-tilt-content {\n        position: relative;\n        display: grid;\n        align-content: end;\n        gap: 10px;\n        height: 100%;\n        padding: 34px;\n        transform: translateZ(38px);\n      }\n      .hf-transition-tilt-content span {\n        color: var(--hf-tilt-label, #a5b4fc);\n        font-size: 13px;\n        font-weight: 900;\n        letter-spacing: 0.12em;\n        text-transform: uppercase;\n      }\n      .hf-transition-tilt-content strong {\n        max-width: 280px;\n        font-size: 34px;\n        line-height: 0.96;\n      }\n    </style>\n  </body>\n</html>\n"}