{
  "id": "rainbow-shape-wave",
  "kind": "element",
  "title": "Rainbow shape wave",
  "summary": "A field of tiny rainbow stars, dots and pills that burst to full size as a ring-shaped wave rolls across them and bloom around the pointer.",
  "url": "https://enrichr.dev/elements/rainbow-shape-wave.html",
  "section": "background",
  "techniques": [
    "pointer-interaction",
    "stagger"
  ],
  "stack": [
    "Vanilla JS",
    "Canvas"
  ],
  "frameworks": [
    "React",
    "Next.js",
    "Vanilla"
  ],
  "mood": [
    "playful",
    "energetic"
  ],
  "intents": [
    "rainbow shape wave background",
    "confetti grid hover effect",
    "click ripple wave background",
    "animated stars and dots background",
    "colourful interactive hero background"
  ],
  "status": "tested",
  "params": [
    {
      "key": "gap",
      "label": "Spacing (px)",
      "type": "range",
      "min": 20,
      "max": 90,
      "step": 1,
      "value": 40
    },
    {
      "key": "radius",
      "label": "Pointer reach (% of short side)",
      "type": "range",
      "min": 5,
      "max": 60,
      "step": 1,
      "value": 30
    },
    {
      "key": "speedIn",
      "label": "Grow time (s)",
      "type": "range",
      "min": 0.05,
      "max": 2,
      "step": 0.05,
      "value": 0.5
    },
    {
      "key": "speedOut",
      "label": "Shrink time (s)",
      "type": "range",
      "min": 0.05,
      "max": 2,
      "step": 0.05,
      "value": 0.6
    },
    {
      "key": "restScale",
      "label": "Size at rest",
      "type": "range",
      "min": 0,
      "max": 0.4,
      "step": 0.01,
      "value": 0.09
    },
    {
      "key": "minHover",
      "label": "Smallest pop size",
      "type": "range",
      "min": 0.2,
      "max": 3,
      "step": 0.1,
      "value": 1
    },
    {
      "key": "maxHover",
      "label": "Largest pop size",
      "type": "range",
      "min": 1,
      "max": 5,
      "step": 0.1,
      "value": 3
    },
    {
      "key": "waveSpeed",
      "label": "Wave speed (px per second)",
      "type": "range",
      "min": 200,
      "max": 3000,
      "step": 50,
      "value": 1200
    },
    {
      "key": "waveWidth",
      "label": "Wave width (px)",
      "type": "range",
      "min": 40,
      "max": 500,
      "step": 10,
      "value": 180
    },
    {
      "key": "auto",
      "label": "Auto wave every (s, 0 is off)",
      "type": "range",
      "min": 0,
      "max": 15,
      "step": 0.5,
      "value": 5
    },
    {
      "key": "palette",
      "label": "Colours",
      "type": "select",
      "options": [
        [
          "rainbow",
          "Rainbow"
        ],
        [
          "enrichr",
          "Enrichr greens and lime"
        ]
      ],
      "value": "rainbow"
    },
    {
      "key": "background",
      "label": "Background",
      "type": "color",
      "value": "#0c1e18"
    }
  ],
  "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 \"Rainbow shape wave\" element to this project.\n\nThis is the \"Rainbow shape wave\" element from the Enrichr Library: A field of tiny rainbow stars, dots and pills that burst to full size as a ring-shaped wave rolls across them and bloom around the pointer.\nPage: https://enrichr.dev/elements/rainbow-shape-wave.html\nMachine-readable spec: https://enrichr.dev/elements/rainbow-shape-wave.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/rainbow-shape-wave.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 \"Rainbow shape wave\" 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 \"Rainbow shape wave\" element from the Enrichr Library: A field of tiny rainbow stars, dots and pills that burst to full size as a ring-shaped wave rolls across them and bloom around the pointer.\nPage: https://enrichr.dev/elements/rainbow-shape-wave.html\nMachine-readable spec: https://enrichr.dev/elements/rainbow-shape-wave.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 \"Rainbow shape wave\" element to this codebase.\n\nThis is the \"Rainbow shape wave\" element from the Enrichr Library: A field of tiny rainbow stars, dots and pills that burst to full size as a ring-shaped wave rolls across them and bloom around the pointer.\nPage: https://enrichr.dev/elements/rainbow-shape-wave.html\nMachine-readable spec: https://enrichr.dev/elements/rainbow-shape-wave.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-rainbow-shape-wave.mdc so the rule stays with the project:\n---\ndescription: How to use the Enrichr Rainbow shape wave 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 \"Rainbow shape wave\" element. Tailwind is available but this component needs no utility classes.\n\nThis is the \"Rainbow shape wave\" element from the Enrichr Library: A field of tiny rainbow stars, dots and pills that burst to full size as a ring-shaped wave rolls across them and bloom around the pointer.\nPage: https://enrichr.dev/elements/rainbow-shape-wave.html\nMachine-readable spec: https://enrichr.dev/elements/rainbow-shape-wave.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- rainbow-shape-wave.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 \"./rainbow-shape-wave\"; // markup is the HTML string; mount is the JavaScript's mount function\n\nexport default function RainbowShapeWave(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 \"Rainbow shape wave\" element to this React + Vite + TypeScript + Tailwind project. Do not install any packages.\n\nThis is the \"Rainbow shape wave\" element from the Enrichr Library: A field of tiny rainbow stars, dots and pills that burst to full size as a ring-shaped wave rolls across them and bloom around the pointer.\nPage: https://enrichr.dev/elements/rainbow-shape-wave.html\nMachine-readable spec: https://enrichr.dev/elements/rainbow-shape-wave.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- rainbow-shape-wave.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/RainbowShapeWave.tsx):\n```tsx\n\"use client\";\nimport { useEffect, useRef } from \"react\";\nimport { markup, mount } from \"./rainbow-shape-wave\"; // markup is the HTML string; mount is the JavaScript's mount function\n\nexport default function RainbowShapeWave(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 \"Rainbow shape wave\" element.\n\nThis is the \"Rainbow shape wave\" element from the Enrichr Library: A field of tiny rainbow stars, dots and pills that burst to full size as a ring-shaped wave rolls across them and bloom around the pointer.\nPage: https://enrichr.dev/elements/rainbow-shape-wave.html\nMachine-readable spec: https://enrichr.dev/elements/rainbow-shape-wave.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), rainbow-shape-wave.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 \"Rainbow shape wave\" element. No packages, no server code.\n\nThis is the \"Rainbow shape wave\" element from the Enrichr Library: A field of tiny rainbow stars, dots and pills that burst to full size as a ring-shaped wave rolls across them and bloom around the pointer.\nPage: https://enrichr.dev/elements/rainbow-shape-wave.html\nMachine-readable spec: https://enrichr.dev/elements/rainbow-shape-wave.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 rainbow-shape-wave.js and then main.js), style.css (the CSS below), rainbow-shape-wave.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 \"Rainbow shape wave\" 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 \"Rainbow shape wave\" element from the Enrichr Library: A field of tiny rainbow stars, dots and pills that burst to full size as a ring-shaped wave rolls across them and bloom around the pointer.\nPage: https://enrichr.dev/elements/rainbow-shape-wave.html\nMachine-readable spec: https://enrichr.dev/elements/rainbow-shape-wave.json\n\nWhat it does: The shapes sit on an even grid, centred in the box. Each one is a circle, a pill or a star with 4 to 10 points, has a random angle and colour (some colours are a two-tone radial gradient), and rests at 9% of its size. A wave is a ring that grows from its start point at a fixed speed; a shape inside the ring's width gets a sine bump, so it swells to its own random pop size as the ring passes and falls back after. Shapes near the pointer swell too, with a smoothstep falloff, and pick a new size, angle and star shape each time the pointer reaches them; the pointer's pull fades by 7% a frame once it stops. Growing and shrinking use an exponential ease that closes 95% of the gap in the grow or shrink time, worked out from the frame length so it runs the same at any refresh rate. A wave starts from the centre when the element first appears, from any click, and on the auto timer. Anything inside the root with a data-shape-mask attribute keeps shapes from showing under it, except while a wave is crossing.\nAccessibility: The canvas is decorative and has a text label. With prefers-reduced-motion it draws one still frame with the wave part way out and never animates. The pointer and click effects are decoration only; the timed wave shows the same motion without a mouse, and nothing needs the keyboard. Nothing flashes: each shape takes about half a second to grow.\n\nTunable settings:\n- Spacing (px): range 20 to 90, step 1, default 40\n- Pointer reach (% of short side): range 5 to 60, step 1, default 30\n- Grow time (s): range 0.05 to 2, step 0.05, default 0.5\n- Shrink time (s): range 0.05 to 2, step 0.05, default 0.6\n- Size at rest: range 0 to 0.4, step 0.01, default 0.09\n- Smallest pop size: range 0.2 to 3, step 0.1, default 1\n- Largest pop size: range 1 to 5, step 0.1, default 3\n- Wave speed (px per second): range 200 to 3000, step 50, default 1200\n- Wave width (px): range 40 to 500, step 10, default 180\n- Auto wave every (s, 0 is off): range 0 to 15, step 0.5, default 5\n- Colours: select (Rainbow / Enrichr greens and lime), default rainbow\n- Background: color, default #0c1e18\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/rainbow-shape-wave.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 \"Rainbow shape wave\" 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 \"Rainbow shape wave\" element from the Enrichr Library: A field of tiny rainbow stars, dots and pills that burst to full size as a ring-shaped wave rolls across them and bloom around the pointer.\nPage: https://enrichr.dev/elements/rainbow-shape-wave.html\nMachine-readable spec: https://enrichr.dev/elements/rainbow-shape-wave.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 RainbowShapeWave.\n2. Paste the JavaScript below into a separate code file named rainbow-shape-wave.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 \"./rainbow-shape-wave\"; // markup is the HTML string; mount is the JavaScript's mount function\n\nexport default function RainbowShapeWave(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(RainbowShapeWave, {\n  gap: { type: ControlType.Number, title: \"Spacing\", min: 20, max: 90, step: 1, defaultValue: 40 },\n  radius: { type: ControlType.Number, title: \"Pointer reach\", min: 5, max: 60, step: 1, defaultValue: 30 },\n  speedIn: { type: ControlType.Number, title: \"Grow time\", min: 0.05, max: 2, step: 0.05, defaultValue: 0.5 },\n  speedOut: { type: ControlType.Number, title: \"Shrink time\", min: 0.05, max: 2, step: 0.05, defaultValue: 0.6 },\n  restScale: { type: ControlType.Number, title: \"Size at rest\", min: 0, max: 0.4, step: 0.01, defaultValue: 0.09 },\n  minHover: { type: ControlType.Number, title: \"Smallest pop size\", min: 0.2, max: 3, step: 0.1, defaultValue: 1 },\n  maxHover: { type: ControlType.Number, title: \"Largest pop size\", min: 1, max: 5, step: 0.1, defaultValue: 3 },\n  waveSpeed: { type: ControlType.Number, title: \"Wave speed\", min: 200, max: 3000, step: 50, defaultValue: 1200 },\n  waveWidth: { type: ControlType.Number, title: \"Wave width\", min: 40, max: 500, step: 10, defaultValue: 180 },\n  auto: { type: ControlType.Number, title: \"Auto wave every\", min: 0, max: 15, step: 0.5, defaultValue: 5 },\n  palette: { type: ControlType.Enum, title: \"Colours\", options: [\"rainbow\",\"enrichr\"], optionTitles: [\"Rainbow\",\"Enrichr greens and lime\"], defaultValue: \"rainbow\" },\n  background: { type: ControlType.Color, title: \"Background\", defaultValue: \"#0c1e18\" },\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 \"Rainbow shape wave\" 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 \"Rainbow shape wave\" element from the Enrichr Library: A field of tiny rainbow stars, dots and pills that burst to full size as a ring-shaped wave rolls across them and bloom around the pointer.\nPage: https://enrichr.dev/elements/rainbow-shape-wave.html\nMachine-readable spec: https://enrichr.dev/elements/rainbow-shape-wave.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-rainbow-shape-wave\"></div>, and a <script> block with the JavaScript followed by:\n   mount(document.getElementById(\"enrichr-rainbow-shape-wave\"), { ...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 canvas is decorative and has a text label. With prefers-reduced-motion it draws one still frame with the wave part way out and never animates. The pointer and click effects are decoration only; the timed wave shows the same motion without a mouse, and nothing needs the keyboard. Nothing flashes: each shape takes about half a second to grow.",
  "performance": "One canvas, one draw per visible shape, no filters or shadows. Each gradient colour is made once and reused, because every shape shares one size. The grid is capped at about 6,000 shapes, the pixel ratio at 2, and the loop pauses off screen or in a hidden tab, with its clock stopped so waves pick up where they left off.",
  "dependencies": [],
  "codepen": "https://codepen.io/Enrichr-Dev/pen/wBJRxRZ",
  "source": {
    "markup": "<div class=\"ef-rsw\"><canvas class=\"ef-rsw__c\" role=\"img\" aria-label=\"A field of tiny rainbow stars, dots and pills that swell into full shapes as a ring-shaped wave rolls out across them, and bloom around the pointer\"></canvas></div>",
    "css": "/* Enrichr Library · https://enrichr.dev */\n.ef-rsw { position: relative; width: 100%; min-height: 24rem; overflow: hidden; border-radius: 1rem; background: #0c1e18; touch-action: pan-y; }\n.ef-rsw .ef-rsw__c { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }",
    "js": "// Enrichr Library · https://enrichr.dev\n// Rainbow shape wave: a grid of tiny coloured shapes (circles, pills and 4 to 10 point stars, some with a soft two-colour\n// gradient) that rest as specks. A ring-shaped wave rolls out from a point at a fixed speed; each shape swells to its own\n// random size as the ring passes (a sine bump across the ring's width) and eases back after it. Shapes near the pointer\n// bloom too, with a smoothstep falloff, and pick a new size, angle and star shape each time the pointer reaches them.\n// Growing and shrinking are exponential eases that cover 95% of the gap in the \"grow\" and \"shrink\" times. A click sends a\n// wave from that point; a wave also starts from the centre when the element first comes into view and, if set, on a timer.\n// Elements inside the root with a data-shape-mask attribute keep shapes from showing under them, except while a wave runs.\n// Reduced motion draws one still frame with the wave part way out and never animates. Pauses off screen and in hidden tabs.\n// mount(root, { gap (px between shapes), radius (pointer reach, % of the short side), speedIn (grow time, s),\n//               speedOut (shrink time, s), restScale (size at rest), minHover / maxHover (smallest / largest pop size),\n//               waveSpeed (px per s), waveWidth (px), auto (s between centre waves, 0 = off),\n//               palette (\"rainbow\" | \"enrichr\"), background })\nfunction mount(root, o) {\n  var reduce = window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches;\n  var wrap = root.querySelector(\".ef-rsw\");\n  var canvas = root.querySelector(\".ef-rsw__c\");\n  var ctx = canvas.getContext(\"2d\");\n  var PALETTES = {\n    rainbow: [\n      { type: \"solid\", value: \"#22c55e\" }, { type: \"solid\", value: \"#06b6d4\" }, { type: \"solid\", value: \"#f97316\" },\n      { type: \"solid\", value: \"#ef4444\" }, { type: \"solid\", value: \"#facc15\" }, { type: \"solid\", value: \"#ec4899\" },\n      { type: \"solid\", value: \"#9ca3af\" }, { type: \"solid\", value: \"#a78bfa\" }, { type: \"solid\", value: \"#60a5fa\" },\n      { type: \"solid\", value: \"#34d399\" },\n      { type: \"gradient\", stops: [\"#6366f1\", \"#3b82f6\"] }, { type: \"gradient\", stops: [\"#06b6d4\", \"#6366f1\"] },\n      { type: \"gradient\", stops: [\"#22c55e\", \"#06b6d4\"] }, { type: \"gradient\", stops: [\"#f97316\", \"#ef4444\"] },\n      { type: \"gradient\", stops: [\"#8b5cf6\", \"#06b6d4\"] }, { type: \"gradient\", stops: [\"#3b82f6\", \"#8b5cf6\"] },\n      { type: \"gradient\", stops: [\"#34d399\", \"#3b82f6\"] }\n    ],\n    enrichr: [\n      { type: \"solid\", value: \"#e6ff55\" }, { type: \"solid\", value: \"#d2eb3c\" }, { type: \"solid\", value: \"#fbf8f1\" },\n      { type: \"solid\", value: \"#1a7a4c\" }, { type: \"solid\", value: \"#126e45\" }, { type: \"solid\", value: \"#e54c1e\" },\n      { type: \"solid\", value: \"#e6ff55\" }, { type: \"solid\", value: \"#fbf8f1\" }, { type: \"solid\", value: \"#1a7a4c\" },\n      { type: \"solid\", value: \"#d2eb3c\" },\n      { type: \"gradient\", stops: [\"#e6ff55\", \"#1a7a4c\"] }, { type: \"gradient\", stops: [\"#fbf8f1\", \"#e6ff55\"] },\n      { type: \"gradient\", stops: [\"#1a7a4c\", \"#126e45\"] }, { type: \"gradient\", stops: [\"#e54c1e\", \"#e6ff55\"] },\n      { type: \"gradient\", stops: [\"#4b1a9a\", \"#e6ff55\"] }, { type: \"gradient\", stops: [\"#fbf8f1\", \"#1a7a4c\"] },\n      { type: \"gradient\", stops: [\"#d2eb3c\", \"#126e45\"] }\n    ]\n  };\n  var SHAPE_TYPES = [\"circle\", \"pill\", \"star\", \"star\"];\n  // visible waits for the first observer report, so the opening wave plays on screen\n  var opts = {}, raf = 0, visible = !(\"IntersectionObserver\" in window), io = null, ro = null, destroyed = false, last = 0;\n  var W = 1, H = 1, dpr = 1, shapes = [], size = 15.2, grads = [];\n  var pointer = null, activity = 0, waves = [], maskRects = [], frameCount = 0, maskUntil = 0;\n  var clock = 0, autoAcc = 0, started = false; // clock is in ms and only runs while the element is playing\n\n  function num(v, d) { v = Number(v); return isFinite(v) ? v : d; }\n  function rnd(min, max) { return Math.random() * (max - min) + min; }\n  function rndInt(min, max) { return Math.floor(rnd(min, max + 1)); }\n  function smoothstep(t) { var c = Math.max(0, Math.min(1, t)); return c * c * (3 - 2 * c); }\n  // the pen's per-frame ease (1 - 0.05^(1 / (60 s))), written for any frame length: 95% of the gap is covered in s seconds\n  function ease(seconds, dt) { return seconds <= 0 ? 1 : 1 - Math.pow(0.05, dt / seconds); }\n  function palette() { return PALETTES[opts.palette] || PALETTES.rainbow; }\n  function starProps(s) { s.points = rndInt(4, 10); s.innerRatio = rnd(0.1, 0.5); }\n\n  function drawShape(s) {\n    var r;\n    ctx.beginPath();\n    if (s.type === \"circle\") { ctx.arc(0, 0, s.size / 1.5, 0, Math.PI * 2); }\n    else if (s.type === \"pill\") {\n      var h = s.size / 1.4, w = h * 0.48;\n      if (ctx.roundRect) ctx.roundRect(-w, -h, w * 2, h * 2, w);\n      else { ctx.moveTo(-w, -h + w); ctx.arc(0, -h + w, w, Math.PI, 0); ctx.lineTo(w, h - w); ctx.arc(0, h - w, w, 0, Math.PI); ctx.closePath(); }\n    } else {\n      for (var i = 0; i < s.points * 2; i++) {\n        var a = i * Math.PI / s.points - Math.PI / 2;\n        r = i % 2 === 0 ? s.size : s.size * s.innerRatio;\n        if (i === 0) ctx.moveTo(Math.cos(a) * r, Math.sin(a) * r); else ctx.lineTo(Math.cos(a) * r, Math.sin(a) * r);\n      }\n      ctx.closePath();\n    }\n    ctx.fill();\n  }\n  // every shape has the same size, so each palette entry needs only one gradient object, made once and reused\n  function fill(ci) {\n    var c = palette()[ci];\n    if (c.type === \"solid\") return c.value;\n    if (!grads[ci]) {\n      var g = ctx.createRadialGradient(0, -size * 0.3, 0, 0, size * 0.3, size * 1.5);\n      g.addColorStop(0, c.stops[0]); g.addColorStop(1, c.stops[1]);\n      grads[ci] = g;\n    }\n    return grads[ci];\n  }\n\n  function build() {\n    var gap = Math.max(opts.gap, Math.sqrt(W * H / 6000)); // never more than about 6,000 shapes\n    var cols = Math.floor(W / gap), rows = Math.floor(H / gap);\n    var ox = (W - (cols - 1) * gap) / 2, oy = (H - (rows - 1) * gap) / 2, n = palette().length;\n    size = gap * 0.38; grads = []; shapes = [];\n    for (var r = 0; r < rows; r++) {\n      for (var c = 0; c < cols; c++) {\n        var type = SHAPE_TYPES[Math.floor(Math.random() * SHAPE_TYPES.length)];\n        var s = { x: ox + c * gap, y: oy + r * gap, type: type, ci: Math.floor(Math.random() * n), angle: rnd(0, Math.PI * 2),\n          size: size, scale: opts.restScale, maxScale: rnd(opts.minHover, opts.maxHover), hovered: false };\n        if (type === \"star\") starProps(s);\n        shapes.push(s);\n      }\n    }\n  }\n\n  function triggerWave(x, y) {\n    waves.push({ x: x === undefined ? W / 2 : x, y: y === undefined ? H / 2 : y, t: clock });\n    maskUntil = clock + Math.sqrt(W * W + H * H) / opts.waveSpeed * 1000; // masks open while the wave crosses\n  }\n\n  function draw(s) {\n    if (s.scale < opts.restScale * 0.15) return;\n    ctx.save();\n    ctx.translate(s.x, s.y); ctx.rotate(s.angle); ctx.scale(s.scale, s.scale);\n    ctx.fillStyle = fill(s.ci);\n    drawShape(s);\n    ctx.restore();\n  }\n  function clear() {\n    ctx.clearRect(0, 0, W, H);\n    ctx.fillStyle = opts.background; ctx.fillRect(0, 0, W, H);\n  }\n\n  function frame(dt) {\n    var radius = Math.min(W, H) * (opts.radius / 100), rest = opts.restScale;\n    clear();\n    activity *= Math.pow(0.93, dt * 60);\n    frameCount++;\n    if (frameCount % 10 === 0) {\n      var box = wrap.getBoundingClientRect(), els = wrap.querySelectorAll(\"[data-shape-mask]\");\n      maskRects = [];\n      for (var m = 0; m < els.length; m++) {\n        var b = els[m].getBoundingClientRect();\n        maskRects.push({ left: b.left - box.left, right: b.right - box.left, top: b.top - box.top, bottom: b.bottom - box.top });\n      }\n    }\n    var maxDist = Math.sqrt(W * W + H * H);\n    waves = waves.filter(function (w) { return (clock - w.t) / 1000 * opts.waveSpeed < maxDist + opts.waveWidth; });\n    var masking = clock >= maskUntil && maskRects.length, pad = opts.gap / 2, kIn = ease(opts.speedIn, dt), kOut = ease(opts.speedOut, dt);\n\n    for (var i = 0; i < shapes.length; i++) {\n      var s = shapes[i];\n      if (masking) {\n        var hidden = false;\n        for (var q = 0; q < maskRects.length; q++) {\n          var rc = maskRects[q];\n          if (s.x >= rc.left - pad && s.x <= rc.right + pad && s.y >= rc.top - pad && s.y <= rc.bottom + pad) { hidden = true; break; }\n        }\n        if (hidden) { s.scale += (0 - s.scale) * kOut; if (s.scale < 0.005) s.scale = 0; continue; }\n      }\n      var pin = 0;\n      if (pointer && activity > 0.001) {\n        var dx = s.x - pointer.x, dy = s.y - pointer.y;\n        pin = smoothstep(1 - Math.sqrt(dx * dx + dy * dy) / radius) * activity;\n        if (pin > 0.05 && !s.hovered) {\n          s.hovered = true; s.maxScale = rnd(opts.minHover, opts.maxHover); s.angle = rnd(0, Math.PI * 2);\n          if (s.type === \"star\") starProps(s);\n        } else if (pin <= 0.05) s.hovered = false;\n      } else s.hovered = false;\n\n      var win = 0;\n      for (var j = 0; j < waves.length; j++) {\n        var w = waves[j], wr = (clock - w.t) / 1000 * opts.waveSpeed;\n        var wdx = s.x - w.x, wdy = s.y - w.y;\n        var t = 1 - Math.abs(Math.sqrt(wdx * wdx + wdy * wdy) - wr) / opts.waveWidth;\n        if (t > 0) win = Math.max(win, Math.sin(Math.PI * t));\n      }\n      var target = Math.max(rest + pin * (s.maxScale - rest), rest + win * (s.maxScale - rest));\n      s.scale += (target - s.scale) * (target > s.scale ? kIn : kOut);\n      draw(s);\n    }\n  }\n\n  // reduced motion: one still frame with a wave ring 40% of the way across, every shape at its target size\n  function still() {\n    var cx = W / 2, cy = H / 2, wr = Math.sqrt(W * W + H * H) * 0.4, rest = opts.restScale;\n    clear();\n    for (var i = 0; i < shapes.length; i++) {\n      var s = shapes[i], d = Math.sqrt((s.x - cx) * (s.x - cx) + (s.y - cy) * (s.y - cy));\n      var t = 1 - Math.abs(d - wr) / opts.waveWidth, win = t > 0 ? Math.sin(Math.PI * t) : 0;\n      s.scale = rest + win * (s.maxScale - rest);\n      draw(s);\n    }\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    if (!started) { started = true; triggerWave(); }\n    clock += dt * 1000;\n    if (opts.auto > 0) { autoAcc += dt; if (autoAcc >= opts.auto) { autoAcc = 0; triggerWave(); } }\n    frame(dt);\n  }\n  function resize() {\n    dpr = Math.min(window.devicePixelRatio || 1, 2);\n    var nw = Math.max(1, wrap.clientWidth), nh = Math.max(1, wrap.clientHeight);\n    canvas.width = Math.round(nw * dpr); canvas.height = Math.round(nh * dpr);\n    ctx.setTransform(dpr, 0, 0, dpr, 0, 0);\n    grads = [];\n    if (nw !== W || nh !== H || !shapes.length) { W = nw; H = nh; build(); }\n    if (reduce) still(); else frame(0);\n  }\n\n  function update(partial) {\n    var prev = opts;\n    opts = Object.assign({ gap: 40, radius: 30, speedIn: 0.5, speedOut: 0.6, restScale: 0.09, minHover: 1, maxHover: 3,\n      waveSpeed: 1200, waveWidth: 180, auto: 5, palette: \"rainbow\", background: \"#0c1e18\" }, opts, partial || {});\n    opts.gap = Math.max(12, num(opts.gap, 40)); opts.radius = Math.max(1, num(opts.radius, 30));\n    opts.speedIn = Math.max(0, num(opts.speedIn, 0.5)); opts.speedOut = Math.max(0, num(opts.speedOut, 0.6));\n    opts.restScale = Math.max(0, num(opts.restScale, 0.09)); opts.minHover = Math.max(0, num(opts.minHover, 1));\n    opts.maxHover = Math.max(0, num(opts.maxHover, 3)); opts.waveSpeed = Math.max(20, num(opts.waveSpeed, 1200));\n    opts.waveWidth = Math.max(1, num(opts.waveWidth, 180)); opts.auto = Math.max(0, num(opts.auto, 5));\n    if (!PALETTES[opts.palette]) opts.palette = \"rainbow\";\n    wrap.style.background = opts.background;\n    if (destroyed || !shapes.length) return;\n    if (opts.gap !== prev.gap) build();\n    else {\n      if (opts.palette !== prev.palette) { grads = []; var n = palette().length; shapes.forEach(function (s) { s.ci = Math.floor(Math.random() * n); }); }\n      if (opts.minHover !== prev.minHover || opts.maxHover !== prev.maxHover) shapes.forEach(function (s) { s.maxScale = rnd(opts.minHover, opts.maxHover); });\n    }\n    if (reduce) still(); else frame(0);\n  }\n\n  function local(e) { var b = wrap.getBoundingClientRect(); return { x: e.clientX - b.left, y: e.clientY - b.top }; }\n  function onMove(e) { pointer = local(e); activity = 1; }\n  function onClick(e) { var p = local(e); triggerWave(p.x, p.y); }\n\n  update(o);\n  resize();\n  if (!reduce) {\n    wrap.addEventListener(\"pointermove\", onMove);\n    wrap.addEventListener(\"click\", onClick);\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  if (\"ResizeObserver\" in window) { ro = new ResizeObserver(function () { if (!destroyed) resize(); }); ro.observe(wrap); }\n  return {\n    update: update,\n    destroy: function () {\n      destroyed = true; cancelAnimationFrame(raf);\n      wrap.removeEventListener(\"pointermove\", onMove);\n      wrap.removeEventListener(\"click\", onClick);\n      if (io) io.disconnect();\n      if (ro) ro.disconnect();\n      shapes = []; waves = []; grads = [];\n    }\n  };\n}"
  }
}