{
  "id": "character-text-variants",
  "kind": "element",
  "title": "Character text variants",
  "summary": "One line of text played back by six character-level effects you pick with buttons: scramble cursor, find all, speed reader, multi-cursor, live captions and voice note.",
  "url": "https://enrichr.dev/elements/character-text-variants.html",
  "section": "text",
  "techniques": [
    "text-animation",
    "stagger"
  ],
  "stack": [
    "Vanilla JS",
    "CSS"
  ],
  "frameworks": [
    "React",
    "Next.js",
    "Vanilla"
  ],
  "mood": [
    "kinetic",
    "technical",
    "playful"
  ],
  "intents": [
    "typing text animation variants",
    "character by character text reveal",
    "cursor types text with random glyphs",
    "speed reading word flash effect",
    "live captions text animation",
    "text animation without gsap splittext"
  ],
  "status": "tested",
  "params": [
    {
      "key": "variant",
      "label": "Variant",
      "type": "select",
      "options": [
        [
          "scramble",
          "Scramble cursor"
        ],
        [
          "find",
          "Find all"
        ],
        [
          "reader",
          "Speed reader"
        ],
        [
          "multi",
          "Multi-cursor"
        ],
        [
          "captions",
          "Live captions"
        ],
        [
          "voice",
          "Voice note"
        ]
      ],
      "value": "scramble"
    },
    {
      "key": "speed",
      "label": "Speed",
      "type": "range",
      "min": 0.3,
      "max": 3,
      "step": 0.1,
      "value": 1
    },
    {
      "key": "size",
      "label": "Max text size (px)",
      "type": "range",
      "min": 14,
      "max": 80,
      "step": 2,
      "value": 44
    },
    {
      "key": "loop",
      "label": "Replay after (s, 0 = off)",
      "type": "range",
      "min": 0,
      "max": 10,
      "step": 0.5,
      "value": 3
    },
    {
      "key": "text",
      "label": "Text (use / for new lines)",
      "type": "text",
      "value": "Enrichr turns any site / into a library of effects / you can use today."
    },
    {
      "key": "accent",
      "label": "Accent colour",
      "type": "color",
      "value": "#e6ff55"
    }
  ],
  "license": "Free to use in personal and client projects during the preview. Final licence terms will be published here before any paid tier starts; ask before reselling the code as a collection.",
  "contract": "function mount(root, opts) -> { update(partialOpts), destroy() }; root must contain the element markup",
  "exports": {
    "claude": "Add the \"Character text variants\" element to this project.\n\nThis is the \"Character text variants\" element from the Enrichr Library: One line of text played back by six character-level effects you pick with buttons: scramble cursor, find all, speed reader, multi-cursor, live captions and voice note.\nPage: https://enrichr.dev/elements/character-text-variants.html\nMachine-readable spec: https://enrichr.dev/elements/character-text-variants.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/character-text-variants.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 \"Character text variants\" 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 \"Character text variants\" element from the Enrichr Library: One line of text played back by six character-level effects you pick with buttons: scramble cursor, find all, speed reader, multi-cursor, live captions and voice note.\nPage: https://enrichr.dev/elements/character-text-variants.html\nMachine-readable spec: https://enrichr.dev/elements/character-text-variants.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 \"Character text variants\" element to this codebase.\n\nThis is the \"Character text variants\" element from the Enrichr Library: One line of text played back by six character-level effects you pick with buttons: scramble cursor, find all, speed reader, multi-cursor, live captions and voice note.\nPage: https://enrichr.dev/elements/character-text-variants.html\nMachine-readable spec: https://enrichr.dev/elements/character-text-variants.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-character-text-variants.mdc so the rule stays with the project:\n---\ndescription: How to use the Enrichr Character text variants 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 \"Character text variants\" element. Tailwind is available but this component needs no utility classes.\n\nThis is the \"Character text variants\" element from the Enrichr Library: One line of text played back by six character-level effects you pick with buttons: scramble cursor, find all, speed reader, multi-cursor, live captions and voice note.\nPage: https://enrichr.dev/elements/character-text-variants.html\nMachine-readable spec: https://enrichr.dev/elements/character-text-variants.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- character-text-variants.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 \"./character-text-variants\"; // markup is the HTML string; mount is the JavaScript's mount function\n\nexport default function CharacterTextVariants(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 \"Character text variants\" element to this React + Vite + TypeScript + Tailwind project. Do not install any packages.\n\nThis is the \"Character text variants\" element from the Enrichr Library: One line of text played back by six character-level effects you pick with buttons: scramble cursor, find all, speed reader, multi-cursor, live captions and voice note.\nPage: https://enrichr.dev/elements/character-text-variants.html\nMachine-readable spec: https://enrichr.dev/elements/character-text-variants.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- character-text-variants.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/CharacterTextVariants.tsx):\n```tsx\n\"use client\";\nimport { useEffect, useRef } from \"react\";\nimport { markup, mount } from \"./character-text-variants\"; // markup is the HTML string; mount is the JavaScript's mount function\n\nexport default function CharacterTextVariants(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 \"Character text variants\" element.\n\nThis is the \"Character text variants\" element from the Enrichr Library: One line of text played back by six character-level effects you pick with buttons: scramble cursor, find all, speed reader, multi-cursor, live captions and voice note.\nPage: https://enrichr.dev/elements/character-text-variants.html\nMachine-readable spec: https://enrichr.dev/elements/character-text-variants.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), character-text-variants.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 \"Character text variants\" element. No packages, no server code.\n\nThis is the \"Character text variants\" element from the Enrichr Library: One line of text played back by six character-level effects you pick with buttons: scramble cursor, find all, speed reader, multi-cursor, live captions and voice note.\nPage: https://enrichr.dev/elements/character-text-variants.html\nMachine-readable spec: https://enrichr.dev/elements/character-text-variants.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 character-text-variants.js and then main.js), style.css (the CSS below), character-text-variants.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 \"Character text variants\" 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 \"Character text variants\" element from the Enrichr Library: One line of text played back by six character-level effects you pick with buttons: scramble cursor, find all, speed reader, multi-cursor, live captions and voice note.\nPage: https://enrichr.dev/elements/character-text-variants.html\nMachine-readable spec: https://enrichr.dev/elements/character-text-variants.json\n\nWhat it does: This is a vanilla port of six of the character animations in the Codrops demo, with no GSAP and no SplitText. The text is split into lines, word spans and character spans in a few lines of JavaScript, the font is sized to fit the box, and each character's position is measured once. Each variant is then a pure function of time that writes opacity, transform or a CSS variable for each character, and one requestAnimationFrame loop plays it. Because a variant only depends on the time, replaying, changing speed or switching variant needs no timeline bookkeeping.\nAccessibility: The animated characters are hidden from assistive technology and a visually hidden paragraph carries the plain text, so a screen reader reads one sentence. The variant buttons are real buttons with aria-pressed and a visible focus ring, and Replay is a button too. With reduced motion the finished text is shown at once and Replay is disabled. The loop can be turned off with the replay control set to 0.\n\nTunable settings:\n- Variant: select (Scramble cursor / Find all / Speed reader / Multi-cursor / Live captions / Voice note), default scramble\n- Speed: range 0.3 to 3, step 0.1, default 1\n- Max text size (px): range 14 to 80, step 2, default 44\n- Replay after (s, 0 = off): range 0 to 10, step 0.5, default 3\n- Text (use / for new lines): text, default Enrichr turns any site / into a library of effects / you can use today.\n- Accent colour: color, default #e6ff55\n\nCurrent settings:\n{{SETTINGS}}\n\nFor the developer: Element contract (vanilla JavaScript, no dependencies):\n- The JavaScript defines a function mount(root, opts).\n- root is an empty container element. Set root.innerHTML to the markup first, then call mount(root, opts).\n- It returns an object with update(partialOpts) and destroy(). Call destroy() when the element is removed. Some elements also return replay().\n- The CSS classes all start with \"ef-\" so they will not collide with your styles.\n\nIn Figma:\n- Draw the resting state as a frame and the end state as a second frame; link them with Smart Animate to show the motion in a prototype.\n- Put the settings above in the frame's notes or Dev Mode annotations so the developer matches them.\n- Link https://enrichr.dev/elements/character-text-variants.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 \"Character text variants\" 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 \"Character text variants\" element from the Enrichr Library: One line of text played back by six character-level effects you pick with buttons: scramble cursor, find all, speed reader, multi-cursor, live captions and voice note.\nPage: https://enrichr.dev/elements/character-text-variants.html\nMachine-readable spec: https://enrichr.dev/elements/character-text-variants.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 CharacterTextVariants.\n2. Paste the JavaScript below into a separate code file named character-text-variants.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 \"./character-text-variants\"; // markup is the HTML string; mount is the JavaScript's mount function\n\nexport default function CharacterTextVariants(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(CharacterTextVariants, {\n  variant: { type: ControlType.Enum, title: \"Variant\", options: [\"scramble\",\"find\",\"reader\",\"multi\",\"captions\",\"voice\"], optionTitles: [\"Scramble cursor\",\"Find all\",\"Speed reader\",\"Multi-cursor\",\"Live captions\",\"Voice note\"], defaultValue: \"scramble\" },\n  speed: { type: ControlType.Number, title: \"Speed\", min: 0.3, max: 3, step: 0.1, defaultValue: 1 },\n  size: { type: ControlType.Number, title: \"Max text size\", min: 14, max: 80, step: 2, defaultValue: 44 },\n  loop: { type: ControlType.Number, title: \"Replay after\", min: 0, max: 10, step: 0.5, defaultValue: 3 },\n  text: { type: ControlType.String, title: \"Text (use / for new lines)\", defaultValue: \"Enrichr turns any site / into a library of effects / you can use today.\" },\n  accent: { type: ControlType.Color, title: \"Accent colour\", defaultValue: \"#e6ff55\" },\n})\n```\n4. Keep the behaviour of the source unchanged. Do not add dependencies. Respect prefers-reduced-motion. Keep text as real HTML.\n\nSettings:\n{{SETTINGS}}\n\nSource:\n{{CODE}}",
    "webflow": "Add the \"Character text variants\" 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 \"Character text variants\" element from the Enrichr Library: One line of text played back by six character-level effects you pick with buttons: scramble cursor, find all, speed reader, multi-cursor, live captions and voice note.\nPage: https://enrichr.dev/elements/character-text-variants.html\nMachine-readable spec: https://enrichr.dev/elements/character-text-variants.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-character-text-variants\"></div>, and a <script> block with the JavaScript followed by:\n   mount(document.getElementById(\"enrichr-character-text-variants\"), { ...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 animated characters are hidden from assistive technology and a visually hidden paragraph carries the plain text, so a screen reader reads one sentence. The variant buttons are real buttons with aria-pressed and a visible focus ring, and Replay is a button too. With reduced motion the finished text is shown at once and Replay is disabled. The loop can be turned off with the replay control set to 0.",
  "performance": "One rAF loop writes a few style properties on roughly a hundred small spans and stops when the effect ends, until the next replay timer. Layout is measured only when the text, size, variant or box width changes, never per frame.",
  "dependencies": [],
  "source": {
    "markup": "<div class=\"ef-ctv\">\n  <div class=\"ef-ctv__wrap\">\n    <div class=\"ef-ctv__top\">\n      <div class=\"ef-ctv__vars\" role=\"group\" aria-label=\"Character animation variant\"></div>\n      <button class=\"ef-ctv__replay\" type=\"button\">Replay</button>\n    </div>\n    <div class=\"ef-ctv__stage\">\n      <p class=\"ef-ctv__sr\"></p>\n      <div class=\"ef-ctv__text\" aria-hidden=\"true\"><div class=\"ef-ctv__roll\"></div></div>\n    </div>\n  </div>\n</div>",
    "css": "/* Enrichr Library · https://enrichr.dev */\n/* Adapted from https://github.com/codrops/TextCharacterAnimations (MIT) — Copyright (c) 2009 - 2026 [Codrops](https://codrops.com) */\n.ef-ctv { width: 100%; }\n.ef-ctv__wrap { --ef-acc: #e6ff55; box-sizing: border-box; width: 100%; min-height: 18rem; padding: 1rem 1.1rem 1.2rem; border-radius: 1rem; display: flex; flex-direction: column; gap: 0.9rem; background: #0c1e18; color: #fbf8f1; font-family: system-ui, -apple-system, \"Segoe UI\", Roboto, sans-serif; }\n.ef-ctv__top { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 0.5rem; }\n.ef-ctv__vars { display: flex; flex-wrap: wrap; gap: 0.3rem; }\n.ef-ctv__vars button, .ef-ctv__replay { font: inherit; font-size: 0.68rem; font-weight: 600; line-height: 1; padding: 0.4rem 0.58rem; border-radius: 999px; border: 1px solid rgba(251, 248, 241, 0.3); background: transparent; color: #fbf8f1; cursor: pointer; transition: background 160ms, color 160ms, border-color 160ms; }\n.ef-ctv__vars button:hover, .ef-ctv__replay:hover { border-color: var(--ef-acc); }\n.ef-ctv__vars button[aria-pressed=\"true\"] { background: var(--ef-acc); border-color: var(--ef-acc); color: #0c1e18; }\n.ef-ctv__replay { margin-left: auto; color: var(--ef-acc); border-color: transparent; padding-inline: 0.5rem; }\n.ef-ctv__replay:disabled { opacity: 0.35; cursor: default; }\n.ef-ctv__vars button:focus-visible, .ef-ctv__replay:focus-visible { outline: 2px solid var(--ef-acc); outline-offset: 2px; }\n.ef-ctv__stage { position: relative; flex: 1; display: flex; align-items: center; min-height: 8rem; padding: 0 0.3rem; }\n.ef-ctv__sr { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }\n.ef-ctv__text { position: relative; width: 100%; overflow: hidden; font-size: 28px; font-weight: 600; line-height: 1.35; letter-spacing: -0.01em; }\n.ef-ctv__l { position: relative; width: max-content; white-space: nowrap; }\n.ef-ctv__w { display: inline-block; }\n.ef-ctv__c { display: inline-block; white-space: pre; }\n.ef-ctv__fx { position: absolute; inset: 0; pointer-events: none; }\n.ef-ctv__typer { position: absolute; left: 0; top: 0; height: 100%; display: flex; align-items: center; opacity: 0; will-change: transform; }\n.ef-ctv__guess { color: var(--ef-acc); opacity: 0.5; white-space: pre; }\n.ef-ctv__cursor { display: block; width: 0.5em; height: 1.05em; margin-left: 0.04em; background: var(--ef-acc); }\n.ef-ctv__caret { position: absolute; left: 0; top: 0; width: 2px; height: 1.2em; margin-top: 0.08em; background: var(--ef-acc); opacity: 0; will-change: transform; }\n.ef-ctv__bar { position: absolute; border-radius: 2px; background: var(--ef-acc); transform: scaleY(0.06); will-change: transform; }\n.ef-ctv__c.is-hl, .ef-ctv__c.is-mark, .ef-ctv__text[data-v=\"captions\"] .ef-ctv__c { color: color-mix(in srgb, var(--ef-acc) calc(var(--m, 0) * 100%), currentColor); }\n.ef-ctv__text[data-v=\"find\"] .ef-ctv__c { border-radius: 0.12em; background: rgba(var(--ef-acc-rgb, 230, 255, 85), var(--h, 0)); }",
    "js": "// Enrichr Library · https://enrichr.dev\n// Adapted from https://github.com/codrops/TextCharacterAnimations (MIT) — Copyright (c) 2009 - 2026 [Codrops](https://codrops.com)\n// Character text variants: a short text is split into words and characters, then played back by one of six typing-style effects chosen with\n// the buttons: Scramble (a cursor typing with guesses), Find all (matches light up by letter), Speed reader (words flash at one point and fly\n// home), Multi-cursor (a caret in every word typing together), Live captions (bursts that roll up) and Voice note (a waveform turning to text).\n// Every variant is a pure function of time, drawn from one rAF loop. No GSAP or SplitText. Reduced motion shows the finished text at once.\n// The animated letters are hidden from assistive tech; a plain copy of the text is read instead.\n// mount(root, { background, accent, text (\"a / b / c\" = lines), variant, speed (0.4-2.5), size (max px), loop (seconds before replay, 0 = off) })\nfunction mount(root, o) {\n  var reduce = window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches;\n  var wrap = root.querySelector(\".ef-ctv__wrap\");\n  var varsEl = root.querySelector(\".ef-ctv__vars\");\n  var replayBtn = root.querySelector(\".ef-ctv__replay\");\n  var stage = root.querySelector(\".ef-ctv__stage\");\n  var sr = root.querySelector(\".ef-ctv__sr\");\n  var textEl = root.querySelector(\".ef-ctv__text\");\n  var roll = root.querySelector(\".ef-ctv__roll\");\n  var VARS = [[\"scramble\", \"Scramble\"], [\"find\", \"Find all\"], [\"reader\", \"Speed reader\"], [\"multi\", \"Multi-cursor\"], [\"captions\", \"Live captions\"], [\"voice\", \"Voice note\"]];\n  var EXTRA = { reader: 6.4 };\n  var GLYPHS = \"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789/<>=+*\";\n  var ORDER = \"etaoinshrdlucmfwypvbgkjqxz\";\n  var LETTER = /[A-Za-z0-9À-ɏ]/;\n  var opts = {}, lines = [], words = [], chars = [], fs = 16, cur = null, t0 = 0, tNow = 0, raf = 0, timer = 0, ro = null, lastW = 0, btns = {}, offs = [];\n  var built = \"\", sized = \"\";\n\n  function clamp(v, a, b) { return Math.max(a, Math.min(b, v)); }\n  function ease3(k) { return 1 - Math.pow(1 - k, 3); }\n  function mk(tag, cls) { var e = document.createElement(tag); e.className = cls; return e; }\n  function rng(seed) { return function () { seed |= 0; seed = seed + 0x6D2B79F5 | 0; var t = Math.imul(seed ^ seed >>> 15, 1 | seed); t = t + Math.imul(t ^ t >>> 7, 61 | t) ^ t; return ((t ^ t >>> 14) >>> 0) / 4294967296; }; }\n  function hash(n) { n = Math.sin(n * 127.1) * 43758.5453; return n - Math.floor(n); }\n  function hexRgb(h) { var m = /^#?([0-9a-f]{6})$/i.exec(h || \"\"); if (!m) return \"230,255,85\"; var n = parseInt(m[1], 16); return (n >> 16) + \",\" + (n >> 8 & 255) + \",\" + (n & 255); }\n\n  function buildText() {\n    roll.textContent = \"\"; lines = []; words = []; chars = [];\n    opts.text.split(\"/\").map(function (s) { return s.trim(); }).filter(Boolean).slice(0, 4).forEach(function (s) {\n      var l = mk(\"div\", \"ef-ctv__l\"), fx = mk(\"div\", \"ef-ctv__fx\");\n      var L = { el: l, fx: fx, words: [], chars: [], w: 0, h: 0 };\n      fx.setAttribute(\"aria-hidden\", \"true\");\n      s.split(/\\s+/).forEach(function (wd, wi) {\n        if (wi) l.appendChild(document.createTextNode(\" \"));\n        var w = mk(\"span\", \"ef-ctv__w\"), W = { el: w, chars: [], line: L };\n        Array.from(wd).forEach(function (ch) {\n          var c = mk(\"span\", \"ef-ctv__c\"); c.textContent = ch; w.appendChild(c);\n          var C = { el: c, word: W, line: L, ch: ch, x: 0, y: 0, w: 0 };\n          W.chars.push(C); L.chars.push(C); chars.push(C);\n        });\n        l.appendChild(w); L.words.push(W); words.push(W);\n      });\n      l.appendChild(fx); roll.appendChild(l); lines.push(L);\n    });\n    sr.textContent = lines.map(function (L) { return L.words.map(function (W) { return W.chars.map(function (C) { return C.ch; }).join(\"\"); }).join(\" \"); }).join(\" \");\n    built = opts.text;\n  }\n  function fit() {\n    var avail = stage.clientWidth - 14;\n    if (avail <= 0 || !lines.length) return false;\n    textEl.style.fontSize = \"100px\";\n    var maxW = 0;\n    lines.forEach(function (L) { maxW = Math.max(maxW, L.el.offsetWidth); });\n    fs = clamp(avail / (maxW / 100 + (EXTRA[opts.variant] || 0)), 11, opts.size);\n    textEl.style.fontSize = fs.toFixed(2) + \"px\";\n    return true;\n  }\n  function resetStyles() {\n    chars.forEach(function (C) { C.el.style.cssText = \"\"; C.el.classList.remove(\"is-mark\"); });\n    words.forEach(function (W) { W.el.style.cssText = \"\"; });\n    lines.forEach(function (L) { L.fx.textContent = \"\"; });\n    roll.style.transform = \"\";\n  }\n  function measure() {\n    resetStyles();\n    lines.forEach(function (L) {\n      var lr = L.el.getBoundingClientRect();\n      L.w = L.el.offsetWidth; L.h = L.el.offsetHeight;\n      L.chars.forEach(function (C) { var r = C.el.getBoundingClientRect(); C.x = r.left - lr.left; C.y = r.top - lr.top; C.w = r.width; });\n    });\n    textEl.style.height = (lines.length * (lines[0] ? lines[0].h : 0)) + \"px\";\n  }\n\n  // ---- variants: each returns { dur, render(t) }; t >= 1e8 renders the finished text ----\n  function mkScramble() {\n    var LET = 0.035, SH = 0.05, GN = 3, FADE = 4, ST = 0.18, BL = 0.25, NB = 2, dur = 0, info = [];\n    lines.forEach(function (L, li) {\n      var typer = mk(\"span\", \"ef-ctv__typer\"), g = mk(\"span\", \"ef-ctv__guess\"), cu = mk(\"span\", \"ef-ctv__cursor\");\n      typer.appendChild(g); typer.appendChild(cu); L.fx.appendChild(typer);\n      var n = L.chars.length, start = li * ST, cend = start + n * LET;\n      info.push({ L: L, li: li, typer: typer, g: g, cu: cu, n: n, start: start, cend: cend });\n      dur = Math.max(dur, cend + FADE * LET + BL * (2 * NB + 1));\n    });\n    return { dur: dur, render: function (t) {\n      var done = t >= 1e8;\n      info.forEach(function (f) {\n        var head = (t - f.start) / LET;\n        f.L.chars.forEach(function (C, i) { C.el.style.opacity = done ? 1 : clamp((head - i) / FADE, 0, 1).toFixed(3); });\n        var phase = Math.floor((t - f.cend) / BL), show = !done && t >= f.start && phase < 2 * NB + 1;\n        f.typer.style.opacity = show ? 1 : 0;\n        if (!show) return;\n        var i = clamp(Math.floor(head), 0, f.n), c = f.L.chars[Math.min(i, f.n - 1)];\n        var x = i < f.n ? c.x : c.x + c.w;\n        f.typer.style.transform = \"translate(\" + x.toFixed(1) + \"px,\" + c.y.toFixed(1) + \"px)\";\n        var cnt = clamp(f.n - i, 0, GN), gl = \"\", k, idx = Math.floor(t / SH);\n        for (k = 0; k < cnt; k++) gl += GLYPHS.charAt(Math.floor(hash(idx * 7.3 + k * 3.1 + f.li * 31) * GLYPHS.length));\n        f.g.textContent = gl;\n        f.cu.style.opacity = t > f.cend && phase % 2 === 1 ? 0 : 1;\n      });\n    } };\n  }\n  function mkFind() {\n    var FIRST = 0.12, LAST = 0.04, SCAN = 0.006, HOLD = 0.08, FADE = 0.35, map = {}, order = [], searches = [], tt = 0, dur = 0;\n    chars.forEach(function (C) { var k = C.ch.toLowerCase(); (map[k] = map[k] || []).push(C); });\n    for (var k in map) order.push(map[k]);\n    var rank = function (a) { var i = ORDER.indexOf(a[0].ch.toLowerCase()); return i < 0 ? ORDER.length : i; };\n    order.sort(function (a, b) { return b.length - a.length || rank(a) - rank(b); });\n    order.forEach(function (grp, si) {\n      var pace = FIRST + (LAST - FIRST) * (order.length > 1 ? si / (order.length - 1) : 1);\n      grp.forEach(function (C, j) { searches.push({ C: C, at: tt + j * SCAN }); });\n      dur = Math.max(dur, tt + grp.length * SCAN + HOLD + FADE);\n      tt += pace;\n    });\n    return { dur: Math.max(dur, tt), render: function (t) {\n      var done = t >= 1e8;\n      searches.forEach(function (s) {\n        var tm = t - s.at, st = s.C.el.style;\n        if (!done && tm < 0) { st.opacity = 0; st.removeProperty(\"--h\"); st.color = \"\"; return; }\n        st.opacity = 1;\n        var h = done ? 0 : 1 - clamp((tm - HOLD) / FADE, 0, 1);\n        st.setProperty(\"--h\", h.toFixed(3));\n        st.color = h > 0.45 ? \"#0c1e18\" : \"\";\n      });\n    } };\n  }\n  function mkReader() {\n    var HOLD = 0.06, LT = 0.014, FLY = 0.45, LS = 0.3, xr = 0, dur = 0, items = [];\n    lines.forEach(function (L) { xr = Math.max(xr, L.w); });\n    xr += 1.2 * fs;\n    lines.forEach(function (L, li) {\n      var s = li * LS;\n      L.words.forEach(function (W) {\n        var cs = W.chars.filter(function (C) { return LETTER.test(C.ch); }), use = cs.length ? cs : W.chars;\n        var n = use.length, ix = n < 2 ? 0 : n < 6 ? 1 : n < 10 ? 2 : n < 14 ? 3 : 4, mark = use[Math.min(ix, n - 1)];\n        mark.el.classList.add(\"is-mark\");\n        var stay = HOLD + n * LT;\n        items.push({ W: W, mark: mark, dx: xr - (mark.x + mark.w / 2), s0: s, s1: s + stay });\n        s += stay; dur = Math.max(dur, s + FLY);\n      });\n    });\n    return { dur: dur, render: function (t) {\n      items.forEach(function (it) {\n        var st = it.W.el.style;\n        if (t < it.s0) { st.opacity = 0; return; }\n        st.opacity = 1;\n        var x = it.dx, m = 1;\n        if (t >= it.s1) { var e = ease3(clamp((t - it.s1) / FLY, 0, 1)); x = it.dx * (1 - e); m = 1 - e; }\n        st.transform = \"translateX(\" + x.toFixed(1) + \"px)\";\n        it.mark.el.style.setProperty(\"--m\", m.toFixed(3));\n      });\n    } };\n  }\n  function mkMulti() {\n    var R = rng(7), n = words.length, land = [], keys = [], tk, i, items = [], last = 0, dur = 0;\n    for (i = 0; i < n; i++) land.push(0.15 + i * 0.075);\n    tk = land[0] + 0.05;\n    while (keys.length < 500) { keys.push(tk); tk += 0.04 + R() * R() * 0.15 + (R() < 0.12 ? 0.14 : 0); }\n    var ks = function (t) { var lo = 0, hi = keys.length; while (lo < hi) { var m = (lo + hi) >> 1; if (keys[m] <= t) lo = m + 1; else hi = m; } return lo; };\n    words.forEach(function (W, wi) {\n      var caret = mk(\"span\", \"ef-ctv__caret\"), lk = ks(land[wi]), len = W.chars.length;\n      W.line.fx.appendChild(caret);\n      var fin = keys[Math.min(keys.length - 1, lk + len - 1)];\n      items.push({ W: W, caret: caret, lk: lk, len: len, fin: fin, land: land[wi] });\n      if (fin > items[last].fin) last = wi;\n      dur = Math.max(dur, fin + 0.9);\n    });\n    return { dur: dur, render: function (t) {\n      var done = t >= 1e8, kc = done ? keys.length : ks(t);\n      items.forEach(function (it, wi) {\n        var typed = done ? it.len : clamp(kc - it.lk, 0, it.len), cs = it.W.chars, c = cs[Math.min(typed, it.len - 1)];\n        cs.forEach(function (C, i) { C.el.style.opacity = i < typed ? 1 : 0; });\n        var vis = 0;\n        if (!done && t >= it.land) {\n          vis = 1;\n          if (typed === it.len) {\n            var age = t - it.fin;\n            if (wi === last) vis = Math.floor(age / 0.2) % 2 === 0 && age < 0.8 ? 1 : 0;\n            else vis = 1 - clamp(age / 0.3, 0, 1);\n          }\n        }\n        it.caret.style.opacity = vis;\n        if (vis) it.caret.style.transform = \"translate(\" + (typed < it.len ? c.x : c.x + c.w).toFixed(1) + \"px,\" + c.y.toFixed(1) + \"px)\";\n      });\n    } };\n  }\n  function mkCaptions() {\n    var R = rng(11), LET = 0.02, tt = 0.35, bursts = [], rowAt = [], n = lines.length, lh = lines[0].h;\n    lines.forEach(function (L, li) {\n      rowAt.push(tt);\n      for (var i = 0; i < L.words.length;) {\n        var size = Math.min(L.words.length - i, 1 + Math.floor(R() * 3)), cs = [];\n        L.words.slice(i, i + size).forEach(function (W) { cs = cs.concat(W.chars); });\n        bursts.push({ cs: cs, t0: tt });\n        tt += cs.length * LET + 0.12 + R() * 0.22; i += size;\n      }\n    });\n    return { dur: tt + 0.4, render: function (t) {\n      var done = t >= 1e8, rp = 0, r;\n      bursts.forEach(function (b) {\n        b.cs.forEach(function (C, k) {\n          var tm = t - b.t0 - k * LET;\n          C.el.style.opacity = done || tm >= 0 ? 1 : 0;\n          C.el.style.setProperty(\"--m\", done ? 0 : (tm < 0 ? 0 : 1 - clamp((tm - 0.1) / 0.5, 0, 1)).toFixed(3));\n        });\n      });\n      for (r = 1; r < n; r++) { var k = done ? 1 : clamp((t - (rowAt[r] - 0.1)) / 0.22, 0, 1); rp += k * k * (3 - 2 * k); }\n      roll.style.transform = \"translateY(\" + ((n - 1 - rp) * lh).toFixed(1) + \"px)\";\n    } };\n  }\n  function mkVoice() {\n    var LET = 0.045, LAG = 5, ST = 0.25, R = rng(3), dur = 0, items = [];\n    lines.forEach(function (L, li) {\n      var bh = fs * 0.85, bars = [];\n      L.words.forEach(function (W) {\n        W.chars.forEach(function (C, k) {\n          var amp = (0.35 + 0.65 * Math.sin(Math.PI * (k + 0.5) / W.chars.length)) * (/[aeiouAEIOU]/.test(C.ch) ? 1 : 0.62) * (0.8 + 0.2 * R());\n          var b = mk(\"span\", \"ef-ctv__bar\"), bw = Math.max(2, C.w * 0.5);\n          b.style.width = bw.toFixed(1) + \"px\"; b.style.height = bh.toFixed(1) + \"px\";\n          b.style.left = (C.x + C.w / 2 - bw / 2).toFixed(1) + \"px\"; b.style.top = ((L.h - bh) / 2).toFixed(1) + \"px\";\n          L.fx.appendChild(b); bars.push({ C: C, b: b, amp: amp });\n        });\n      });\n      items.push({ start: li * ST, bars: bars });\n      dur = Math.max(dur, li * ST + (L.chars.length + LAG + 3) * LET + 0.2);\n    });\n    return { dur: dur, render: function (t) {\n      var done = t >= 1e8;\n      items.forEach(function (f) {\n        var head = (t - f.start) / LET;\n        f.bars.forEach(function (x, i) {\n          var a = done ? 1 : clamp((head - i - LAG) / 3, 0, 1), gr = clamp(head - i, 0, 1), s;\n          x.C.el.style.opacity = a;\n          if (gr > 0) s = gr * (1 - a) * x.amp * (1 + 0.12 * Math.sin(t * 9 + i * 1.7));\n          else s = 0.05 + 0.04 * (1 + Math.sin(t * 5 + i));\n          x.b.style.opacity = a >= 1 ? 0 : 1;\n          x.b.style.transform = \"scaleY(\" + Math.max(0.05, s).toFixed(3) + \")\";\n        });\n      });\n    } };\n  }\n  var MAKE = { scramble: mkScramble, find: mkFind, reader: mkReader, multi: mkMulti, captions: mkCaptions, voice: mkVoice };\n\n  // ---- playback ----\n  function stopLoop() { if (raf) cancelAnimationFrame(raf); raf = 0; if (timer) clearTimeout(timer); timer = 0; }\n  function tick(now) {\n    raf = 0;\n    tNow = (now - t0) / 1000 * opts.speed;\n    if (tNow >= cur.dur) { cur.render(1e9); if (opts.loop > 0) timer = setTimeout(play, opts.loop * 1000); return; }\n    cur.render(tNow);\n    raf = requestAnimationFrame(tick);\n  }\n  function play() {\n    stopLoop();\n    if (!cur) return;\n    if (reduce) { cur.render(1e9); return; }\n    cur.render(0);\n    t0 = performance.now(); tNow = 0;\n    raf = requestAnimationFrame(tick);\n  }\n  function setup() {\n    stopLoop();\n    if (!lines.length || !fit()) return;\n    sized = Math.round(stage.clientWidth) + \"|\" + opts.size + \"|\" + opts.variant;\n    measure();\n    cur = MAKE[opts.variant]();\n    textEl.setAttribute(\"data-v\", opts.variant);\n    play();\n  }\n  function setVariant(v) {\n    opts.variant = v;\n    VARS.forEach(function (p) { btns[p[0]].setAttribute(\"aria-pressed\", p[0] === v ? \"true\" : \"false\"); });\n    setup();\n  }\n\n  VARS.forEach(function (p) {\n    var b = document.createElement(\"button\");\n    b.type = \"button\"; b.textContent = p[1]; b.setAttribute(\"aria-pressed\", \"false\");\n    var h = function () { setVariant(p[0]); };\n    b.addEventListener(\"click\", h); offs.push(function () { b.removeEventListener(\"click\", h); });\n    varsEl.appendChild(b); btns[p[0]] = b;\n  });\n  replayBtn.addEventListener(\"click\", play); offs.push(function () { replayBtn.removeEventListener(\"click\", play); });\n  replayBtn.disabled = reduce;\n\n  function update(next) {\n    var prev = opts;\n    opts = Object.assign({ background: \"#0c1e18\", accent: \"#e6ff55\", text: \"Enrichr turns any site / into a library of effects / you can use today.\", variant: \"scramble\", speed: 1, size: 44, loop: 3 }, opts, next || {});\n    if (!MAKE[opts.variant]) opts.variant = \"scramble\";\n    opts.speed = clamp(Number(opts.speed) || 1, 0.3, 3);\n    opts.size = clamp(Number(opts.size) || 44, 14, 80);\n    opts.loop = clamp(Number(opts.loop) || 0, 0, 10);\n    wrap.style.background = opts.background;\n    wrap.style.setProperty(\"--ef-acc\", opts.accent);\n    wrap.style.setProperty(\"--ef-acc-rgb\", hexRgb(opts.accent));\n    if (prev.speed && prev.speed !== opts.speed && raf) t0 = performance.now() - tNow / opts.speed * 1000;\n    var rebuild = built !== opts.text;\n    if (rebuild) buildText();\n    VARS.forEach(function (p) { btns[p[0]].setAttribute(\"aria-pressed\", p[0] === opts.variant ? \"true\" : \"false\"); });\n    if (rebuild || prev.variant !== opts.variant || prev.size !== opts.size || prev.accent !== opts.accent || !cur) setup();\n  }\n  if (window.ResizeObserver) {\n    ro = new ResizeObserver(function () {\n      var w = Math.round(stage.clientWidth);\n      if (w && w !== lastW) { lastW = w; if (cur) setup(); }\n    });\n    ro.observe(stage);\n  }\n  update(o);\n  return {\n    update: update,\n    destroy: function () {\n      stopLoop();\n      if (ro) ro.disconnect();\n      offs.forEach(function (f) { f(); }); offs = [];\n      varsEl.textContent = \"\"; roll.textContent = \"\";\n      lines = []; words = []; chars = []; cur = null;\n    }\n  };\n}"
  }
}