{
  "id": "svg-text-path-scroll",
  "kind": "element",
  "title": "SVG text path scroll",
  "summary": "Large text set along a wavy SVG path that drifts on its own and slides further as the page scrolls, with an outlined echo line running the other way.",
  "url": "https://enrichr.dev/elements/svg-text-path-scroll.html",
  "section": "text",
  "techniques": [
    "scroll-driven",
    "text-animation"
  ],
  "stack": [
    "Vanilla JS",
    "SVG",
    "CSS"
  ],
  "frameworks": [
    "React",
    "Next.js",
    "Vanilla"
  ],
  "mood": [
    "kinetic",
    "bold"
  ],
  "intents": [
    "text on a curved path animation",
    "wavy scrolling text banner",
    "svg textpath startoffset scroll",
    "marquee along a curve",
    "scroll linked kinetic type"
  ],
  "status": "tested",
  "params": [
    {
      "key": "text",
      "label": "Text",
      "type": "text",
      "value": "Move with the page"
    },
    {
      "key": "speed",
      "label": "Drift speed (0 = scroll only)",
      "type": "range",
      "min": 0,
      "max": 200,
      "step": 5,
      "value": 40
    },
    {
      "key": "direction",
      "label": "Direction",
      "type": "select",
      "options": [
        [
          "left",
          "Left"
        ],
        [
          "right",
          "Right"
        ]
      ],
      "value": "left"
    },
    {
      "key": "color",
      "label": "Text colour",
      "type": "color",
      "value": "#fbf8f1"
    },
    {
      "key": "accent",
      "label": "Outline colour",
      "type": "color",
      "value": "#e6ff55"
    }
  ],
  "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 \"SVG text path scroll\" element to this project.\n\nThis is the \"SVG text path scroll\" element from the Enrichr Library: Large text set along a wavy SVG path that drifts on its own and slides further as the page scrolls, with an outlined echo line running the other way.\nPage: https://enrichr.dev/elements/svg-text-path-scroll.html\nMachine-readable spec: https://enrichr.dev/elements/svg-text-path-scroll.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/svg-text-path-scroll.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 \"SVG text path scroll\" 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 \"SVG text path scroll\" element from the Enrichr Library: Large text set along a wavy SVG path that drifts on its own and slides further as the page scrolls, with an outlined echo line running the other way.\nPage: https://enrichr.dev/elements/svg-text-path-scroll.html\nMachine-readable spec: https://enrichr.dev/elements/svg-text-path-scroll.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 \"SVG text path scroll\" element to this codebase.\n\nThis is the \"SVG text path scroll\" element from the Enrichr Library: Large text set along a wavy SVG path that drifts on its own and slides further as the page scrolls, with an outlined echo line running the other way.\nPage: https://enrichr.dev/elements/svg-text-path-scroll.html\nMachine-readable spec: https://enrichr.dev/elements/svg-text-path-scroll.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-svg-text-path-scroll.mdc so the rule stays with the project:\n---\ndescription: How to use the Enrichr SVG text path scroll 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 \"SVG text path scroll\" element. Tailwind is available but this component needs no utility classes.\n\nThis is the \"SVG text path scroll\" element from the Enrichr Library: Large text set along a wavy SVG path that drifts on its own and slides further as the page scrolls, with an outlined echo line running the other way.\nPage: https://enrichr.dev/elements/svg-text-path-scroll.html\nMachine-readable spec: https://enrichr.dev/elements/svg-text-path-scroll.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- svg-text-path-scroll.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 \"./svg-text-path-scroll\"; // markup is the HTML string; mount is the JavaScript's mount function\n\nexport default function SvgTextPathScroll(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 \"SVG text path scroll\" element to this React + Vite + TypeScript + Tailwind project. Do not install any packages.\n\nThis is the \"SVG text path scroll\" element from the Enrichr Library: Large text set along a wavy SVG path that drifts on its own and slides further as the page scrolls, with an outlined echo line running the other way.\nPage: https://enrichr.dev/elements/svg-text-path-scroll.html\nMachine-readable spec: https://enrichr.dev/elements/svg-text-path-scroll.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- svg-text-path-scroll.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/SvgTextPathScroll.tsx):\n```tsx\n\"use client\";\nimport { useEffect, useRef } from \"react\";\nimport { markup, mount } from \"./svg-text-path-scroll\"; // markup is the HTML string; mount is the JavaScript's mount function\n\nexport default function SvgTextPathScroll(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 \"SVG text path scroll\" element.\n\nThis is the \"SVG text path scroll\" element from the Enrichr Library: Large text set along a wavy SVG path that drifts on its own and slides further as the page scrolls, with an outlined echo line running the other way.\nPage: https://enrichr.dev/elements/svg-text-path-scroll.html\nMachine-readable spec: https://enrichr.dev/elements/svg-text-path-scroll.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), svg-text-path-scroll.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 \"SVG text path scroll\" element. No packages, no server code.\n\nThis is the \"SVG text path scroll\" element from the Enrichr Library: Large text set along a wavy SVG path that drifts on its own and slides further as the page scrolls, with an outlined echo line running the other way.\nPage: https://enrichr.dev/elements/svg-text-path-scroll.html\nMachine-readable spec: https://enrichr.dev/elements/svg-text-path-scroll.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 svg-text-path-scroll.js and then main.js), style.css (the CSS below), svg-text-path-scroll.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 \"SVG text path scroll\" 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 \"SVG text path scroll\" element from the Enrichr Library: Large text set along a wavy SVG path that drifts on its own and slides further as the page scrolls, with an outlined echo line running the other way.\nPage: https://enrichr.dev/elements/svg-text-path-scroll.html\nMachine-readable spec: https://enrichr.dev/elements/svg-text-path-scroll.json\n\nWhat it does: The text is repeated inside an SVG textPath that follows a wavy path built from two sine waves. The script measures the length of one repeat with getComputedTextLength, repeats the text enough times to cover the whole path, and then animates startOffset between minus one repeat length and zero, so the wrap is invisible. Every frame the offset is the drift speed times elapsed time plus an amount taken from how far the page has scrolled, smoothed so scroll feels fluid. Scrolling down pushes the text in the chosen direction and scrolling up pulls it back. A second, outline-only line sits on a parallel path and moves the opposite way at about half the speed. The SVG uses a slice viewBox, so the text stays large on narrow containers.\nAccessibility: The SVG has a role of img and an accessible name taken from the text, and the repeated glyph copies are hidden from assistive technology so the phrase is read once. With reduced motion the text does not drift or follow scroll and a still frame is shown. Keep the text short and the contrast high, because letters on a curve are harder to read than straight text.\n\nTunable settings:\n- Text: text, default Move with the page\n- Drift speed (0 = scroll only): range 0 to 200, step 5, default 40\n- Direction: select (Left / Right), default left\n- Text colour: color, default #fbf8f1\n- Outline colour: color, default #e6ff55\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/svg-text-path-scroll.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 \"SVG text path scroll\" 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 \"SVG text path scroll\" element from the Enrichr Library: Large text set along a wavy SVG path that drifts on its own and slides further as the page scrolls, with an outlined echo line running the other way.\nPage: https://enrichr.dev/elements/svg-text-path-scroll.html\nMachine-readable spec: https://enrichr.dev/elements/svg-text-path-scroll.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 SvgTextPathScroll.\n2. Paste the JavaScript below into a separate code file named svg-text-path-scroll.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 \"./svg-text-path-scroll\"; // markup is the HTML string; mount is the JavaScript's mount function\n\nexport default function SvgTextPathScroll(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(SvgTextPathScroll, {\n  text: { type: ControlType.String, title: \"Text\", defaultValue: \"Move with the page\" },\n  speed: { type: ControlType.Number, title: \"Drift speed\", min: 0, max: 200, step: 5, defaultValue: 40 },\n  direction: { type: ControlType.Enum, title: \"Direction\", options: [\"left\",\"right\"], optionTitles: [\"Left\",\"Right\"], defaultValue: \"left\" },\n  color: { type: ControlType.Color, title: \"Text colour\", defaultValue: \"#fbf8f1\" },\n  accent: { type: ControlType.Color, title: \"Outline colour\", defaultValue: \"#e6ff55\" },\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 \"SVG text path scroll\" 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 \"SVG text path scroll\" element from the Enrichr Library: Large text set along a wavy SVG path that drifts on its own and slides further as the page scrolls, with an outlined echo line running the other way.\nPage: https://enrichr.dev/elements/svg-text-path-scroll.html\nMachine-readable spec: https://enrichr.dev/elements/svg-text-path-scroll.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-svg-text-path-scroll\"></div>, and a <script> block with the JavaScript followed by:\n   mount(document.getElementById(\"enrichr-svg-text-path-scroll\"), { ...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 SVG has a role of img and an accessible name taken from the text, and the repeated glyph copies are hidden from assistive technology so the phrase is read once. With reduced motion the text does not drift or follow scroll and a still frame is shown. Keep the text short and the contrast high, because letters on a curve are harder to read than straight text.",
  "performance": "Two startOffset attributes change per frame, which makes the browser re-lay out two text runs on a path. That is cheap for a few hundred glyphs but keep the repeat count and font size reasonable. The loop runs only while there is drift or scroll catch up and it pauses off screen. It reads window.scrollY, so it follows native scroll and smooth scroll libraries.",
  "dependencies": [],
  "source": {
    "markup": "<div class=\"ef-stp\"><svg class=\"ef-stp__svg\" viewBox=\"0 0 1000 400\" preserveAspectRatio=\"xMidYMid slice\" role=\"img\"><title></title><defs><path class=\"ef-stp__pa\" d=\"M0 0\"/><path class=\"ef-stp__pb\" d=\"M0 0\"/></defs><text class=\"ef-stp__tb\" aria-hidden=\"true\"><textPath class=\"ef-stp__tpb\"></textPath></text><text class=\"ef-stp__ta\" aria-hidden=\"true\"><textPath class=\"ef-stp__tpa\"></textPath></text></svg></div>",
    "css": "/* Enrichr Library · https://enrichr.dev */\n.ef-stp { container-type: inline-size; width: 100%; box-sizing: border-box; }\n.ef-stp__svg { display: block; width: 100%; height: 15rem; height: clamp(15rem, 36cqi, 24rem); overflow: hidden; }\n.ef-stp__ta, .ef-stp__tb { font-family: ui-sans-serif, system-ui, \"Segoe UI\", Roboto, Helvetica, Arial, sans-serif; font-size: 72px; font-weight: 800; letter-spacing: 0.01em; }\n.ef-stp__ta { fill: var(--ef-stp-c, #fbf8f1); }\n.ef-stp__tb { fill: none; stroke: var(--ef-stp-a, #e6ff55); stroke-width: 1.5px; vector-effect: non-scaling-stroke; stroke-linejoin: round; opacity: 0.85; }\n.ef-stp__tb * { vector-effect: non-scaling-stroke; }",
    "js": "// Enrichr Library · https://enrichr.dev\n// SVG text on a path: large text laid along a wavy SVG path, with a second outlined line running the other way underneath.\n// The text slides along the path by animating textPath startOffset. It drifts on its own and also follows page scroll (scroll down pushes it in the chosen direction, scroll up pulls it back).\n// With reduced motion it shows a still frame. Extras: amplitude (wave height, default 60) and follow (scroll gain, default 0.6) can be passed to update().\n// mount(root, { text, speed (drift in SVG units per second, 0 = scroll only), direction (\"left\" or \"right\"), color, accent, amplitude, follow })\nfunction mount(root, o) {\n  var reduce = window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches;\n  var svg = root.querySelector(\".ef-stp__svg\"), box = root.querySelector(\".ef-stp\");\n  var pa = svg.querySelector(\".ef-stp__pa\"), pb = svg.querySelector(\".ef-stp__pb\");\n  var tpa = svg.querySelector(\".ef-stp__tpa\"), tpb = svg.querySelector(\".ef-stp__tpb\");\n  var XL = \"http://www.w3.org/1999/xlink\", uid = \"ef-stp-\" + Math.random().toString(36).slice(2, 8);\n  var opts = {}, unit = 0, measured = false, clock = 0, sTarget = 0, sShown = 0, lastScroll = window.scrollY || 0;\n  var raf = 0, last = 0, visible = true, io = null;\n\n  function link(tp, id) { tp.setAttribute(\"href\", \"#\" + id); tp.setAttributeNS(XL, \"xlink:href\", \"#\" + id); }\n  pa.setAttribute(\"id\", uid + \"-a\"); pb.setAttribute(\"id\", uid + \"-b\");\n  link(tpa, uid + \"-a\"); link(tpb, uid + \"-b\");\n\n  function wave(y0, amp) {\n    var d = \"\";\n    for (var x = -300; x <= 1300; x += 8) {\n      var y = y0 + amp * Math.sin(x * 0.0072 + 0.6) + amp * 0.28 * Math.sin(x * 0.019 + 1.7);\n      d += (x === -300 ? \"M\" : \"L\") + x + \" \" + y.toFixed(1);\n    }\n    return d;\n  }\n  function fill() {\n    var u = opts.text + \"  •  \";\n    tpa.textContent = u; tpb.textContent = u;\n    var len = 0;\n    try { len = tpa.getComputedTextLength(); } catch (e) { len = 0; }\n    measured = len > 20;\n    unit = measured ? len : u.length * 72 * 0.56;\n    var total = 1700, k = Math.ceil((total + unit) / unit) + 1, s = \"\";\n    for (var i = 0; i < k; i++) s += u;\n    tpa.textContent = s; tpb.textContent = s;\n  }\n  function place() {\n    var dir = opts.direction === \"right\" ? -1 : 1;\n    var p = dir * (clock * Number(opts.speed) + sShown);\n    var m = ((p % unit) + unit) % unit;\n    tpa.setAttribute(\"startOffset\", (-m).toFixed(2));\n    var q = ((((-p * 0.55) % unit) + unit) % unit);\n    tpb.setAttribute(\"startOffset\", (-q).toFixed(2));\n  }\n  function kick() { if (!reduce && !raf && visible) { last = performance.now(); raf = requestAnimationFrame(tick); } }\n  function tick(t) {\n    raf = 0;\n    var dt = Math.min(0.05, (t - last) / 1000 || 0.016); last = t;\n    if (!measured) { fill(); }\n    var y = window.scrollY || 0;\n    sTarget += (y - lastScroll) * Number(opts.follow); lastScroll = y;\n    sShown += (sTarget - sShown) * (1 - Math.exp(-dt * 7));\n    clock += dt;\n    place();\n    if (visible && (Number(opts.speed) > 0 || Math.abs(sTarget - sShown) > 0.01)) raf = requestAnimationFrame(tick);\n  }\n  function update(next) {\n    var prev = opts.text, prevAmp = opts.amplitude;\n    opts = Object.assign({ text: \"Move with the page\", speed: 40, direction: \"left\", color: \"#fbf8f1\", accent: \"#e6ff55\", amplitude: 60, follow: 0.6 }, opts, next || {});\n    box.style.setProperty(\"--ef-stp-c\", opts.color);\n    box.style.setProperty(\"--ef-stp-a\", opts.accent);\n    svg.querySelector(\"title\").textContent = opts.text;\n    svg.setAttribute(\"aria-label\", opts.text);\n    if (prevAmp !== Number(opts.amplitude)) {\n      var a = Number(opts.amplitude);\n      pa.setAttribute(\"d\", wave(168, a)); pb.setAttribute(\"d\", wave(268, a));\n      opts.amplitude = a;\n    }\n    if (prev !== opts.text) fill();\n    place(); kick();\n  }\n  update(o);\n  if (!reduce) {\n    window.addEventListener(\"scroll\", kick, { passive: true });\n    if (\"IntersectionObserver\" in window) {\n      io = new IntersectionObserver(function (e) { visible = e[0].isIntersecting; if (visible) { lastScroll = window.scrollY || 0; kick(); } else { cancelAnimationFrame(raf); raf = 0; } });\n      io.observe(root);\n    }\n  }\n  return {\n    update: update,\n    destroy: function () {\n      cancelAnimationFrame(raf); raf = 0;\n      window.removeEventListener(\"scroll\", kick);\n      if (io) io.disconnect();\n    }\n  };\n}"
  }
}