{
  "id": "mask-shape-sections",
  "kind": "element",
  "title": "Mask shape sections",
  "summary": "The same image revealed through a circle, a diamond and a band as each section scrolls into view.",
  "url": "https://enrichr.dev/elements/mask-shape-sections.html",
  "section": "gallery",
  "techniques": [
    "scroll-driven",
    "reveal"
  ],
  "stack": [
    "Vanilla JS",
    "CSS"
  ],
  "frameworks": [
    "React",
    "Next.js",
    "Vanilla"
  ],
  "mood": [
    "editorial",
    "bold"
  ],
  "intents": [
    "image mask reveal",
    "clip path scroll",
    "shaped image sections",
    "diamond circle mask",
    "scroll image reveal"
  ],
  "status": "tested",
  "params": [
    {
      "key": "captions",
      "label": "Captions (comma separated)",
      "type": "text",
      "value": "Circle, Diamond, Band"
    },
    {
      "key": "image",
      "label": "Image URL (empty uses a gradient)",
      "type": "text",
      "value": ""
    },
    {
      "key": "height",
      "label": "Section height (px)",
      "type": "range",
      "min": 120,
      "max": 520,
      "step": 8,
      "value": 256
    },
    {
      "key": "manual",
      "label": "Fixed progress % (0 follows scroll)",
      "type": "range",
      "min": 0,
      "max": 100,
      "step": 5,
      "value": 0
    },
    {
      "key": "colorA",
      "label": "Gradient colour A",
      "type": "color",
      "value": "#2f7d5b"
    },
    {
      "key": "colorB",
      "label": "Gradient colour B",
      "type": "color",
      "value": "#c6f26b"
    }
  ],
  "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 \"Mask shape sections\" element to this project.\n\nThis is the \"Mask shape sections\" element from the Enrichr Library: The same image revealed through a circle, a diamond and a band as each section scrolls into view.\nPage: https://enrichr.dev/elements/mask-shape-sections.html\nMachine-readable spec: https://enrichr.dev/elements/mask-shape-sections.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/mask-shape-sections.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 \"Mask shape sections\" 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 \"Mask shape sections\" element from the Enrichr Library: The same image revealed through a circle, a diamond and a band as each section scrolls into view.\nPage: https://enrichr.dev/elements/mask-shape-sections.html\nMachine-readable spec: https://enrichr.dev/elements/mask-shape-sections.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 \"Mask shape sections\" element to this codebase.\n\nThis is the \"Mask shape sections\" element from the Enrichr Library: The same image revealed through a circle, a diamond and a band as each section scrolls into view.\nPage: https://enrichr.dev/elements/mask-shape-sections.html\nMachine-readable spec: https://enrichr.dev/elements/mask-shape-sections.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-mask-shape-sections.mdc so the rule stays with the project:\n---\ndescription: How to use the Enrichr Mask shape sections 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 \"Mask shape sections\" element. Tailwind is available but this component needs no utility classes.\n\nThis is the \"Mask shape sections\" element from the Enrichr Library: The same image revealed through a circle, a diamond and a band as each section scrolls into view.\nPage: https://enrichr.dev/elements/mask-shape-sections.html\nMachine-readable spec: https://enrichr.dev/elements/mask-shape-sections.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- mask-shape-sections.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 \"./mask-shape-sections\"; // markup is the HTML string; mount is the JavaScript's mount function\n\nexport default function MaskShapeSections(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 \"Mask shape sections\" element to this React + Vite + TypeScript + Tailwind project. Do not install any packages.\n\nThis is the \"Mask shape sections\" element from the Enrichr Library: The same image revealed through a circle, a diamond and a band as each section scrolls into view.\nPage: https://enrichr.dev/elements/mask-shape-sections.html\nMachine-readable spec: https://enrichr.dev/elements/mask-shape-sections.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- mask-shape-sections.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/MaskShapeSections.tsx):\n```tsx\n\"use client\";\nimport { useEffect, useRef } from \"react\";\nimport { markup, mount } from \"./mask-shape-sections\"; // markup is the HTML string; mount is the JavaScript's mount function\n\nexport default function MaskShapeSections(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 \"Mask shape sections\" element.\n\nThis is the \"Mask shape sections\" element from the Enrichr Library: The same image revealed through a circle, a diamond and a band as each section scrolls into view.\nPage: https://enrichr.dev/elements/mask-shape-sections.html\nMachine-readable spec: https://enrichr.dev/elements/mask-shape-sections.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), mask-shape-sections.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 \"Mask shape sections\" element. No packages, no server code.\n\nThis is the \"Mask shape sections\" element from the Enrichr Library: The same image revealed through a circle, a diamond and a band as each section scrolls into view.\nPage: https://enrichr.dev/elements/mask-shape-sections.html\nMachine-readable spec: https://enrichr.dev/elements/mask-shape-sections.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 mask-shape-sections.js and then main.js), style.css (the CSS below), mask-shape-sections.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 \"Mask shape sections\" 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 \"Mask shape sections\" element from the Enrichr Library: The same image revealed through a circle, a diamond and a band as each section scrolls into view.\nPage: https://enrichr.dev/elements/mask-shape-sections.html\nMachine-readable spec: https://enrichr.dev/elements/mask-shape-sections.json\n\nWhat it does: Each section holds one image layer clipped by a CSS clip-path whose size is a function of a single custom property, --p. JavaScript sets --p from 0 to 1 as that section scrolls into view, eased with a smoothstep curve. The circle grows its radius, the diamond grows its four points outward, and the band opens vertically from the middle. Because the shape lives in CSS, adding a new one is a single rule.\nAccessibility: The image layer is decorative; give meaningful images real alt text by using an img element in the layer. With reduced motion every shape is fully open and unmasked. Captions use a blend mode, so check their contrast on your own images.\n\nTunable settings:\n- Captions (comma separated): text, default Circle, Diamond, Band\n- Image URL (empty uses a gradient): text, default \n- Section height (px): range 120 to 520, step 8, default 256\n- Fixed progress % (0 follows scroll): range 0 to 100, step 5, default 0\n- Gradient colour A: color, default #2f7d5b\n- Gradient colour B: color, default #c6f26b\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/mask-shape-sections.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 \"Mask shape sections\" 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 \"Mask shape sections\" element from the Enrichr Library: The same image revealed through a circle, a diamond and a band as each section scrolls into view.\nPage: https://enrichr.dev/elements/mask-shape-sections.html\nMachine-readable spec: https://enrichr.dev/elements/mask-shape-sections.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 MaskShapeSections.\n2. Paste the JavaScript below into a separate code file named mask-shape-sections.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 \"./mask-shape-sections\"; // markup is the HTML string; mount is the JavaScript's mount function\n\nexport default function MaskShapeSections(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(MaskShapeSections, {\n  captions: { type: ControlType.String, title: \"Captions (comma separated)\", defaultValue: \"Circle, Diamond, Band\" },\n  image: { type: ControlType.String, title: \"Image URL (empty uses a gradient)\", defaultValue: \"\" },\n  height: { type: ControlType.Number, title: \"Section height\", min: 120, max: 520, step: 8, defaultValue: 256 },\n  manual: { type: ControlType.Number, title: \"Fixed progress %\", min: 0, max: 100, step: 5, defaultValue: 0 },\n  colorA: { type: ControlType.Color, title: \"Gradient colour A\", defaultValue: \"#2f7d5b\" },\n  colorB: { type: ControlType.Color, title: \"Gradient colour B\", defaultValue: \"#c6f26b\" },\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 \"Mask shape sections\" 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 \"Mask shape sections\" element from the Enrichr Library: The same image revealed through a circle, a diamond and a band as each section scrolls into view.\nPage: https://enrichr.dev/elements/mask-shape-sections.html\nMachine-readable spec: https://enrichr.dev/elements/mask-shape-sections.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-mask-shape-sections\"></div>, and a <script> block with the JavaScript followed by:\n   mount(document.getElementById(\"enrichr-mask-shape-sections\"), { ...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 image layer is decorative; give meaningful images real alt text by using an img element in the layer. With reduced motion every shape is fully open and unmasked. Captions use a blend mode, so check their contrast on your own images.",
  "performance": "Scroll events are coalesced into one frame, and each frame only sets a custom property per section. Clip-path animates cheaply, but very large images should still be sized sensibly.",
  "dependencies": [],
  "source": {
    "markup": "<div class=\"ef-mask\">\r\n  <div class=\"ef-mask__item\" data-shape=\"circle\"><div class=\"ef-mask__img\"></div><span class=\"ef-mask__cap\"></span></div>\r\n  <div class=\"ef-mask__item\" data-shape=\"diamond\"><div class=\"ef-mask__img\"></div><span class=\"ef-mask__cap\"></span></div>\r\n  <div class=\"ef-mask__item\" data-shape=\"band\"><div class=\"ef-mask__img\"></div><span class=\"ef-mask__cap\"></span></div>\r\n</div>",
    "css": ".ef-mask__item { position: relative; height: var(--ef-h, 16rem); margin: 0 0 1rem; overflow: hidden; }\r\n.ef-mask__img { position: absolute; inset: 0; background-size: cover; background-position: center; background-image: linear-gradient(135deg, var(--ef-a, #2f7d5b), var(--ef-b, #c6f26b)); }\r\n.ef-mask__cap { position: absolute; left: 1rem; bottom: 0.8rem; z-index: 1; font-size: 0.85rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: #fff; mix-blend-mode: difference; }\r\n.ef-mask__item[data-shape=\"circle\"] .ef-mask__img { clip-path: circle(calc(var(--p, 1) * 75%) at 50% 50%); }\r\n.ef-mask__item[data-shape=\"diamond\"] .ef-mask__img { clip-path: polygon(50% calc(50% - var(--p, 1) * 60%), calc(50% + var(--p, 1) * 60%) 50%, 50% calc(50% + var(--p, 1) * 60%), calc(50% - var(--p, 1) * 60%) 50%); }\r\n.ef-mask__item[data-shape=\"band\"] .ef-mask__img { clip-path: inset(calc((1 - var(--p, 1)) * 48%) 0); }\r\n@media (prefers-reduced-motion: reduce) { .ef-mask__item .ef-mask__img { clip-path: none !important; } }",
    "js": "// Mask shape sections: the same image is cropped through a different shape in each section (circle, diamond, band),\r\n// and each shape opens as its section scrolls into view. The shape is a CSS clip-path driven by one custom property, --p.\r\n// mount(root, { image (URL or empty for a gradient), captions (comma separated), height (px), manual (0 = follow scroll, 1-100 = fixed %), colorA, colorB })\r\nfunction mount(root, o) {\r\n  var reduce = window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches;\r\n  var box = root.querySelector(\".ef-mask\");\r\n  var items = Array.prototype.slice.call(root.querySelectorAll(\".ef-mask__item\"));\r\n  var opts = {}, raf = 0;\r\n\r\n  function safeUrl(u) {\r\n    try { var x = new URL(u, window.location.href); return /^https?:$/.test(x.protocol) ? x.href : \"\"; } catch (e) { return \"\"; }\r\n  }\r\n  function render() {\r\n    var caps = opts.captions.split(\",\").map(function (c) { return c.trim(); });\r\n    var url = opts.image ? safeUrl(opts.image) : \"\";\r\n    box.style.setProperty(\"--ef-a\", opts.colorA);\r\n    box.style.setProperty(\"--ef-b\", opts.colorB);\r\n    box.style.setProperty(\"--ef-h\", opts.height + \"px\");\r\n    items.forEach(function (it, i) {\r\n      it.querySelector(\".ef-mask__cap\").textContent = caps[i] || \"\";\r\n      it.querySelector(\".ef-mask__img\").style.backgroundImage = url ? 'url(\"' + url + '\")' : \"\";\r\n    });\r\n    paint();\r\n  }\r\n  function paint() {\r\n    raf = 0;\r\n    var vh = window.innerHeight || 800;\r\n    items.forEach(function (it) {\r\n      var p = 1;\r\n      if (!reduce) {\r\n        if (opts.manual > 0) p = opts.manual / 100;\r\n        else {\r\n          var r = it.getBoundingClientRect();\r\n          var t = Math.min(1, Math.max(0, (vh * 0.95 - r.top) / (vh * 0.6)));\r\n          p = t * t * (3 - 2 * t);\r\n        }\r\n      }\r\n      it.style.setProperty(\"--p\", p.toFixed(3));\r\n    });\r\n  }\r\n  function schedule() { if (!raf) raf = requestAnimationFrame(paint); }\r\n  function update(next) {\r\n    opts = Object.assign({ image: \"\", captions: \"Circle, Diamond, Band\", height: 256, manual: 0, colorA: \"#2f7d5b\", colorB: \"#c6f26b\" }, opts, next || {});\r\n    render();\r\n  }\r\n  update(o);\r\n  if (!reduce) {\r\n    window.addEventListener(\"scroll\", schedule, { passive: true });\r\n    window.addEventListener(\"resize\", schedule);\r\n  }\r\n  return { update: update, destroy: function () { cancelAnimationFrame(raf); window.removeEventListener(\"scroll\", schedule); window.removeEventListener(\"resize\", schedule); } };\r\n}"
  }
}