Skip to content

Write HTML. Render video. Built for agents.

7.1 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>Skeleton Reveal - 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: #f7f7f8;\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        /* ponytail: scale wrapper (not a GSAP target) to fill ~60% of frame */\n        transform: scale(1.51);\n      }\n      .hf-transition-skeleton-reveal {\n        position: relative;\n        width: 400px;\n        height: 96px;\n        font-family: Inter, system-ui, sans-serif;\n      }\n      .hf-transition-skeleton-reveal .skeleton,\n      .hf-transition-skeleton-reveal .content {\n        position: absolute;\n        inset: 0;\n        border: 1px solid #e4e4e7;\n        border-radius: 14px;\n        background: #fff;\n        box-shadow: 0 24px 70px rgba(0, 0, 0, 0.08);\n      }\n      .hf-transition-skeleton-reveal .skeleton {\n        background: linear-gradient(90deg, #f4f4f5, #e4e4e7, #f4f4f5);\n        background-size: 240% 100%;\n        opacity: 1;\n        box-shadow: none;\n      }\n      .hf-transition-skeleton-reveal .content {\n        display: grid;\n        align-content: center;\n        gap: 6px;\n        padding: 20px 22px;\n        opacity: 0;\n        color: #18181b;\n      }\n      .hf-transition-skeleton-reveal strong {\n        font-size: 18px;\n        font-weight: 600;\n        letter-spacing: -0.01em;\n      }\n      .hf-transition-skeleton-reveal span {\n        color: #71717a;\n        font-size: 15px;\n      }\n    </style>\n  </head>\n  <body>\n    <div\n      id=\"demo\"\n      data-composition-id=\"skeleton-reveal-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-skeleton-reveal\"\n          data-composition-variables='[\n    { \"id\": \"name\", \"type\": \"string\", \"role\": \"content\", \"label\": \"Name\", \"description\": \"Primary line revealed once the skeleton fades out.\", \"default\": \"Jane Cooper\" },\n    { \"id\": \"detail\", \"type\": \"string\", \"role\": \"content\", \"label\": \"Detail\", \"description\": \"Secondary line under the name, such as an email or a role.\", \"default\": \"[email protected]\" },\n    { \"id\": \"tone\", \"type\": \"enum\", \"role\": \"style\", \"label\": \"Tone\", \"description\": \"Card palette. Light is the paper card, dark is a near-black card with the matching skeleton bars and text.\", \"default\": \"light\", \"options\": [{ \"value\": \"light\", \"label\": \"Light\" }, { \"value\": \"dark\", \"label\": \"Dark\" }] }\n  ]'\n        >\n          <div class=\"skeleton\"></div>\n          <div class=\"content\"><strong>Jane Cooper</strong><span>[email protected]</span></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 tones = {\n            light: null,\n            dark: {\n              \"--hf-sr-surface\": \"#18181b\",\n              \"--hf-sr-border\": \"#27272a\",\n              \"--hf-sr-bar\": \"#27272a\",\n              \"--hf-sr-bar-strong\": \"#3f3f46\",\n              \"--hf-sr-ink\": \"#fafafa\",\n              \"--hf-sr-muted\": \"#a1a1aa\",\n            },\n          };\n          var defaultName = \"Jane Cooper\";\n          var defaultDetail = \"[email protected]\";\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            return typeof value === \"string\" && value.trim() ? value.trim() : fallback;\n          }\n\n          var tone = tones[pick(tones, vars.tone, \"light\")];\n          var name = text(vars.name, defaultName);\n          var detail = text(vars.detail, defaultDetail);\n\n          var roots = document.querySelectorAll(\".hf-transition-skeleton-reveal\");\n          for (var i = 0; i < roots.length; i += 1) {\n            var root = roots[i];\n            if (tone) {\n              for (var key in tone) root.style.setProperty(key, tone[key]);\n            }\n            var strong = root.querySelector(\".content strong\");\n            var span = root.querySelector(\".content span\");\n            if (strong) strong.textContent = name;\n            if (span) span.textContent = detail;\n          }\n        })();\n      </script>\n      <script>\n        const tl = gsap.timeline({ paused: true });\n        const startTime = 0.5;\n        tl.to(\n          \".hf-transition-skeleton-reveal .skeleton\",\n          { backgroundPosition: \"100% 0\", duration: 0.7, ease: \"none\" },\n          startTime,\n        );\n        tl.to(\n          \".hf-transition-skeleton-reveal .skeleton\",\n          { opacity: 0, duration: 0.22 },\n          startTime + 0.72,\n        );\n        tl.to(\n          \".hf-transition-skeleton-reveal .content\",\n          { opacity: 1, duration: 0.24 },\n          startTime + 0.78,\n        );\n        tl.set({}, {}, 5);\n        window.__timelines = window.__timelines || {};\n        window.__timelines[\"skeleton-reveal-demo\"] = tl;\n      </script>\n    </div>\n    <style>\n      .hf-transition-skeleton-reveal {\n        position: relative;\n        width: 340px;\n        height: 76px;\n        font-family: Inter, system-ui, sans-serif;\n      }\n      .hf-transition-skeleton-reveal .skeleton,\n      .hf-transition-skeleton-reveal .content {\n        position: absolute;\n        inset: 0;\n        border: 1px solid var(--hf-sr-border, #e4e4e7);\n        border-radius: 14px;\n        background: var(--hf-sr-surface, #fff);\n      }\n      .hf-transition-skeleton-reveal .skeleton {\n        background: linear-gradient(\n          90deg,\n          var(--hf-sr-bar, #f4f4f5),\n          var(--hf-sr-bar-strong, #e4e4e7),\n          var(--hf-sr-bar, #f4f4f5)\n        );\n        background-size: 240% 100%;\n        opacity: 1;\n      }\n      .hf-transition-skeleton-reveal .content {\n        display: grid;\n        align-content: center;\n        gap: 5px;\n        padding: 15px;\n        opacity: 0;\n        color: var(--hf-sr-ink, #18181b);\n      }\n      .hf-transition-skeleton-reveal span {\n        color: var(--hf-sr-muted, #71717a);\n        font-size: 14px;\n      }\n    </style>\n  </body>\n</html>\n"}