{
  "id": "particles-cursor",
  "kind": "element",
  "title": "Glowing particles from the cursor",
  "summary": "A canvas 2D particle system that emits glowing particles from the pointer with velocity, gravity and fade, for mouse, pen and touch, and pauses when off-screen.",
  "url": "https://enrichr.dev/elements/particles-cursor.html",
  "section": "background",
  "techniques": [
    "pointer-interaction"
  ],
  "stack": [
    "Vanilla JS",
    "CSS",
    "Canvas 2D"
  ],
  "frameworks": [
    "React",
    "Next.js",
    "Vanilla"
  ],
  "mood": [
    "energetic",
    "immersive",
    "playful"
  ],
  "intents": [
    "cursor particle trail",
    "canvas particles follow mouse",
    "glowing sparkle cursor effect",
    "pointer particle emitter",
    "touch particle trail canvas"
  ],
  "status": "tested",
  "params": [
    {
      "key": "color",
      "label": "Particle colour",
      "type": "color",
      "value": "#e6ff55"
    },
    {
      "key": "rate",
      "label": "Particles per move",
      "type": "range",
      "min": 1,
      "max": 12,
      "step": 1,
      "value": 4
    },
    {
      "key": "gravity",
      "label": "Gravity",
      "type": "range",
      "min": -0.2,
      "max": 0.6,
      "step": 0.02,
      "value": 0.15
    },
    {
      "key": "size",
      "label": "Size (px)",
      "type": "range",
      "min": 1,
      "max": 12,
      "step": 1,
      "value": 5
    },
    {
      "key": "life",
      "label": "Lifetime (s)",
      "type": "range",
      "min": 0.4,
      "max": 3,
      "step": 0.1,
      "value": 1.4
    }
  ],
  "license": "Free to use in personal and client projects during the preview. Final licence terms will be published here before any paid tier starts; ask before reselling the code as a collection.",
  "contract": "function mount(root, opts) -> { update(partialOpts), destroy() }; root must contain the element markup",
  "exports": {
    "claude": "Add the \"Glowing particles from the cursor\" element to this project.\n\nThis is the \"Glowing particles from the cursor\" element from the Enrichr Library: A canvas 2D particle system that emits glowing particles from the pointer with velocity, gravity and fade, for mouse, pen and touch, and pauses when off-screen.\nPage: https://enrichr.dev/elements/particles-cursor.html\nMachine-readable spec: https://enrichr.dev/elements/particles-cursor.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/particles-cursor.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 \"Glowing particles from the cursor\" 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 \"Glowing particles from the cursor\" element from the Enrichr Library: A canvas 2D particle system that emits glowing particles from the pointer with velocity, gravity and fade, for mouse, pen and touch, and pauses when off-screen.\nPage: https://enrichr.dev/elements/particles-cursor.html\nMachine-readable spec: https://enrichr.dev/elements/particles-cursor.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 \"Glowing particles from the cursor\" element to this codebase.\n\nThis is the \"Glowing particles from the cursor\" element from the Enrichr Library: A canvas 2D particle system that emits glowing particles from the pointer with velocity, gravity and fade, for mouse, pen and touch, and pauses when off-screen.\nPage: https://enrichr.dev/elements/particles-cursor.html\nMachine-readable spec: https://enrichr.dev/elements/particles-cursor.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-particles-cursor.mdc so the rule stays with the project:\n---\ndescription: How to use the Enrichr Glowing particles from the cursor 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 \"Glowing particles from the cursor\" element. Tailwind is available but this component needs no utility classes.\n\nThis is the \"Glowing particles from the cursor\" element from the Enrichr Library: A canvas 2D particle system that emits glowing particles from the pointer with velocity, gravity and fade, for mouse, pen and touch, and pauses when off-screen.\nPage: https://enrichr.dev/elements/particles-cursor.html\nMachine-readable spec: https://enrichr.dev/elements/particles-cursor.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- particles-cursor.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 \"./particles-cursor\"; // markup is the HTML string; mount is the JavaScript's mount function\n\nexport default function ParticlesCursor(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 \"Glowing particles from the cursor\" element to this React + Vite + TypeScript + Tailwind project. Do not install any packages.\n\nThis is the \"Glowing particles from the cursor\" element from the Enrichr Library: A canvas 2D particle system that emits glowing particles from the pointer with velocity, gravity and fade, for mouse, pen and touch, and pauses when off-screen.\nPage: https://enrichr.dev/elements/particles-cursor.html\nMachine-readable spec: https://enrichr.dev/elements/particles-cursor.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- particles-cursor.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/ParticlesCursor.tsx):\n```tsx\n\"use client\";\nimport { useEffect, useRef } from \"react\";\nimport { markup, mount } from \"./particles-cursor\"; // markup is the HTML string; mount is the JavaScript's mount function\n\nexport default function ParticlesCursor(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 \"Glowing particles from the cursor\" element.\n\nThis is the \"Glowing particles from the cursor\" element from the Enrichr Library: A canvas 2D particle system that emits glowing particles from the pointer with velocity, gravity and fade, for mouse, pen and touch, and pauses when off-screen.\nPage: https://enrichr.dev/elements/particles-cursor.html\nMachine-readable spec: https://enrichr.dev/elements/particles-cursor.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), particles-cursor.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 \"Glowing particles from the cursor\" element. No packages, no server code.\n\nThis is the \"Glowing particles from the cursor\" element from the Enrichr Library: A canvas 2D particle system that emits glowing particles from the pointer with velocity, gravity and fade, for mouse, pen and touch, and pauses when off-screen.\nPage: https://enrichr.dev/elements/particles-cursor.html\nMachine-readable spec: https://enrichr.dev/elements/particles-cursor.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 particles-cursor.js and then main.js), style.css (the CSS below), particles-cursor.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 \"Glowing particles from the cursor\" 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 \"Glowing particles from the cursor\" element from the Enrichr Library: A canvas 2D particle system that emits glowing particles from the pointer with velocity, gravity and fade, for mouse, pen and touch, and pauses when off-screen.\nPage: https://enrichr.dev/elements/particles-cursor.html\nMachine-readable spec: https://enrichr.dev/elements/particles-cursor.json\n\nWhat it does: Pointer events on the box are converted to canvas coordinates. For each move the script walks the segment from the last position in small steps so fast strokes stay continuous, and spawns a few particles at each step. A particle carries position, velocity, remaining life and radius; velocity starts as a random burst plus a quarter of the pointer's own velocity. Each frame applies gravity and drag with the frame delta, ages the particle, and draws it as a radial gradient whose size and alpha shrink with the life left. Drawing uses the lighter composite mode so overlapping particles add up to a glow. The canvas is sized by device pixel ratio, capped at 2.\nAccessibility: The box is focusable and labelled, and the arrow keys move a virtual emitter so the effect is not mouse-only. The canvas is decorative and hidden from assistive technology. With reduced motion, particles do not travel: they appear faint, fewer and short-lived at the pointer. The canvas uses touch-action pan-y, so vertical scrolling still works on touch screens. Do not put essential content on top of the canvas.\n\nTunable settings:\n- Particle colour: color, default #e6ff55\n- Particles per move: range 1 to 12, step 1, default 4\n- Gravity: range -0.2 to 0.6, step 0.02, default 0.15\n- Size (px): range 1 to 12, step 1, default 5\n- Lifetime (s): range 0.4 to 3, step 0.1, default 1.4\n\nCurrent settings:\n{{SETTINGS}}\n\nFor the developer: Element contract (vanilla JavaScript, no dependencies):\n- The JavaScript defines a function mount(root, opts).\n- root is an empty container element. Set root.innerHTML to the markup first, then call mount(root, opts).\n- It returns an object with update(partialOpts) and destroy(). Call destroy() when the element is removed. Some elements also return replay().\n- The CSS classes all start with \"ef-\" so they will not collide with your styles.\n\nIn Figma:\n- Draw the resting state as a frame and the end state as a second frame; link them with Smart Animate to show the motion in a prototype.\n- Put the settings above in the frame's notes or Dev Mode annotations so the developer matches them.\n- Link https://enrichr.dev/elements/particles-cursor.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 \"Glowing particles from the cursor\" 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 \"Glowing particles from the cursor\" element from the Enrichr Library: A canvas 2D particle system that emits glowing particles from the pointer with velocity, gravity and fade, for mouse, pen and touch, and pauses when off-screen.\nPage: https://enrichr.dev/elements/particles-cursor.html\nMachine-readable spec: https://enrichr.dev/elements/particles-cursor.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 ParticlesCursor.\n2. Paste the JavaScript below into a separate code file named particles-cursor.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 \"./particles-cursor\"; // markup is the HTML string; mount is the JavaScript's mount function\n\nexport default function ParticlesCursor(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(ParticlesCursor, {\n  color: { type: ControlType.Color, title: \"Particle colour\", defaultValue: \"#e6ff55\" },\n  rate: { type: ControlType.Number, title: \"Particles per move\", min: 1, max: 12, step: 1, defaultValue: 4 },\n  gravity: { type: ControlType.Number, title: \"Gravity\", min: -0.2, max: 0.6, step: 0.02, defaultValue: 0.15 },\n  size: { type: ControlType.Number, title: \"Size\", min: 1, max: 12, step: 1, defaultValue: 5 },\n  life: { type: ControlType.Number, title: \"Lifetime\", min: 0.4, max: 3, step: 0.1, defaultValue: 1.4 },\n})\n```\n4. Keep the behaviour of the source unchanged. Do not add dependencies. Respect prefers-reduced-motion. Keep text as real HTML.\n\nSettings:\n{{SETTINGS}}\n\nSource:\n{{CODE}}",
    "webflow": "Add the \"Glowing particles from the cursor\" 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 \"Glowing particles from the cursor\" element from the Enrichr Library: A canvas 2D particle system that emits glowing particles from the pointer with velocity, gravity and fade, for mouse, pen and touch, and pauses when off-screen.\nPage: https://enrichr.dev/elements/particles-cursor.html\nMachine-readable spec: https://enrichr.dev/elements/particles-cursor.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-particles-cursor\"></div>, and a <script> block with the JavaScript followed by:\n   mount(document.getElementById(\"enrichr-particles-cursor\"), { ...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 box is focusable and labelled, and the arrow keys move a virtual emitter so the effect is not mouse-only. The canvas is decorative and hidden from assistive technology. With reduced motion, particles do not travel: they appear faint, fewer and short-lived at the pointer. The canvas uses touch-action pan-y, so vertical scrolling still works on touch screens. Do not put essential content on top of the canvas.",
  "performance": "The loop only runs while particles exist, the element is in view (IntersectionObserver) and the tab is visible, and it cancels its requestAnimationFrame otherwise. The particle count is capped at 700 and the canvas resolution at 2x. Per-particle radial gradients are fine at this scale; for thousands of particles, pre-render one sprite and use drawImage.",
  "dependencies": [],
  "source": {
    "markup": "<div class=\"ef-pcu\">\n  <div class=\"ef-pcu__wrap\" tabindex=\"0\" role=\"group\" aria-label=\"Particle playground. Move the pointer or use the arrow keys to emit particles.\">\n    <canvas class=\"ef-pcu__cv\" aria-hidden=\"true\"></canvas>\n    <span class=\"ef-pcu__hint\" aria-hidden=\"true\">Move your pointer</span>\n  </div>\n</div>",
    "css": "/* Enrichr Library · https://enrichr.dev */\n.ef-pcu { width: 100%; }\n.ef-pcu__wrap { --ef-acc: #e6ff55; position: relative; box-sizing: border-box; width: 100%; height: 20rem; max-height: 100%; overflow: hidden; border-radius: 1rem; background: #0c1e18; touch-action: pan-y; cursor: crosshair; outline: none; font-family: system-ui, -apple-system, \"Segoe UI\", Roboto, sans-serif; }\n.ef-pcu__wrap:focus-visible { box-shadow: inset 0 0 0 2px var(--ef-acc); }\n.ef-pcu__cv { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }\n.ef-pcu__hint { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); color: #fbf8f1; font-size: 0.72rem; letter-spacing: 0.18em; text-transform: uppercase; opacity: 0.55; pointer-events: none; transition: opacity 400ms; }\n.ef-pcu__wrap.is-used .ef-pcu__hint { opacity: 0; }",
    "js": "// Enrichr Library · https://enrichr.dev\n// Particles cursor: a canvas 2D particle system. Moving the pointer (mouse, pen or touch) emits glowing particles along the path,\n// each with its own velocity (inherits some pointer speed), gravity, drag and a fade over its lifetime. Drawn additively for the glow.\n// The loop only runs while particles are alive and the element is on screen (IntersectionObserver) and the tab is visible.\n// Keyboard: focus the box and use the arrow keys to move a virtual emitter. Reduced motion: short-lived, still, faint particles.\n// mount(root, { background, color, rate (1-12 per move), gravity (-0.2-0.6), size (1-12 px), life (0.4-3 s) })\nfunction mount(root, o) {\n  var reduce = window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches;\n  var wrap = root.querySelector(\".ef-pcu__wrap\");\n  var cv = root.querySelector(\".ef-pcu__cv\");\n  var ctx = cv.getContext(\"2d\");\n  var opts = {}, parts = [], W = 0, H = 0, dpr = 1, raf = 0, last = 0, visible = true, inView = true;\n  var px = -1, py = -1, kx = 0, ky = 0, kvx = 0, kvy = 0, rgb = [230, 255, 85];\n  var MAX = 700;\n\n  function hex(c) {\n    var m = /^#?([0-9a-f]{6})$/i.exec(c || \"\");\n    if (!m) return [230, 255, 85];\n    var n = parseInt(m[1], 16);\n    return [(n >> 16) & 255, (n >> 8) & 255, n & 255];\n  }\n  function size() {\n    var r = wrap.getBoundingClientRect();\n    W = Math.max(1, r.width); H = Math.max(1, r.height);\n    dpr = Math.min(window.devicePixelRatio || 1, 2);\n    cv.width = Math.round(W * dpr); cv.height = Math.round(H * dpr);\n    ctx.setTransform(dpr, 0, 0, dpr, 0, 0);\n  }\n  function emit(x, y, vx, vy, n) {\n    var k = reduce ? 0.3 : 1;\n    n = Math.max(1, Math.round(n * k));\n    for (var i = 0; i < n && parts.length < MAX; i++) {\n      var a = Math.random() * Math.PI * 2, s = (reduce ? 8 : 30 + Math.random() * 90);\n      var life = opts.life * (0.6 + Math.random() * 0.6) * (reduce ? 0.5 : 1);\n      parts.push({\n        x: x, y: y,\n        vx: reduce ? 0 : vx * 0.25 + Math.cos(a) * s,\n        vy: reduce ? 0 : vy * 0.25 + Math.sin(a) * s - 20,\n        life: life, max: life,\n        r: opts.size * (0.5 + Math.random() * 0.8)\n      });\n    }\n    start();\n  }\n  function frame(t) {\n    raf = 0;\n    var dt = Math.min(0.05, (t - last) / 1000 || 0.016);\n    last = t;\n    // keyboard emitter\n    if (kvx || kvy) {\n      kx = Math.max(0, Math.min(W, kx + kvx * 220 * dt));\n      ky = Math.max(0, Math.min(H, ky + kvy * 220 * dt));\n      emit(kx, ky, kvx * 120, kvy * 120, Math.ceil(opts.rate / 3));\n    }\n    ctx.globalCompositeOperation = \"source-over\";\n    ctx.clearRect(0, 0, W, H);\n    ctx.globalCompositeOperation = \"lighter\";\n    var g = opts.gravity * 600, drag = Math.pow(0.35, dt);\n    for (var i = parts.length - 1; i >= 0; i--) {\n      var p = parts[i];\n      p.life -= dt;\n      if (p.life <= 0) { parts.splice(i, 1); continue; }\n      if (!reduce) {\n        p.vy += g * dt; p.vx *= drag; p.vy *= drag;\n        p.x += p.vx * dt; p.y += p.vy * dt;\n      }\n      var k = p.life / p.max, rad = p.r * (0.4 + 0.6 * k) * 3;\n      var al = (reduce ? 0.35 : 0.85) * k;\n      var gr = ctx.createRadialGradient(p.x, p.y, 0, p.x, p.y, rad);\n      gr.addColorStop(0, \"rgba(\" + rgb[0] + \",\" + rgb[1] + \",\" + rgb[2] + \",\" + al.toFixed(3) + \")\");\n      gr.addColorStop(1, \"rgba(\" + rgb[0] + \",\" + rgb[1] + \",\" + rgb[2] + \",0)\");\n      ctx.fillStyle = gr;\n      ctx.fillRect(p.x - rad, p.y - rad, rad * 2, rad * 2);\n    }\n    if (parts.length || kvx || kvy) start();\n  }\n  function start() {\n    if (!raf && inView && visible) { last = performance.now(); raf = requestAnimationFrame(frame); }\n  }\n  function stop() { if (raf) { cancelAnimationFrame(raf); raf = 0; } }\n\n  function pos(e) {\n    var r = wrap.getBoundingClientRect();\n    return [e.clientX - r.left, e.clientY - r.top];\n  }\n  function onMove(e) {\n    var p = pos(e);\n    wrap.classList.add(\"is-used\");\n    if (px >= 0) {\n      var dx = p[0] - px, dy = p[1] - py, d = Math.sqrt(dx * dx + dy * dy);\n      var steps = Math.max(1, Math.min(6, Math.floor(d / 14)));\n      for (var i = 1; i <= steps; i++) emit(px + dx * i / steps, py + dy * i / steps, dx * 40, dy * 40, Math.ceil(opts.rate / steps));\n    } else emit(p[0], p[1], 0, 0, opts.rate);\n    px = p[0]; py = p[1];\n  }\n  function onDown(e) { var p = pos(e); wrap.classList.add(\"is-used\"); emit(p[0], p[1], 0, 0, opts.rate * 5); px = p[0]; py = p[1]; }\n  function onLeave() { px = -1; py = -1; }\n  function onKey(e) {\n    var v = { ArrowLeft: [-1, 0], ArrowRight: [1, 0], ArrowUp: [0, -1], ArrowDown: [0, 1] }[e.key];\n    if (!v) return;\n    e.preventDefault();\n    wrap.classList.add(\"is-used\");\n    if (!kx && !ky) { kx = W / 2; ky = H / 2; }\n    kvx = v[0]; kvy = v[1];\n    start();\n  }\n  function onKeyUp(e) { if (e.key.indexOf(\"Arrow\") === 0) { kvx = 0; kvy = 0; } }\n  function onBlur() { kvx = 0; kvy = 0; }\n  function onVis() { visible = !document.hidden; if (visible) start(); else stop(); }\n\n  var io = null;\n  if (typeof IntersectionObserver !== \"undefined\") {\n    io = new IntersectionObserver(function (en) {\n      inView = en[0].isIntersecting;\n      if (inView) start(); else stop();\n    });\n    io.observe(wrap);\n  }\n  var ro = null;\n  if (typeof ResizeObserver !== \"undefined\") { ro = new ResizeObserver(size); ro.observe(wrap); }\n  else window.addEventListener(\"resize\", size);\n\n  wrap.addEventListener(\"pointermove\", onMove);\n  wrap.addEventListener(\"pointerdown\", onDown);\n  wrap.addEventListener(\"pointerleave\", onLeave);\n  wrap.addEventListener(\"keydown\", onKey);\n  wrap.addEventListener(\"keyup\", onKeyUp);\n  wrap.addEventListener(\"blur\", onBlur);\n  document.addEventListener(\"visibilitychange\", onVis);\n\n  function update(next) {\n    opts = Object.assign({ background: \"#0c1e18\", color: \"#e6ff55\", rate: 4, gravity: 0.15, size: 5, life: 1.4 }, opts, next || {});\n    wrap.style.background = opts.background;\n    wrap.style.setProperty(\"--ef-acc\", opts.color);\n    rgb = hex(opts.color);\n  }\n  update(o);\n  size();\n\n  return {\n    update: update,\n    destroy: function () {\n      stop();\n      if (io) io.disconnect();\n      if (ro) ro.disconnect(); else window.removeEventListener(\"resize\", size);\n      wrap.removeEventListener(\"pointermove\", onMove);\n      wrap.removeEventListener(\"pointerdown\", onDown);\n      wrap.removeEventListener(\"pointerleave\", onLeave);\n      wrap.removeEventListener(\"keydown\", onKey);\n      wrap.removeEventListener(\"keyup\", onKeyUp);\n      wrap.removeEventListener(\"blur\", onBlur);\n      document.removeEventListener(\"visibilitychange\", onVis);\n      parts.length = 0;\n      ctx.clearRect(0, 0, W, H);\n    }\n  };\n}"
  }
}