Skip to content

Write HTML. Render video. Built for agents.

4.6 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>Three Orbiting Cards - 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      .hf-advanced-three-orbiting-cards {\n        color: #111827;\n        font-family: Inter, system-ui, sans-serif;\n      }\n      .hf-advanced-three-orbiting-cards {\n        position: relative;\n        width: 760px;\n        height: 430px;\n        border-radius: 30px;\n        overflow: hidden;\n        background: #050816;\n        box-shadow: 0 28px 80px rgba(15, 23, 42, 0.2);\n        /* ponytail: zoom scales the whole card without touching GSAP-animated state */\n        zoom: 1.65;\n      }\n      .hf-advanced-three-orbiting-cards canvas {\n        display: block;\n        width: 100%;\n        height: 100%;\n      }\n      .hf-advanced-three-orbiting-cards .label {\n        position: absolute;\n        left: 28px;\n        bottom: 26px;\n        color: #fff;\n      }\n      .hf-advanced-three-orbiting-cards h3 {\n        margin: 0;\n        font-size: 34px;\n        letter-spacing: -0.05em;\n      }\n      .hf-advanced-three-orbiting-cards p {\n        margin: 6px 0 0;\n        font-size: 15px;\n        color: rgba(255, 255, 255, 0.72);\n      }\n    </style>\n  </head>\n  <body>\n    <div\n      id=\"demo\"\n      data-composition-id=\"three-orbiting-cards-demo\"\n      data-start=\"0\"\n      data-width=\"1920\"\n      data-height=\"1080\"\n      data-duration=\"5\"\n    >\n      <div class=\"hf-advanced-three-orbiting-cards\">\n        <canvas></canvas>\n        <div class=\"label\">\n          <h3>Three Orbiting Cards</h3>\n          <p>\n            A Three.js-powered orbit scene driven by a paused GSAP timeline for deterministic\n            renders.\n          </p>\n        </div>\n      </div>\n    </div>\n    <script type=\"module\">\n      import * as THREE from \"https://cdn.jsdelivr.net/npm/[email protected]/build/three.module.js\";\n\n      const host = document.querySelector(\".hf-advanced-three-orbiting-cards\");\n      const canvas = host.querySelector(\"canvas\");\n      const renderer = new THREE.WebGLRenderer({ canvas, antialias: true, alpha: true });\n      renderer.setPixelRatio(1);\n      renderer.setSize(760, 430, false);\n      renderer.setClearColor(0x050816, 1);\n\n      const scene = new THREE.Scene();\n      const camera = new THREE.PerspectiveCamera(36, 760 / 430, 0.1, 100);\n      camera.position.set(0, 0, 7);\n\n      const group = new THREE.Group();\n      scene.add(group);\n      const material = new THREE.MeshStandardMaterial({\n        color: 0x60a5fa,\n        metalness: 0.18,\n        roughness: 0.38,\n      });\n      const accent = new THREE.MeshStandardMaterial({\n        color: 0xa78bfa,\n        metalness: 0.12,\n        roughness: 0.44,\n      });\n      const geometry = new THREE.BoxGeometry(1.2, 1.2, 0.08);\n      for (let i = 0; i < 9; i++) {\n        const mesh = new THREE.Mesh(geometry, i % 2 ? accent : material);\n        const angle = (i / 9) * Math.PI * 2;\n        const radius = 2.15;\n        mesh.position.set(\n          Math.cos(angle) * radius,\n          Math.sin(angle) * radius * 0.55,\n          Math.sin(angle) * 0.7,\n        );\n        mesh.rotation.z = angle;\n        group.add(mesh);\n      }\n      scene.add(new THREE.AmbientLight(0xffffff, 1.2));\n      const light = new THREE.DirectionalLight(0xffffff, 2.2);\n      light.position.set(2, 3, 4);\n      scene.add(light);\n\n      const state = { progress: 0 };\n      function render() {\n        const t = state.progress;\n        group.rotation.y = t * Math.PI * 2;\n        group.rotation.x = Math.sin(t * Math.PI * 2) * 0.22;\n        camera.position.z = 6.4 - Math.sin(t * Math.PI) * 0.55;\n        renderer.render(scene, camera);\n      }\n      render();\n\n      window.__hfThreeRender_three_orbiting_cards = { state, render };\n\n      const tl = window.gsap.timeline({ paused: true });\n      tl.to(state, { progress: 1, duration: 4, ease: \"none\", onUpdate: render }, 0.5);\n      tl.set({}, {}, 5);\n      window.__timelines = window.__timelines || {};\n      window.__timelines[\"three-orbiting-cards-demo\"] = tl;\n    </script>\n  </body>\n</html>\n"}