{
  "id": "zigzag-stripe-flow",
  "kind": "element",
  "title": "Zigzag stripe flow",
  "summary": "Bold zigzag stripes in an SVG pattern that drift straight down in a seamless, never-ending loop.",
  "url": "https://enrichr.dev/elements/zigzag-stripe-flow.html",
  "section": "svg-bg",
  "techniques": [],
  "stack": [
    "Vanilla JS",
    "SVG"
  ],
  "frameworks": [
    "React",
    "Next.js",
    "Vanilla"
  ],
  "mood": [
    "bold",
    "kinetic"
  ],
  "intents": [
    "zigzag stripe background",
    "animated chevron pattern",
    "moving zigzag svg pattern",
    "seamless stripe loop background",
    "chevron background animation"
  ],
  "status": "tested",
  "params": [
    {
      "key": "size",
      "label": "Tile size (px)",
      "type": "range",
      "min": 60,
      "max": 400,
      "step": 2,
      "value": 200
    },
    {
      "key": "thickness",
      "label": "Band thickness (out of 200)",
      "type": "range",
      "min": 10,
      "max": 90,
      "step": 1,
      "value": 50
    },
    {
      "key": "speed",
      "label": "Speed (1 = one tile every 8 s)",
      "type": "range",
      "min": 0,
      "max": 4,
      "step": 0.05,
      "value": 1
    },
    {
      "key": "stripes",
      "label": "Stripes",
      "type": "color",
      "value": "#0c1e18"
    },
    {
      "key": "background",
      "label": "Background",
      "type": "color",
      "value": "#fbf8f1"
    }
  ],
  "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 \"Zigzag stripe flow\" element to this project.\n\nThis is the \"Zigzag stripe flow\" element from the Enrichr Library: Bold zigzag stripes in an SVG pattern that drift straight down in a seamless, never-ending loop.\nPage: https://enrichr.dev/elements/zigzag-stripe-flow.html\nMachine-readable spec: https://enrichr.dev/elements/zigzag-stripe-flow.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/zigzag-stripe-flow.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 \"Zigzag stripe flow\" 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 \"Zigzag stripe flow\" element from the Enrichr Library: Bold zigzag stripes in an SVG pattern that drift straight down in a seamless, never-ending loop.\nPage: https://enrichr.dev/elements/zigzag-stripe-flow.html\nMachine-readable spec: https://enrichr.dev/elements/zigzag-stripe-flow.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 \"Zigzag stripe flow\" element to this codebase.\n\nThis is the \"Zigzag stripe flow\" element from the Enrichr Library: Bold zigzag stripes in an SVG pattern that drift straight down in a seamless, never-ending loop.\nPage: https://enrichr.dev/elements/zigzag-stripe-flow.html\nMachine-readable spec: https://enrichr.dev/elements/zigzag-stripe-flow.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-zigzag-stripe-flow.mdc so the rule stays with the project:\n---\ndescription: How to use the Enrichr Zigzag stripe flow 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 \"Zigzag stripe flow\" element. Tailwind is available but this component needs no utility classes.\n\nThis is the \"Zigzag stripe flow\" element from the Enrichr Library: Bold zigzag stripes in an SVG pattern that drift straight down in a seamless, never-ending loop.\nPage: https://enrichr.dev/elements/zigzag-stripe-flow.html\nMachine-readable spec: https://enrichr.dev/elements/zigzag-stripe-flow.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- zigzag-stripe-flow.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 \"./zigzag-stripe-flow\"; // markup is the HTML string; mount is the JavaScript's mount function\n\nexport default function ZigzagStripeFlow(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 \"Zigzag stripe flow\" element to this React + Vite + TypeScript + Tailwind project. Do not install any packages.\n\nThis is the \"Zigzag stripe flow\" element from the Enrichr Library: Bold zigzag stripes in an SVG pattern that drift straight down in a seamless, never-ending loop.\nPage: https://enrichr.dev/elements/zigzag-stripe-flow.html\nMachine-readable spec: https://enrichr.dev/elements/zigzag-stripe-flow.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- zigzag-stripe-flow.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/ZigzagStripeFlow.tsx):\n```tsx\n\"use client\";\nimport { useEffect, useRef } from \"react\";\nimport { markup, mount } from \"./zigzag-stripe-flow\"; // markup is the HTML string; mount is the JavaScript's mount function\n\nexport default function ZigzagStripeFlow(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 \"Zigzag stripe flow\" element.\n\nThis is the \"Zigzag stripe flow\" element from the Enrichr Library: Bold zigzag stripes in an SVG pattern that drift straight down in a seamless, never-ending loop.\nPage: https://enrichr.dev/elements/zigzag-stripe-flow.html\nMachine-readable spec: https://enrichr.dev/elements/zigzag-stripe-flow.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), zigzag-stripe-flow.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 \"Zigzag stripe flow\" element. No packages, no server code.\n\nThis is the \"Zigzag stripe flow\" element from the Enrichr Library: Bold zigzag stripes in an SVG pattern that drift straight down in a seamless, never-ending loop.\nPage: https://enrichr.dev/elements/zigzag-stripe-flow.html\nMachine-readable spec: https://enrichr.dev/elements/zigzag-stripe-flow.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 zigzag-stripe-flow.js and then main.js), style.css (the CSS below), zigzag-stripe-flow.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 \"Zigzag stripe flow\" 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 \"Zigzag stripe flow\" element from the Enrichr Library: Bold zigzag stripes in an SVG pattern that drift straight down in a seamless, never-ending loop.\nPage: https://enrichr.dev/elements/zigzag-stripe-flow.html\nMachine-readable spec: https://enrichr.dev/elements/zigzag-stripe-flow.json\n\nWhat it does: One SVG pattern tile, 200 units square, holds the background and three zigzag bands. Each band rises and falls 100 units across the tile and is 50 units thick. One band sits across the top edge and one across the bottom edge, so where one tile ends the next carries the same band on and no seam shows. The pattern fills the whole box. Each frame sets the pattern's own transform to a downward move of progress times the tile height, plus a scale for the tile size, with no easing. That is what the original SVG animateTransform did: 200 units in 8 seconds, on repeat. Because each loop moves exactly one tile, the end of a loop looks the same as the start.\nAccessibility: The SVG is decorative and has a text label. With prefers-reduced-motion the stripes are shown still. The motion is slow and steady, 25 pixels a second at the default size. High-contrast stripes in motion can bother some people, so keep the speed low behind text or soften the colours. Nothing needs the keyboard.\n\nTunable settings:\n- Tile size (px): range 60 to 400, step 2, default 200\n- Band thickness (out of 200): range 10 to 90, step 1, default 50\n- Speed (1 = one tile every 8 s): range 0 to 4, step 0.05, default 1\n- Stripes: color, default #0c1e18\n- Background: color, default #fbf8f1\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/zigzag-stripe-flow.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 \"Zigzag stripe flow\" 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 \"Zigzag stripe flow\" element from the Enrichr Library: Bold zigzag stripes in an SVG pattern that drift straight down in a seamless, never-ending loop.\nPage: https://enrichr.dev/elements/zigzag-stripe-flow.html\nMachine-readable spec: https://enrichr.dev/elements/zigzag-stripe-flow.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 ZigzagStripeFlow.\n2. Paste the JavaScript below into a separate code file named zigzag-stripe-flow.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 \"./zigzag-stripe-flow\"; // markup is the HTML string; mount is the JavaScript's mount function\n\nexport default function ZigzagStripeFlow(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(ZigzagStripeFlow, {\n  size: { type: ControlType.Number, title: \"Tile size\", min: 60, max: 400, step: 2, defaultValue: 200 },\n  thickness: { type: ControlType.Number, title: \"Band thickness\", min: 10, max: 90, step: 1, defaultValue: 50 },\n  speed: { type: ControlType.Number, title: \"Speed\", min: 0, max: 4, step: 0.05, defaultValue: 1 },\n  stripes: { type: ControlType.Color, title: \"Stripes\", defaultValue: \"#0c1e18\" },\n  background: { type: ControlType.Color, title: \"Background\", defaultValue: \"#fbf8f1\" },\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 \"Zigzag stripe flow\" 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 \"Zigzag stripe flow\" element from the Enrichr Library: Bold zigzag stripes in an SVG pattern that drift straight down in a seamless, never-ending loop.\nPage: https://enrichr.dev/elements/zigzag-stripe-flow.html\nMachine-readable spec: https://enrichr.dev/elements/zigzag-stripe-flow.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-zigzag-stripe-flow\"></div>, and a <script> block with the JavaScript followed by:\n   mount(document.getElementById(\"enrichr-zigzag-stripe-flow\"), { ...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 is decorative and has a text label. With prefers-reduced-motion the stripes are shown still. The motion is slow and steady, 25 pixels a second at the default size. High-contrast stripes in motion can bother some people, so keep the speed low behind text or soften the colours. Nothing needs the keyboard.",
  "performance": "Each frame changes one attribute, the pattern transform, and the browser repaints the pattern from one small tile. There are no filters and no element per stripe. The loop pauses off screen or in a hidden tab.",
  "dependencies": [],
  "codepen": "https://codepen.io/Enrichr-Dev/pen/wBJRxNZ",
  "source": {
    "markup": "<div class=\"ef-zzs\"><svg class=\"ef-zzs__svg\" xmlns=\"http://www.w3.org/2000/svg\" role=\"img\" aria-label=\"Bold zigzag stripes drifting slowly downward in a seamless loop\"></svg></div>",
    "css": "/* Enrichr Library · https://enrichr.dev */\n.ef-zzs { position: relative; width: 100%; min-height: 24rem; overflow: hidden; border-radius: 1rem; background: #fbf8f1; }\n.ef-zzs .ef-zzs__svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }",
    "js": "// Enrichr Library · https://enrichr.dev\n// Zigzag stripe flow: an SVG pattern of bold chevron bands that drifts straight down forever. One square tile holds a\n// background and three zigzag bands (each band rises and falls 100 units across a 200 unit tile), so the tiles meet with no\n// seam. The pattern's own transform moves it down by exactly one tile height per loop at a constant rate (linear, like an\n// SVG animateTransform), so the end of a loop looks the same as the start. Default timing: one tile every 8 seconds.\n// Reduced motion shows the stripes still. The loop pauses off screen and in hidden tabs.\n// mount(root, { size (tile size, px), thickness (band thickness, out of 200), speed (1 = one tile per 8 s),\n//               stripes (band colour), background })\nfunction mount(root, o) {\n  var reduce = window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches;\n  var NS = \"http://www.w3.org/2000/svg\";\n  var wrap = root.querySelector(\".ef-zzs\");\n  var svg = root.querySelector(\".ef-zzs__svg\");\n  var uid = \"ef-zzs-\" + Math.random().toString(36).slice(2, 10);\n  var opts = {}, raf = 0, visible = true, io = null, ro = null, destroyed = false, last = 0, phase = 0;\n\n  function el(name, attrs) {\n    var n = document.createElementNS(NS, name);\n    for (var k in attrs) n.setAttribute(k, attrs[k]);\n    return n;\n  }\n  function num(v, d) { v = Number(v); return isFinite(v) ? v : d; }\n\n  // one 200 x 200 tile: the background, then three bands. Band 0 sits across the top edge and band 2 across the bottom\n  // edge, so where one tile ends the next one carries on the same band.\n  svg.textContent = \"\";\n  var defs = el(\"defs\", {});\n  var pat = el(\"pattern\", { id: uid, width: 200, height: 200, patternUnits: \"userSpaceOnUse\" });\n  var bg = el(\"rect\", { width: 200, height: 200 });\n  var bands = [];\n  pat.appendChild(bg);\n  for (var i = 0; i < 3; i++) { bands.push(el(\"polygon\", {})); pat.appendChild(bands[i]); }\n  defs.appendChild(pat);\n  svg.appendChild(defs);\n  svg.appendChild(el(\"rect\", { width: \"100%\", height: \"100%\", fill: \"url(#\" + uid + \")\" }));\n\n  function shape() {\n    var th = opts.thickness;\n    for (var k = 0; k < 3; k++) {\n      var y = -75 + 100 * k;\n      bands[k].setAttribute(\"points\", \"0,\" + y + \" 100,\" + (y + 100) + \" 200,\" + y + \" 200,\" + (y + th) + \" 100,\" + (y + 100 + th) + \" 0,\" + (y + th));\n    }\n  }\n  // the tile is drawn in 200 unit space and scaled to the chosen size; the translate moves it down by one tile per loop\n  function frame() {\n    var k = opts.size / 200;\n    pat.setAttribute(\"patternTransform\", \"translate(0 \" + (phase * opts.size).toFixed(3) + \") scale(\" + k + \")\");\n  }\n\n  function loop(now) {\n    raf = requestAnimationFrame(loop);\n    var dt = Math.min(0.05, (now - last) / 1000 || 0); last = now;\n    if (!visible || document.hidden) return;\n    phase = (phase + dt * opts.speed / 8) % 1; // 8 s per tile at speed 1, as in the original\n    frame();\n  }\n\n  function update(partial) {\n    opts = Object.assign({ size: 200, thickness: 50, speed: 1, stripes: \"#0c1e18\", background: \"#fbf8f1\" }, opts, partial || {});\n    opts.size = Math.max(20, num(opts.size, 200));\n    opts.thickness = Math.min(99, Math.max(1, num(opts.thickness, 50)));\n    opts.speed = Math.max(0, num(opts.speed, 1));\n    bg.setAttribute(\"fill\", opts.background);\n    for (var k = 0; k < 3; k++) bands[k].setAttribute(\"fill\", opts.stripes);\n    wrap.style.background = opts.background;\n    if (destroyed) return;\n    shape();\n    frame();\n  }\n\n  update(o);\n  if (!reduce) {\n    if (\"IntersectionObserver\" in window) { io = new IntersectionObserver(function (e) { visible = e[0].isIntersecting; }); io.observe(wrap); }\n    last = performance.now(); raf = requestAnimationFrame(loop);\n  }\n  // the pattern is in user space, so it needs no maths on resize; redraw once in case the box was hidden at mount\n  if (\"ResizeObserver\" in window) { ro = new ResizeObserver(function () { if (!destroyed) frame(); }); ro.observe(wrap); }\n  return {\n    update: update,\n    destroy: function () {\n      destroyed = true; cancelAnimationFrame(raf);\n      if (io) io.disconnect();\n      if (ro) ro.disconnect();\n    }\n  };\n}"
  }
}