{
  "id": "circular-text-spin",
  "kind": "element",
  "title": "Circular text spin",
  "summary": "Text set on a circle that rotates continuously, speeds up or reverses with scroll, and boosts on hover, with a centre badge.",
  "url": "https://enrichr.dev/elements/circular-text-spin.html",
  "section": "band",
  "techniques": [
    "text-animation",
    "scroll-driven",
    "pointer-interaction"
  ],
  "stack": [
    "Vanilla JS",
    "SVG",
    "CSS"
  ],
  "frameworks": [
    "React",
    "Next.js",
    "Vanilla"
  ],
  "mood": [
    "playful",
    "bold",
    "modern"
  ],
  "intents": [
    "rotating circular text badge",
    "svg text on a circle animation",
    "spinning text that speeds up on scroll",
    "circle text reverse on hover",
    "scroll to explore rotating badge"
  ],
  "status": "tested",
  "params": [
    {
      "key": "accent",
      "label": "Accent colour",
      "type": "color",
      "value": "#e6ff55"
    },
    {
      "key": "speed",
      "label": "Base speed (deg/s)",
      "type": "range",
      "min": 0,
      "max": 120,
      "step": 2,
      "value": 24
    },
    {
      "key": "scrollBoost",
      "label": "Scroll boost",
      "type": "range",
      "min": 0,
      "max": 4,
      "step": 0.1,
      "value": 1.5
    },
    {
      "key": "hoverFactor",
      "label": "Hover factor (negative reverses)",
      "type": "range",
      "min": -4,
      "max": 4,
      "step": 0.5,
      "value": 4
    }
  ],
  "license": "Free to use in personal and client projects during the preview. Final licence terms will be published here before any paid tier starts; ask before reselling the code as a collection.",
  "contract": "function mount(root, opts) -> { update(partialOpts), destroy() }; root must contain the element markup",
  "exports": {
    "claude": "Add the \"Circular text spin\" element to this project.\n\nThis is the \"Circular text spin\" element from the Enrichr Library: Text set on a circle that rotates continuously, speeds up or reverses with scroll, and boosts on hover, with a centre badge.\nPage: https://enrichr.dev/elements/circular-text-spin.html\nMachine-readable spec: https://enrichr.dev/elements/circular-text-spin.json\n\nElement contract (vanilla JavaScript, no dependencies):\n- The JavaScript defines a function mount(root, opts).\n- root is an empty container element. Set root.innerHTML to the markup first, then call mount(root, opts).\n- It returns an object with update(partialOpts) and destroy(). Call destroy() when the element is removed. Some elements also return replay().\n- The CSS classes all start with \"ef-\" so they will not collide with your styles.\n\nSteps:\n1. Look at the project first to see its framework and where components, styles and static files live. Follow its conventions.\n2. Fetch https://enrichr.dev/elements/circular-text-spin.json if you can read URLs (fields: source.markup, source.css, source.js, params); otherwise use the source at the end of this message.\n3. Add the files, mount it where I tell you (default: the top of the home page), and pass the settings below as the opts.\n4. Keep the behaviour of the source unchanged. Do not add dependencies. Respect prefers-reduced-motion. Keep text as real HTML.\n5. Run the dev server and check it. with reduced motion on, nothing moves; it works at 375px wide and with touch only; there are no console errors; scrolling stays smooth; destroy() is called when it unmounts.\n\nSettings:\n{{SETTINGS}}\n\nSource:\n{{CODE}}",
    "chatgpt": "I want the \"Circular text spin\" element on my website. Below is its complete source. Please:\n1. Build one self-contained index.html that I can open locally to see it working (put the CSS in a <style> tag and the JavaScript in a <script> tag, with the markup in the body).\n2. Then explain, step by step, which parts go where in my own site, and how to mount it. My stack is: [tell me yours, or say \"plain HTML\"].\n3. Keep the behaviour of the source unchanged. Do not add dependencies. Respect prefers-reduced-motion. Keep text as real HTML.\n\nThis is the \"Circular text spin\" element from the Enrichr Library: Text set on a circle that rotates continuously, speeds up or reverses with scroll, and boosts on hover, with a centre badge.\nPage: https://enrichr.dev/elements/circular-text-spin.html\nMachine-readable spec: https://enrichr.dev/elements/circular-text-spin.json\n\nElement contract (vanilla JavaScript, no dependencies):\n- The JavaScript defines a function mount(root, opts).\n- root is an empty container element. Set root.innerHTML to the markup first, then call mount(root, opts).\n- It returns an object with update(partialOpts) and destroy(). Call destroy() when the element is removed. Some elements also return replay().\n- The CSS classes all start with \"ef-\" so they will not collide with your styles.\n\nSettings:\n{{SETTINGS}}\n\nSource:\n{{CODE}}\n\nVerify: with reduced motion on, nothing moves; it works at 375px wide and with touch only; there are no console errors; scrolling stays smooth; destroy() is called when it unmounts.",
    "cursor": "Add the \"Circular text spin\" element to this codebase.\n\nThis is the \"Circular text spin\" element from the Enrichr Library: Text set on a circle that rotates continuously, speeds up or reverses with scroll, and boosts on hover, with a centre badge.\nPage: https://enrichr.dev/elements/circular-text-spin.html\nMachine-readable spec: https://enrichr.dev/elements/circular-text-spin.json\n\nElement contract (vanilla JavaScript, no dependencies):\n- The JavaScript defines a function mount(root, opts).\n- root is an empty container element. Set root.innerHTML to the markup first, then call mount(root, opts).\n- It returns an object with update(partialOpts) and destroy(). Call destroy() when the element is removed. Some elements also return replay().\n- The CSS classes all start with \"ef-\" so they will not collide with your styles.\n\nUse Composer / agent mode. First search the repo for how components, styles and scripts are organised, then add the files in the matching places, mount it on the page I name, and run the app to confirm it works. Keep the behaviour of the source unchanged. Do not add dependencies. Respect prefers-reduced-motion. Keep text as real HTML.\n\nSettings:\n{{SETTINGS}}\n\nSource:\n{{CODE}}\n\nVerify: with reduced motion on, nothing moves; it works at 375px wide and with touch only; there are no console errors; scrolling stays smooth; destroy() is called when it unmounts.\n\nOptional: save this as .cursor/rules/enrichr-circular-text-spin.mdc so the rule stays with the project:\n---\ndescription: How to use the Enrichr Circular text spin element\nalwaysApply: false\n---\nmount(root, opts) expects the element markup inside root and returns { update, destroy }. Always call destroy() on unmount and never edit the ef- class names.",
    "v0": "Create a Next.js (App Router) client component for the \"Circular text spin\" element. Tailwind is available but this component needs no utility classes.\n\nThis is the \"Circular text spin\" element from the Enrichr Library: Text set on a circle that rotates continuously, speeds up or reverses with scroll, and boosts on hover, with a centre badge.\nPage: https://enrichr.dev/elements/circular-text-spin.html\nMachine-readable spec: https://enrichr.dev/elements/circular-text-spin.json\n\nElement contract (vanilla JavaScript, no dependencies):\n- The JavaScript defines a function mount(root, opts).\n- root is an empty container element. Set root.innerHTML to the markup first, then call mount(root, opts).\n- It returns an object with update(partialOpts) and destroy(). Call destroy() when the element is removed. Some elements also return replay().\n- The CSS classes all start with \"ef-\" so they will not collide with your styles.\n\nFiles to create:\n- circular-text-spin.js : the JavaScript below, with one line appended at the end: export { mount };  (and the markup exported as: export const markup = \"<the markup string>\";). If the project uses TypeScript and does not allow JS imports, put // @ts-nocheck on the first line.\n- the CSS below goes in your global stylesheet (or a plain .css file imported once at the app root). The class names are global and start with ef-.\n\nUse this component as the wrapper (adjust the import paths):\n```tsx\n\"use client\";\nimport { useEffect, useRef } from \"react\";\nimport { markup, mount } from \"./circular-text-spin\"; // markup is the HTML string; mount is the JavaScript's mount function\n\nexport default function CircularTextSpin(props: Record<string, unknown>) {\n  const ref = useRef<HTMLDivElement>(null);\n  const fx = useRef<{ update: (o: object) => void; destroy: () => void } | null>(null);\n  useEffect(() => {\n    const root = ref.current;\n    if (!root) return;\n    root.innerHTML = markup;\n    fx.current = mount(root, props);\n    return () => { fx.current?.destroy(); fx.current = null; root.innerHTML = \"\"; };\n  }, []);\n  useEffect(() => { fx.current?.update(props); }, [JSON.stringify(props)]);\n  return <div ref={ref} />;\n}\n```\n\nRender it on the home page so I can see it. Keep the behaviour of the source unchanged. Do not add dependencies. Respect prefers-reduced-motion. Keep text as real HTML.\n\nSettings:\n{{SETTINGS}}\n\nSource:\n{{CODE}}",
    "lovable": "Add the \"Circular text spin\" element to this React + Vite + TypeScript + Tailwind project. Do not install any packages.\n\nThis is the \"Circular text spin\" element from the Enrichr Library: Text set on a circle that rotates continuously, speeds up or reverses with scroll, and boosts on hover, with a centre badge.\nPage: https://enrichr.dev/elements/circular-text-spin.html\nMachine-readable spec: https://enrichr.dev/elements/circular-text-spin.json\n\nElement contract (vanilla JavaScript, no dependencies):\n- The JavaScript defines a function mount(root, opts).\n- root is an empty container element. Set root.innerHTML to the markup first, then call mount(root, opts).\n- It returns an object with update(partialOpts) and destroy(). Call destroy() when the element is removed. Some elements also return replay().\n- The CSS classes all start with \"ef-\" so they will not collide with your styles.\n\nFiles to create:\n- circular-text-spin.js : the JavaScript below, with one line appended at the end: export { mount };  (and the markup exported as: export const markup = \"<the markup string>\";). If the project uses TypeScript and does not allow JS imports, put // @ts-nocheck on the first line.\n- the CSS below goes in your global stylesheet (or a plain .css file imported once at the app root). The class names are global and start with ef-.\n\nWrapper component (src/components/CircularTextSpin.tsx):\n```tsx\n\"use client\";\nimport { useEffect, useRef } from \"react\";\nimport { markup, mount } from \"./circular-text-spin\"; // markup is the HTML string; mount is the JavaScript's mount function\n\nexport default function CircularTextSpin(props: Record<string, unknown>) {\n  const ref = useRef<HTMLDivElement>(null);\n  const fx = useRef<{ update: (o: object) => void; destroy: () => void } | null>(null);\n  useEffect(() => {\n    const root = ref.current;\n    if (!root) return;\n    root.innerHTML = markup;\n    fx.current = mount(root, props);\n    return () => { fx.current?.destroy(); fx.current = null; root.innerHTML = \"\"; };\n  }, []);\n  useEffect(() => { fx.current?.update(props); }, [JSON.stringify(props)]);\n  return <div ref={ref} />;\n}\n```\n\nRemove the \"use client\" line if it is not needed. Show it on the home page. Keep the behaviour of the source unchanged. Do not add dependencies. Respect prefers-reduced-motion. Keep text as real HTML.\n\nSettings:\n{{SETTINGS}}\n\nSource:\n{{CODE}}",
    "bolt": "Create a small Vite project (vanilla JavaScript, no framework unless I already have one) that shows the \"Circular text spin\" element.\n\nThis is the \"Circular text spin\" element from the Enrichr Library: Text set on a circle that rotates continuously, speeds up or reverses with scroll, and boosts on hover, with a centre badge.\nPage: https://enrichr.dev/elements/circular-text-spin.html\nMachine-readable spec: https://enrichr.dev/elements/circular-text-spin.json\n\nElement contract (vanilla JavaScript, no dependencies):\n- The JavaScript defines a function mount(root, opts).\n- root is an empty container element. Set root.innerHTML to the markup first, then call mount(root, opts).\n- It returns an object with update(partialOpts) and destroy(). Call destroy() when the element is removed. Some elements also return replay().\n- The CSS classes all start with \"ef-\" so they will not collide with your styles.\n\nFiles: index.html (a container element, then a script tag), style.css (the CSS below), circular-text-spin.js (the JavaScript below) and main.js that sets the container's innerHTML to the markup and calls mount(container, opts) with the settings below. Keep the behaviour of the source unchanged. Do not add dependencies. Respect prefers-reduced-motion. Keep text as real HTML.\n\nSettings:\n{{SETTINGS}}\n\nSource:\n{{CODE}}\n\nVerify: with reduced motion on, nothing moves; it works at 375px wide and with touch only; there are no console errors; scrolling stays smooth; destroy() is called when it unmounts.",
    "replit": "Create a new HTML, CSS and JavaScript Repl that shows the \"Circular text spin\" element. No packages, no server code.\n\nThis is the \"Circular text spin\" element from the Enrichr Library: Text set on a circle that rotates continuously, speeds up or reverses with scroll, and boosts on hover, with a centre badge.\nPage: https://enrichr.dev/elements/circular-text-spin.html\nMachine-readable spec: https://enrichr.dev/elements/circular-text-spin.json\n\nElement contract (vanilla JavaScript, no dependencies):\n- The JavaScript defines a function mount(root, opts).\n- root is an empty container element. Set root.innerHTML to the markup first, then call mount(root, opts).\n- It returns an object with update(partialOpts) and destroy(). Call destroy() when the element is removed. Some elements also return replay().\n- The CSS classes all start with \"ef-\" so they will not collide with your styles.\n\nFiles: index.html (a container element, link style.css, load circular-text-spin.js and then main.js), style.css (the CSS below), circular-text-spin.js (the JavaScript below), main.js (sets the container's innerHTML to the markup, then calls mount(container, opts) with the settings below). Press Run to preview. Keep the behaviour of the source unchanged. Do not add dependencies. Respect prefers-reduced-motion. Keep text as real HTML.\n\nSettings:\n{{SETTINGS}}\n\nSource:\n{{CODE}}",
    "figma": "Designer handoff notes for the \"Circular text spin\" element (Enrichr Library). Figma cannot run this JavaScript inside a design file, so use it as a motion reference and hand the code to a developer.\n\nThis is the \"Circular text spin\" element from the Enrichr Library: Text set on a circle that rotates continuously, speeds up or reverses with scroll, and boosts on hover, with a centre badge.\nPage: https://enrichr.dev/elements/circular-text-spin.html\nMachine-readable spec: https://enrichr.dev/elements/circular-text-spin.json\n\nWhat it does: The text is an SVG textPath on a circle, stretched with textLength so it fills the whole ring. A requestAnimationFrame loop adds velocity times delta time to an angle and writes it as a rotate transform on the group. The target velocity is the base speed, multiplied by the hover factor while the badge is hovered or focused, plus a scroll impulse. Scroll and wheel events add to that impulse, which decays every frame, and the real velocity eases toward the target, so speed ramps and reverses smoothly instead of snapping. The loop pauses when the element is off screen.\nAccessibility: The rotating ring is aria-hidden and the badge carries the accessible name, so screen readers get one clear label instead of repeated moving text. The badge is a focusable link, and keyboard focus triggers the same speed change as hover plus a visible focus ring. With prefers-reduced-motion the ring is static and no frame loop or scroll listener is created. Make sure the ring text is not the only place the message appears.\n\nTunable settings:\n- Accent colour: color, default #e6ff55\n- Base speed (deg/s): range 0 to 120, step 2, default 24\n- Scroll boost: range 0 to 4, step 0.1, default 1.5\n- Hover factor (negative reverses): range -4 to 4, step 0.5, default 4\n\nCurrent settings:\n{{SETTINGS}}\n\nFor the developer: Element contract (vanilla JavaScript, no dependencies):\n- The JavaScript defines a function mount(root, opts).\n- root is an empty container element. Set root.innerHTML to the markup first, then call mount(root, opts).\n- It returns an object with update(partialOpts) and destroy(). Call destroy() when the element is removed. Some elements also return replay().\n- The CSS classes all start with \"ef-\" so they will not collide with your styles.\n\nIn Figma:\n- Draw the resting state as a frame and the end state as a second frame; link them with Smart Animate to show the motion in a prototype.\n- Put the settings above in the frame's notes or Dev Mode annotations so the developer matches them.\n- Link https://enrichr.dev/elements/circular-text-spin.html in the handoff: the live demo and the copy-ready code are there. Developers can paste the prompts for Claude, Cursor or v0 from the Export menu.\nNothing is copied from another designer's file; this is original code from Enrichr.",
    "framer": "Add the \"Circular text spin\" element to Framer as a code component. Framer code components are React, so wrap the vanilla code like this. Check it in the Framer editor, as Framer's component API can change.\n\nThis is the \"Circular text spin\" element from the Enrichr Library: Text set on a circle that rotates continuously, speeds up or reverses with scroll, and boosts on hover, with a centre badge.\nPage: https://enrichr.dev/elements/circular-text-spin.html\nMachine-readable spec: https://enrichr.dev/elements/circular-text-spin.json\n\nElement contract (vanilla JavaScript, no dependencies):\n- The JavaScript defines a function mount(root, opts).\n- root is an empty container element. Set root.innerHTML to the markup first, then call mount(root, opts).\n- It returns an object with update(partialOpts) and destroy(). Call destroy() when the element is removed. Some elements also return replay().\n- The CSS classes all start with \"ef-\" so they will not collide with your styles.\n\n1. In Framer: Assets > Code > New component. Name it CircularTextSpin.\n2. Paste the JavaScript below into a separate code file named circular-text-spin.js in the same project, with  export { mount };  and  export const markup = \"<the markup string>\";  added. Put the CSS into the component as a <style> tag.\n3. Component:\n```tsx\nimport { addPropertyControls, ControlType } from \"framer\"\nimport { useEffect, useRef } from \"react\";\nimport { markup, mount } from \"./circular-text-spin\"; // markup is the HTML string; mount is the JavaScript's mount function\n\nexport default function CircularTextSpin(props: any) {\n  const ref = useRef<HTMLDivElement>(null);\n  const fx = useRef<{ update: (o: object) => void; destroy: () => void } | null>(null);\n  useEffect(() => {\n    const root = ref.current;\n    if (!root) return;\n    root.innerHTML = markup;\n    fx.current = mount(root, props);\n    return () => { fx.current?.destroy(); fx.current = null; root.innerHTML = \"\"; };\n  }, []);\n  useEffect(() => { fx.current?.update(props); }, [JSON.stringify(props)]);\n  return <div ref={ref} />;\n}\n\naddPropertyControls(CircularTextSpin, {\n  accent: { type: ControlType.Color, title: \"Accent colour\", defaultValue: \"#e6ff55\" },\n  speed: { type: ControlType.Number, title: \"Base speed\", min: 0, max: 120, step: 2, defaultValue: 24 },\n  scrollBoost: { type: ControlType.Number, title: \"Scroll boost\", min: 0, max: 4, step: 0.1, defaultValue: 1.5 },\n  hoverFactor: { type: ControlType.Number, title: \"Hover factor\", min: -4, max: 4, step: 0.5, defaultValue: 4 },\n})\n```\n4. Keep the behaviour of the source unchanged. Do not add dependencies. Respect prefers-reduced-motion. Keep text as real HTML.\n\nSettings:\n{{SETTINGS}}\n\nSource:\n{{CODE}}",
    "webflow": "Add the \"Circular text spin\" element to a Webflow site with an Embed element. Test it on the published or preview site: scripts in embeds may not run inside the Designer canvas.\n\nThis is the \"Circular text spin\" element from the Enrichr Library: Text set on a circle that rotates continuously, speeds up or reverses with scroll, and boosts on hover, with a centre badge.\nPage: https://enrichr.dev/elements/circular-text-spin.html\nMachine-readable spec: https://enrichr.dev/elements/circular-text-spin.json\n\nElement contract (vanilla JavaScript, no dependencies):\n- The JavaScript defines a function mount(root, opts).\n- root is an empty container element. Set root.innerHTML to the markup first, then call mount(root, opts).\n- It returns an object with update(partialOpts) and destroy(). Call destroy() when the element is removed. Some elements also return replay().\n- The CSS classes all start with \"ef-\" so they will not collide with your styles.\n\n1. Add an Embed element where it should appear. Paste a <style> block with the CSS, one container <div id=\"enrichr-circular-text-spin\"></div>, and a <script> block with the JavaScript followed by:\n   mount(document.getElementById(\"enrichr-circular-text-spin\"), { ...your settings... });\n   (set the container's innerHTML to the markup first, as in the contract).\n2. Embed elements have a size limit (check Webflow's current number). If the code is longer, host the JS and CSS as files and link them from Custom code in the page settings, then keep only the container and the mount call in the Embed.\n3. Keep the behaviour of the source unchanged. Do not add dependencies. Respect prefers-reduced-motion. Keep text as real HTML.\n\nSettings:\n{{SETTINGS}}\n\nSource:\n{{CODE}}"
  },
  "exportTools": [
    "claude",
    "chatgpt",
    "cursor",
    "v0",
    "lovable",
    "bolt",
    "replit",
    "figma",
    "framer",
    "webflow"
  ],
  "accessibility": "The rotating ring is aria-hidden and the badge carries the accessible name, so screen readers get one clear label instead of repeated moving text. The badge is a focusable link, and keyboard focus triggers the same speed change as hover plus a visible focus ring. With prefers-reduced-motion the ring is static and no frame loop or scroll listener is created. Make sure the ring text is not the only place the message appears.",
  "performance": "One transform attribute write per frame on a single SVG group, no layout reads. The loop stops while the element is off screen via IntersectionObserver, and scroll and wheel listeners are passive. destroy() removes every listener, the observer and the pending frame.",
  "dependencies": [],
  "source": {
    "markup": "<div class=\"ef-cts\">\n  <div class=\"ef-cts__wrap\">\n    <div class=\"ef-cts__stage\">\n      <svg class=\"ef-cts__svg\" viewBox=\"0 0 300 300\" aria-hidden=\"true\" focusable=\"false\"></svg>\n      <a class=\"ef-cts__badge\" href=\"#\" aria-label=\"Enrichr Library, build with motion\">\n        <svg viewBox=\"0 0 24 24\" aria-hidden=\"true\" focusable=\"false\"><path d=\"M6 18 18 6M8 6h10v10\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/></svg>\n      </a>\n    </div>\n  </div>\n</div>",
    "css": "/* Enrichr Library · https://enrichr.dev */\n.ef-cts { width: 100%; }\n.ef-cts__wrap { --ef-acc: #e6ff55; box-sizing: border-box; width: 100%; min-height: 18rem; padding: 1.2rem; border-radius: 1rem; display: flex; align-items: center; justify-content: center; overflow: hidden; font-family: system-ui, -apple-system, \"Segoe UI\", Roboto, sans-serif; }\n.ef-cts__stage { position: relative; width: min(100%, 17rem); aspect-ratio: 1; }\n.ef-cts__svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }\n.ef-cts__svg text { fill: #fbf8f1; font-size: 21px; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; }\n.ef-cts__badge { position: absolute; left: 50%; top: 50%; width: 28%; aspect-ratio: 1; margin: -14% 0 0 -14%; border-radius: 50%; display: grid; place-items: center; background: var(--ef-acc); color: #0c1e18; text-decoration: none; outline: none; box-shadow: 0 0 0 0 rgba(230, 255, 85, 0.35); transition: transform 400ms cubic-bezier(.2,.8,.2,1), box-shadow 400ms; }\n.ef-cts__badge svg { width: 46%; height: 46%; transition: transform 400ms cubic-bezier(.2,.8,.2,1); }\n.ef-cts__stage.is-hot .ef-cts__badge { transform: scale(1.1); box-shadow: 0 0 0 10px rgba(230, 255, 85, 0.18); }\n.ef-cts__stage.is-hot .ef-cts__badge svg { transform: rotate(45deg); }\n.ef-cts__badge:focus-visible { box-shadow: 0 0 0 3px #0c1e18, 0 0 0 5px var(--ef-acc); }\n@media (prefers-reduced-motion: reduce) { .ef-cts__badge, .ef-cts__badge svg { transition: none; } .ef-cts__stage.is-hot .ef-cts__badge { transform: none; } .ef-cts__stage.is-hot .ef-cts__badge svg { transform: none; } }",
    "js": "// Enrichr Library · https://enrichr.dev\n// Circular text spin: SVG text set on a circle that rotates continuously. Scrolling adds speed in the scroll direction, and\n// hovering or focusing the centre badge multiplies the speed (a negative factor reverses it). Speed eases toward its target.\n// Reduced motion: the ring stays still and no frame loop or scroll listener is created. Pauses while off screen.\n// mount(root, { background, accent, speed (deg/s), scrollBoost (0-4), hoverFactor (-4 to 4), text })\nfunction mount(root, o) {\n  var reduce = window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches;\n  var wrap = root.querySelector(\".ef-cts__wrap\");\n  var stage = root.querySelector(\".ef-cts__stage\");\n  var svg = root.querySelector(\".ef-cts__svg\");\n  var badge = root.querySelector(\".ef-cts__badge\");\n  var NS = \"http://www.w3.org/2000/svg\";\n  var opts = {}, offs = [], raf = 0, angle = 0, vel = 0, scrollV = 0, hot = false, visible = true, last = 0, lastY = 0, ring = null, tp = null;\n  var R = 112, CIRC = 2 * Math.PI * R;\n  var uid = \"ef-cts-\" + Math.random().toString(36).slice(2, 8);\n\n  function on(t, ev, fn, op) { t.addEventListener(ev, fn, op); offs.push(function () { t.removeEventListener(ev, fn, op); }); }\n  function buildText() {\n    svg.textContent = \"\";\n    var defs = document.createElementNS(NS, \"defs\");\n    var path = document.createElementNS(NS, \"path\");\n    path.setAttribute(\"id\", uid);\n    path.setAttribute(\"d\", \"M150 150 m-\" + R + \" 0 a\" + R + \" \" + R + \" 0 1 1 \" + 2 * R + \" 0 a\" + R + \" \" + R + \" 0 1 1 -\" + 2 * R + \" 0\");\n    defs.appendChild(path); svg.appendChild(defs);\n    ring = document.createElementNS(NS, \"g\");\n    var t = document.createElementNS(NS, \"text\");\n    tp = document.createElementNS(NS, \"textPath\");\n    tp.setAttribute(\"href\", \"#\" + uid);\n    tp.setAttribute(\"textLength\", String(CIRC - 2));\n    tp.setAttribute(\"lengthAdjust\", \"spacing\");\n    tp.textContent = String(opts.text).toUpperCase() + \" • \";\n    t.appendChild(tp); ring.appendChild(t); svg.appendChild(ring);\n    paint();\n  }\n  function paint() { if (ring) ring.setAttribute(\"transform\", \"rotate(\" + angle.toFixed(2) + \" 150 150)\"); }\n  function target() { return opts.speed * (hot ? opts.hoverFactor : 1) + scrollV * opts.scrollBoost; }\n  function frame(now) {\n    raf = 0;\n    if (!visible) return;\n    var dt = Math.min(0.05, (now - last) / 1000 || 0.016); last = now;\n    scrollV *= Math.pow(0.04, dt);\n    vel += (target() - vel) * Math.min(1, dt * 5);\n    angle = (angle + vel * dt) % 360;\n    paint();\n    raf = requestAnimationFrame(frame);\n  }\n  function kick() { if (!reduce && !raf && visible) { last = performance.now(); raf = requestAnimationFrame(frame); } }\n  function setHot(v) { hot = v; stage.classList.toggle(\"is-hot\", v); }\n  function onScroll() {\n    var y = window.pageYOffset || document.documentElement.scrollTop || 0;\n    scrollV = Math.max(-600, Math.min(600, scrollV + (y - lastY) * 2.5)); lastY = y;\n  }\n  function onWheel(e) { scrollV = Math.max(-600, Math.min(600, scrollV + e.deltaY * 1.5)); }\n  function ck(e) { e.preventDefault(); }\n\n  function update(next) {\n    var prev = opts;\n    opts = Object.assign({ background: \"#0c1e18\", accent: \"#e6ff55\", speed: 24, scrollBoost: 1.5, hoverFactor: 4, text: \"Enrichr Library • Build with motion\" }, opts, next || {});\n    wrap.style.background = opts.background;\n    wrap.style.setProperty(\"--ef-acc\", opts.accent);\n    if (prev.text !== opts.text) buildText();\n  }\n  update(o);\n  lastY = window.pageYOffset || 0;\n  on(badge, \"pointerenter\", function () { setHot(true); });\n  on(badge, \"pointerleave\", function () { setHot(false); });\n  on(badge, \"focus\", function () { setHot(true); });\n  on(badge, \"blur\", function () { setHot(false); });\n  on(badge, \"click\", ck);\n  if (!reduce) {\n    on(window, \"scroll\", onScroll, { passive: true });\n    on(root, \"wheel\", onWheel, { passive: true });\n    if (window.IntersectionObserver) {\n      var io = new IntersectionObserver(function (es) { visible = es[0].isIntersecting; if (visible) kick(); }, { threshold: 0 });\n      io.observe(stage);\n      offs.push(function () { io.disconnect(); });\n    }\n    kick();\n  }\n  function destroy() { offs.forEach(function (f) { f(); }); offs = []; if (raf) cancelAnimationFrame(raf); raf = 0; svg.textContent = \"\"; ring = null; }\n  return { update: function (n) { update(n); kick(); }, destroy: destroy };\n}"
  }
}