{
  "id": "kinetic-type-reveals",
  "kind": "element",
  "title": "Kinetic type reveals",
  "summary": "Nine ways for a line of type to arrive, from scramble and split-flap to ink underline and 3D flip, picked from one menu and replayed each time it scrolls into view.",
  "url": "https://enrichr.dev/elements/kinetic-type-reveals.html",
  "section": "text",
  "techniques": [
    "text-animation",
    "reveal",
    "stagger",
    "3d-css"
  ],
  "stack": [
    "Vanilla JS",
    "CSS",
    "SVG"
  ],
  "frameworks": [
    "React",
    "Next.js",
    "Vanilla"
  ],
  "mood": [
    "kinetic",
    "editorial"
  ],
  "intents": [
    "text reveal animation on scroll",
    "scramble text decode effect",
    "typewriter text effect",
    "split-flap departure board text",
    "letter by letter fade in headline"
  ],
  "status": "tested",
  "params": [
    {
      "key": "effect",
      "label": "Study",
      "type": "select",
      "options": [
        [
          "scramble",
          "01 Scramble"
        ],
        [
          "typewriter",
          "02 Typewriter"
        ],
        [
          "splitflap",
          "03 Split-flap"
        ],
        [
          "stagger",
          "04 Stagger fade"
        ],
        [
          "blur",
          "05 Blur focus"
        ],
        [
          "glitch",
          "06 Glitch split"
        ],
        [
          "ink",
          "07 Ink signature"
        ],
        [
          "curtain",
          "08 Curtain wipe"
        ],
        [
          "flip",
          "09 3D flip-in"
        ]
      ],
      "value": "scramble"
    },
    {
      "key": "text",
      "label": "Text",
      "type": "text",
      "value": "SET IN MOTION"
    },
    {
      "key": "speed",
      "label": "Speed (1 = original timing)",
      "type": "range",
      "min": 0.25,
      "max": 3,
      "step": 0.05,
      "value": 1
    },
    {
      "key": "size",
      "label": "Text size (px)",
      "type": "range",
      "min": 16,
      "max": 120,
      "step": 1,
      "value": 42
    },
    {
      "key": "color",
      "label": "Text colour",
      "type": "color",
      "value": "#fbf8f1"
    },
    {
      "key": "accent",
      "label": "Accent (cursor, underline, curtain, label)",
      "type": "color",
      "value": "#e6ff55"
    },
    {
      "key": "ghost",
      "label": "Glitch second colour",
      "type": "color",
      "value": "#e54c1e"
    },
    {
      "key": "background",
      "label": "Background",
      "type": "color",
      "value": "#0c1e18"
    },
    {
      "key": "label",
      "label": "Specimen label",
      "type": "select",
      "options": [
        [
          "1",
          "Show"
        ],
        [
          "0",
          "Hide"
        ]
      ],
      "value": "1"
    }
  ],
  "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 \"Kinetic type reveals\" element to this project.\n\nThis is the \"Kinetic type reveals\" element from the Enrichr Library: Nine ways for a line of type to arrive, from scramble and split-flap to ink underline and 3D flip, picked from one menu and replayed each time it scrolls into view.\nPage: https://enrichr.dev/elements/kinetic-type-reveals.html\nMachine-readable spec: https://enrichr.dev/elements/kinetic-type-reveals.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/kinetic-type-reveals.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 \"Kinetic type reveals\" 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 \"Kinetic type reveals\" element from the Enrichr Library: Nine ways for a line of type to arrive, from scramble and split-flap to ink underline and 3D flip, picked from one menu and replayed each time it scrolls into view.\nPage: https://enrichr.dev/elements/kinetic-type-reveals.html\nMachine-readable spec: https://enrichr.dev/elements/kinetic-type-reveals.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 \"Kinetic type reveals\" element to this codebase.\n\nThis is the \"Kinetic type reveals\" element from the Enrichr Library: Nine ways for a line of type to arrive, from scramble and split-flap to ink underline and 3D flip, picked from one menu and replayed each time it scrolls into view.\nPage: https://enrichr.dev/elements/kinetic-type-reveals.html\nMachine-readable spec: https://enrichr.dev/elements/kinetic-type-reveals.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-kinetic-type-reveals.mdc so the rule stays with the project:\n---\ndescription: How to use the Enrichr Kinetic type reveals 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 \"Kinetic type reveals\" element. Tailwind is available but this component needs no utility classes.\n\nThis is the \"Kinetic type reveals\" element from the Enrichr Library: Nine ways for a line of type to arrive, from scramble and split-flap to ink underline and 3D flip, picked from one menu and replayed each time it scrolls into view.\nPage: https://enrichr.dev/elements/kinetic-type-reveals.html\nMachine-readable spec: https://enrichr.dev/elements/kinetic-type-reveals.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- kinetic-type-reveals.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 \"./kinetic-type-reveals\"; // markup is the HTML string; mount is the JavaScript's mount function\n\nexport default function KineticTypeReveals(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 \"Kinetic type reveals\" element to this React + Vite + TypeScript + Tailwind project. Do not install any packages.\n\nThis is the \"Kinetic type reveals\" element from the Enrichr Library: Nine ways for a line of type to arrive, from scramble and split-flap to ink underline and 3D flip, picked from one menu and replayed each time it scrolls into view.\nPage: https://enrichr.dev/elements/kinetic-type-reveals.html\nMachine-readable spec: https://enrichr.dev/elements/kinetic-type-reveals.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- kinetic-type-reveals.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/KineticTypeReveals.tsx):\n```tsx\n\"use client\";\nimport { useEffect, useRef } from \"react\";\nimport { markup, mount } from \"./kinetic-type-reveals\"; // markup is the HTML string; mount is the JavaScript's mount function\n\nexport default function KineticTypeReveals(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 \"Kinetic type reveals\" element.\n\nThis is the \"Kinetic type reveals\" element from the Enrichr Library: Nine ways for a line of type to arrive, from scramble and split-flap to ink underline and 3D flip, picked from one menu and replayed each time it scrolls into view.\nPage: https://enrichr.dev/elements/kinetic-type-reveals.html\nMachine-readable spec: https://enrichr.dev/elements/kinetic-type-reveals.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), kinetic-type-reveals.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 \"Kinetic type reveals\" element. No packages, no server code.\n\nThis is the \"Kinetic type reveals\" element from the Enrichr Library: Nine ways for a line of type to arrive, from scramble and split-flap to ink underline and 3D flip, picked from one menu and replayed each time it scrolls into view.\nPage: https://enrichr.dev/elements/kinetic-type-reveals.html\nMachine-readable spec: https://enrichr.dev/elements/kinetic-type-reveals.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 kinetic-type-reveals.js and then main.js), style.css (the CSS below), kinetic-type-reveals.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 \"Kinetic type reveals\" 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 \"Kinetic type reveals\" element from the Enrichr Library: Nine ways for a line of type to arrive, from scramble and split-flap to ink underline and 3D flip, picked from one menu and replayed each time it scrolls into view.\nPage: https://enrichr.dev/elements/kinetic-type-reveals.html\nMachine-readable spec: https://enrichr.dev/elements/kinetic-type-reveals.json\n\nWhat it does: Each study is a plate from a kinetic type specimen book, and the Study menu swaps which one plays. Scramble, typewriter and split-flap rewrite the text on a timer: scramble ticks every 40 ms and locks one more letter every third tick, typewriter adds a letter every 65 ms, and split-flap gives every letter its own 8 to 16 random flips, ticking every 45 ms plus 4 ms per letter. Stagger fade, blur focus and 3D flip-in wrap each letter in a span with a delay spread over 420 ms and let CSS transitions do the rest (0.5 s rise, 0.6 s blur to sharp, a 0.5 s hinge swing with a small overshoot). Glitch split draws two coloured copies of the word with pseudo-elements and flicks them sideways in clipped bands on 2.6 s and 2.9 s loops. Ink signature draws an SVG underline with a stroke-dash transition over 1 s while the word fades in, and curtain wipe shrinks an accent plate to the left over 0.9 s. An IntersectionObserver plays the entrance when about a third of the element is on screen and resets it once it has left, so it plays again on the way back; the Library's Replay button calls replay(). Speed divides every duration and tick.\nAccessibility: The full line is in the element as visually hidden text and the animated letters are hidden from screen readers, so it is read once, normally, even while it scrambles. With prefers-reduced-motion the finished text shows at once, the glitch copies stand still and nothing ticks. Nothing needs keyboard input. Check your text and background colours for contrast if you change them.\n\nTunable settings:\n- Study: select (01 Scramble / 02 Typewriter / 03 Split-flap / 04 Stagger fade / 05 Blur focus / 06 Glitch split / 07 Ink signature / 08 Curtain wipe / 09 3D flip-in), default scramble\n- Text: text, default SET IN MOTION\n- Speed (1 = original timing): range 0.25 to 3, step 0.05, default 1\n- Text size (px): range 16 to 120, step 1, default 42\n- Text colour: color, default #fbf8f1\n- Accent (cursor, underline, curtain, label): color, default #e6ff55\n- Glitch second colour: color, default #e54c1e\n- Background: color, default #0c1e18\n- Specimen label: select (Show / Hide), default 1\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/kinetic-type-reveals.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 \"Kinetic type reveals\" 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 \"Kinetic type reveals\" element from the Enrichr Library: Nine ways for a line of type to arrive, from scramble and split-flap to ink underline and 3D flip, picked from one menu and replayed each time it scrolls into view.\nPage: https://enrichr.dev/elements/kinetic-type-reveals.html\nMachine-readable spec: https://enrichr.dev/elements/kinetic-type-reveals.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 KineticTypeReveals.\n2. Paste the JavaScript below into a separate code file named kinetic-type-reveals.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 \"./kinetic-type-reveals\"; // markup is the HTML string; mount is the JavaScript's mount function\n\nexport default function KineticTypeReveals(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(KineticTypeReveals, {\n  effect: { type: ControlType.Enum, title: \"Study\", options: [\"scramble\",\"typewriter\",\"splitflap\",\"stagger\",\"blur\",\"glitch\",\"ink\",\"curtain\",\"flip\"], optionTitles: [\"01 Scramble\",\"02 Typewriter\",\"03 Split-flap\",\"04 Stagger fade\",\"05 Blur focus\",\"06 Glitch split\",\"07 Ink signature\",\"08 Curtain wipe\",\"09 3D flip-in\"], defaultValue: \"scramble\" },\n  text: { type: ControlType.String, title: \"Text\", defaultValue: \"SET IN MOTION\" },\n  speed: { type: ControlType.Number, title: \"Speed\", min: 0.25, max: 3, step: 0.05, defaultValue: 1 },\n  size: { type: ControlType.Number, title: \"Text size\", min: 16, max: 120, step: 1, defaultValue: 42 },\n  color: { type: ControlType.Color, title: \"Text colour\", defaultValue: \"#fbf8f1\" },\n  accent: { type: ControlType.Color, title: \"Accent (cursor, underline, curtain, label)\", defaultValue: \"#e6ff55\" },\n  ghost: { type: ControlType.Color, title: \"Glitch second colour\", defaultValue: \"#e54c1e\" },\n  background: { type: ControlType.Color, title: \"Background\", defaultValue: \"#0c1e18\" },\n  label: { type: ControlType.Enum, title: \"Specimen label\", options: [\"1\",\"0\"], optionTitles: [\"Show\",\"Hide\"], defaultValue: \"1\" },\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 \"Kinetic type reveals\" 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 \"Kinetic type reveals\" element from the Enrichr Library: Nine ways for a line of type to arrive, from scramble and split-flap to ink underline and 3D flip, picked from one menu and replayed each time it scrolls into view.\nPage: https://enrichr.dev/elements/kinetic-type-reveals.html\nMachine-readable spec: https://enrichr.dev/elements/kinetic-type-reveals.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-kinetic-type-reveals\"></div>, and a <script> block with the JavaScript followed by:\n   mount(document.getElementById(\"enrichr-kinetic-type-reveals\"), { ...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 full line is in the element as visually hidden text and the animated letters are hidden from screen readers, so it is read once, normally, even while it scrambles. With prefers-reduced-motion the finished text shows at once, the glitch copies stand still and nothing ticks. Nothing needs keyboard input. Check your text and background colours for contrast if you change them.",
  "performance": "Transitions only touch opacity, transform and filter on a few dozen spans. The text-rewriting studies share one requestAnimationFrame clock that stops when there is nothing left to tick, pauses off screen and in hidden tabs, and the glitch loop pauses off screen too.",
  "dependencies": [],
  "codepen": "https://codepen.io/Enrichr-Dev/pen/azJPjPW",
  "source": {
    "markup": "<div class=\"ef-ktr\" data-fx=\"scramble\" data-label=\"1\">\n  <div class=\"ef-ktr__head\">\n    <span class=\"ef-ktr__num\" aria-hidden=\"true\">01</span>\n    <span class=\"ef-ktr__meta\"><span class=\"ef-ktr__name\">Scramble</span><span class=\"ef-ktr__desc\">Noise resolves into signal, left to right.</span></span>\n    <span class=\"ef-ktr__tag\">auto · repeats on view</span>\n  </div>\n  <div class=\"ef-ktr__stage\"><span class=\"ef-ktr__demo\">SET IN MOTION</span></div>\n</div>",
    "css": "/* Enrichr Library · https://enrichr.dev */\n.ef-ktr {\n  --ef-ktr-k: 1; --ef-ktr-size: 42;\n  --ef-ktr-fg: #fbf8f1; --ef-ktr-fg-rgb: 251, 248, 241; --ef-ktr-muted: #9ca39b;\n  --ef-ktr-bg: #0c1e18; --ef-ktr-bg-rgb: 12, 30, 24; --ef-ktr-top: #17281f;\n  --ef-ktr-acc: #e6ff55; --ef-ktr-acc-rgb: 230, 255, 85; --ef-ktr-ghost: #e54c1e;\n  --ef-ktr-fs: min(calc(var(--ef-ktr-size) * 1px), max(1.5rem, 9cqw));\n  position: relative; box-sizing: border-box; width: 100%; min-height: 24rem; overflow: hidden; border-radius: 1rem;\n  display: flex; flex-direction: column; container-type: inline-size;\n  color: var(--ef-ktr-fg); font-family: 'Instrument Sans', system-ui, sans-serif;\n  background: radial-gradient(ellipse at 50% 120%, rgba(var(--ef-ktr-acc-rgb), .1), transparent 60%), linear-gradient(180deg, var(--ef-ktr-top), var(--ef-ktr-bg));\n  border: 1px solid rgba(var(--ef-ktr-acc-rgb), .2);\n  box-shadow: inset 0 1px 0 rgba(var(--ef-ktr-fg-rgb), .05);\n}\n.ef-ktr *, .ef-ktr *::before, .ef-ktr *::after { box-sizing: border-box; }\n\n/* specimen label */\n.ef-ktr .ef-ktr__head { position: relative; z-index: 2; display: flex; align-items: center; gap: 1rem; padding: 1.1rem 1.25rem 0; }\n.ef-ktr[data-label=\"0\"] .ef-ktr__head { display: none; }\n.ef-ktr .ef-ktr__num {\n  flex-shrink: 0; width: 2.2rem; height: 2.2rem; border-radius: 50%; display: flex; align-items: center; justify-content: center;\n  font: 600 .78rem/1 'Fira Code', ui-monospace, monospace; color: var(--ef-ktr-bg); background: var(--ef-ktr-acc);\n  box-shadow: 0 0 0 1px rgba(var(--ef-ktr-acc-rgb), .4), 0 4px 14px -4px rgba(var(--ef-ktr-acc-rgb), .55);\n}\n.ef-ktr .ef-ktr__meta { display: block; min-width: 0; text-align: left; }\n.ef-ktr .ef-ktr__name { display: block; margin: 0 0 .15rem; font: 600 1.1rem/1.2 'Parkinsans', 'Space Grotesk', sans-serif; letter-spacing: .01em; color: var(--ef-ktr-fg); opacity: 1; }\n.ef-ktr .ef-ktr__desc { display: block; margin: 0; font-size: .84rem; line-height: 1.45; color: var(--ef-ktr-muted); opacity: 1; }\n.ef-ktr .ef-ktr__tag {\n  margin-left: auto; align-self: center; white-space: nowrap; padding: .3rem .6rem; border-radius: 20px;\n  font: .62rem/1.2 'Fira Code', ui-monospace, monospace; letter-spacing: .08em; text-transform: uppercase;\n  color: rgba(var(--ef-ktr-acc-rgb), .85); border: 1px solid rgba(var(--ef-ktr-acc-rgb), .35); background: rgba(var(--ef-ktr-acc-rgb), .06);\n}\n.ef-ktr.is-narrow .ef-ktr__tag, .ef-ktr.is-narrow .ef-ktr__desc { display: none; }\n\n/* stage and type */\n.ef-ktr .ef-ktr__stage { position: relative; z-index: 1; flex: 1; display: flex; align-items: center; justify-content: center; text-align: center; padding: 2rem 1.5rem; min-height: 12rem; }\n.ef-ktr .ef-ktr__sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }\n.ef-ktr .ef-ktr__demo {\n  display: inline-block; margin: 0; white-space: pre-wrap; color: var(--ef-ktr-fg); opacity: 1;\n  font-family: 'Parkinsans', 'Space Grotesk', sans-serif; font-weight: 500; font-size: var(--ef-ktr-fs); letter-spacing: .01em; line-height: 1.2;\n}\n.ef-ktr .ef-ktr__demo--small { font-family: 'Fira Code', ui-monospace, monospace; font-size: calc(var(--ef-ktr-fs) * .615); }\n.ef-ktr .ef-ktr__w { display: inline-block; white-space: nowrap; }\n.ef-ktr .ef-ktr__ch { display: inline-block; will-change: transform, opacity, filter; }\n\n/* 02 typewriter and 03 split-flap */\n.ef-ktr .ef-ktr__type { border-right: 2px solid var(--ef-ktr-acc); padding-right: 4px; }\n.ef-ktr .ef-ktr__ch.is-flap { border-bottom: 1px solid rgba(var(--ef-ktr-fg-rgb), .2); }\n\n/* 04 stagger fade */\n.ef-ktr[data-fx=\"stagger\"] .ef-ktr__ch {\n  opacity: 0; transform: translateY(.524em); /* 22px at the default 42px size */\n  transition: opacity calc(.5s * var(--ef-ktr-k)) ease, transform calc(.5s * var(--ef-ktr-k)) ease;\n  transition-delay: calc(var(--d, 0ms) * var(--ef-ktr-k));\n}\n.ef-ktr[data-fx=\"stagger\"].is-in .ef-ktr__ch { opacity: 1; transform: translateY(0); }\n\n/* 05 blur focus */\n.ef-ktr[data-fx=\"blur\"] .ef-ktr__ch {\n  opacity: 0; filter: blur(14px); transform: scale(1.06);\n  transition: opacity calc(.6s * var(--ef-ktr-k)) ease, filter calc(.6s * var(--ef-ktr-k)) ease, transform calc(.6s * var(--ef-ktr-k)) ease;\n  transition-delay: calc(var(--d, 0ms) * var(--ef-ktr-k));\n}\n.ef-ktr[data-fx=\"blur\"].is-in .ef-ktr__ch { opacity: 1; filter: blur(0); transform: scale(1); }\n\n/* 06 glitch split */\n.ef-ktr .ef-ktr__glitch { position: relative; }\n.ef-ktr .ef-ktr__glitch::before, .ef-ktr .ef-ktr__glitch::after { content: attr(data-text); position: absolute; left: 0; top: 0; width: 100%; overflow: hidden; opacity: .75; }\n.ef-ktr .ef-ktr__glitch::before { color: var(--ef-ktr-ghost); transform: translate(-2px, 0); mix-blend-mode: screen; animation: ef-ktr-gtop calc(2.6s * var(--ef-ktr-k)) infinite linear; }\n.ef-ktr .ef-ktr__glitch::after { color: var(--ef-ktr-acc); transform: translate(2px, 0); mix-blend-mode: screen; animation: ef-ktr-gbot calc(2.9s * var(--ef-ktr-k)) infinite linear; }\n.ef-ktr.is-paused .ef-ktr__glitch::before, .ef-ktr.is-paused .ef-ktr__glitch::after { animation-play-state: paused; }\n@keyframes ef-ktr-gtop {\n  0%, 89%, 100% { clip-path: inset(0 0 0 0); transform: translate(0, 0); }\n  90% { clip-path: inset(10% 0 60% 0); transform: translate(-3px, -1px); }\n  93% { clip-path: inset(60% 0 5% 0); transform: translate(3px, 1px); }\n  96% { clip-path: inset(30% 0 40% 0); transform: translate(-2px, 0); }\n}\n@keyframes ef-ktr-gbot {\n  0%, 89%, 100% { clip-path: inset(0 0 0 0); transform: translate(0, 0); }\n  91% { clip-path: inset(70% 0 5% 0); transform: translate(3px, 0); }\n  94% { clip-path: inset(15% 0 55% 0); transform: translate(-3px, 1px); }\n  97% { clip-path: inset(45% 0 20% 0); transform: translate(2px, -1px); }\n}\n\n/* 07 ink signature */\n.ef-ktr .ef-ktr__ink { display: inline-flex; flex-direction: column; align-items: center; gap: .4rem; }\n.ef-ktr .ef-ktr__ink .ef-ktr__demo { opacity: 0; transition: opacity calc(.5s * var(--ef-ktr-k)) ease calc(.4s * var(--ef-ktr-k)); }\n.ef-ktr.is-in .ef-ktr__ink .ef-ktr__demo { opacity: 1; }\n.ef-ktr .ef-ktr__line { display: block; width: calc(var(--ef-ktr-fs) * 6.25); height: calc(var(--ef-ktr-fs) * .433); overflow: visible; color: var(--ef-ktr-acc); }\n.ef-ktr .ef-ktr__line path { stroke-dasharray: 340; stroke-dashoffset: 340; transition: stroke-dashoffset calc(1s * var(--ef-ktr-k)) ease; }\n.ef-ktr.is-in .ef-ktr__line path { stroke-dashoffset: 0; }\n\n/* 08 curtain wipe */\n.ef-ktr .ef-ktr__curtain { position: relative; display: inline-block; }\n.ef-ktr .ef-ktr__bar { position: absolute; inset: 0; background: var(--ef-ktr-acc); transform-origin: left; transform: scaleX(1); transition: transform calc(.9s * var(--ef-ktr-k)) cubic-bezier(.6, 0, .15, 1); }\n.ef-ktr.is-in .ef-ktr__bar { transform: scaleX(0); }\n\n/* 09 3D flip-in */\n.ef-ktr[data-fx=\"flip\"] .ef-ktr__stage { perspective: 600px; }\n.ef-ktr[data-fx=\"flip\"] .ef-ktr__ch {\n  opacity: 0; transform: rotateX(90deg) translateY(.143em); transform-origin: 50% 100%;\n  transition: opacity calc(.45s * var(--ef-ktr-k)) ease, transform calc(.5s * var(--ef-ktr-k)) cubic-bezier(.2, .9, .3, 1.2);\n  transition-delay: calc(var(--d, 0ms) * var(--ef-ktr-k));\n}\n.ef-ktr[data-fx=\"flip\"].is-in .ef-ktr__ch { opacity: 1; transform: rotateX(0) translateY(0); }\n\n/* reduced motion: finished frame, no transitions or loops */\n.ef-ktr.is-reduced *, .ef-ktr.is-reduced *::before, .ef-ktr.is-reduced *::after { transition: none !important; animation: none !important; }\n@media (prefers-reduced-motion: reduce) {\n  .ef-ktr *, .ef-ktr *::before, .ef-ktr *::after { transition: none !important; animation: none !important; }\n}",
    "js": "// Enrichr Library · https://enrichr.dev\n// Kinetic type reveals: the nine entrance studies from a kinetic type specimen book, one at a time (pick it with effect).\n// Scramble: every 40 ms each unrevealed letter becomes a random glyph and every third tick one more letter locks in, left\n// to right. Typewriter: one letter every 65 ms behind an accent cursor. Split-flap: each letter flips through random\n// glyphs 8 to 16 times, ticking every 45 ms plus 4 ms per letter. Stagger fade: letters rise 22 px and fade in over 0.5 s,\n// start times spread over 420 ms. Blur focus: letters go from a 14 px blur at 106% size to sharp over 0.6 s, same spread.\n// Glitch split: two coloured copies flick sideways in clipped bands on a 2.6 s and a 2.9 s loop. Ink signature: an\n// underline draws over 1 s while the word fades in after 0.4 s. Curtain wipe: an accent plate shrinks to the left over\n// 0.9 s on cubic-bezier(.6,0,.15,1). 3D flip-in: letters swing down from a bottom hinge with a slight overshoot.\n// Entrances play when the element comes into view and again each time it comes back; replay() plays them on demand.\n// Speed scales every duration and tick. Reduced motion shows the finished text at once and the glitch copies stand still.\n// Timers pause off screen and in hidden tabs.\n// mount(root, { effect (scramble | typewriter | splitflap | stagger | blur | glitch | ink | curtain | flip), text,\n//               speed (1 = original timing), size (px), color, accent, ghost (second glitch colour), background,\n//               label (1 shows the specimen label, 0 hides it) })\nfunction mount(root, o) {\n  var reduce = !!(window.matchMedia && window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches);\n  var box = root.querySelector(\".ef-ktr\");\n  var numEl = box.querySelector(\".ef-ktr__num\"), nameEl = box.querySelector(\".ef-ktr__name\");\n  var descEl = box.querySelector(\".ef-ktr__desc\"), tagEl = box.querySelector(\".ef-ktr__tag\");\n  var stage = box.querySelector(\".ef-ktr__stage\");\n  var CHARS = \"ABCDEFGHIJKLMNOPQRSTUVWXYZ#%&*+-/<>[]{}01\";\n  var AUTO = \"auto · repeats on view\", LOOP = \"continuous\";\n  var FX = {\n    scramble: [\"01\", \"Scramble\", \"Noise resolves into signal, left to right.\", AUTO],\n    typewriter: [\"02\", \"Typewriter\", \"One keystroke at a time, cursor included.\", AUTO],\n    splitflap: [\"03\", \"Split-flap\", \"Each letter clatters through its own departures board.\", AUTO],\n    stagger: [\"04\", \"Stagger fade\", \"Letters rise into place, one beat after the last.\", AUTO],\n    blur: [\"05\", \"Blur focus\", \"Out of soft focus, into sharpness.\", AUTO],\n    glitch: [\"06\", \"Glitch split\", \"Two coloured ghosts drift from true position.\", LOOP],\n    ink: [\"07\", \"Ink signature\", \"A stroke draws itself beneath the word.\", AUTO],\n    curtain: [\"08\", \"Curtain wipe\", \"A solid plate slides clear to reveal the word beneath.\", AUTO],\n    flip: [\"09\", \"3D flip-in\", \"Letters fold down from a hinge, like Rolodex cards.\", AUTO]\n  };\n  var opts = {}, fx = \"\", text = \"\", demo = null, spans = [], inView = false, visible = true;\n  var io = null, ro = null, destroyed = false, timers = [], clock = 0, last = 0, raf = 0;\n\n  function num(v, d) { v = Number(v); return isFinite(v) ? v : d; }\n  function rgb(h, d) { var m = /^#?([0-9a-f]{6})$/i.exec(String(h || \"\")); var v = parseInt(m ? m[1] : d, 16); return [v >> 16, (v >> 8) & 255, v & 255]; }\n  function mix(a, b, t) { return \"rgb(\" + [0, 1, 2].map(function (i) { return Math.round(a[i] + (b[i] - a[i]) * t); }).join(\",\") + \")\"; }\n  function randInt(a, b) { return Math.floor(Math.random() * (b - a + 1)) + a; }\n  function glyph() { return CHARS[randInt(0, CHARS.length - 1)]; }\n  function make(tag, cls, txt) { var e = document.createElement(tag); if (cls) e.className = cls; if (txt != null) e.textContent = txt; return e; }\n\n  // One clock for every tick: it only advances while the element is on screen and the tab is visible, scaled by speed.\n  function tick(now) {\n    raf = 0;\n    var dt = Math.min(50, Math.max(0, now - last)); last = now;\n    if (visible && !document.hidden) {\n      clock += dt * opts.speed;\n      var list = timers.slice();\n      for (var i = 0; i < list.length; i++) {\n        var t = list[i], n = 0;\n        while (!t.dead && t.at <= clock && n++ < 4) { if (t.every) t.at += t.every; else t.dead = true; t.fn(t); }\n      }\n      timers = timers.filter(function (t) { return !t.dead; });\n    }\n    if (timers.length && !destroyed && visible) raf = requestAnimationFrame(tick); // off screen the loop stops; the observer restarts it\n  }\n  function kick() { if (!raf && !destroyed && timers.length) { last = performance.now(); raf = requestAnimationFrame(tick); } }\n  function every(ms, fn) { var t = { at: clock + ms, every: ms, fn: fn }; timers.push(t); kick(); return t; }\n  function stopTimers() { timers.forEach(function (t) { t.dead = true; }); timers = []; }\n\n  // letters as aria-hidden spans grouped in unbreakable words; the index counts spaces, as in the original\n  function split(max) {\n    demo.textContent = \"\"; spans = [];\n    var chars = Array.from(text), len = Math.max(chars.length - 1, 1), word = null;\n    chars.forEach(function (ch, i) {\n      if (/\\s/.test(ch)) { word = null; demo.appendChild(document.createTextNode(\" \")); return; }\n      if (!word) { word = make(\"span\", \"ef-ktr__w\"); demo.appendChild(word); }\n      var s = make(\"span\", \"ef-ktr__ch\", ch);\n      s.style.setProperty(\"--i\", i);\n      if (max) s.style.setProperty(\"--d\", (i / len * max).toFixed(0) + \"ms\");\n      s._i = i; s._ch = ch;\n      word.appendChild(s); spans.push(s);\n    });\n  }\n\n  function build() {\n    stopTimers();\n    fx = FX[opts.effect] ? opts.effect : \"scramble\";\n    var f = FX[fx];\n    box.setAttribute(\"data-fx\", fx);\n    numEl.textContent = f[0]; nameEl.textContent = f[1]; descEl.textContent = f[2]; tagEl.textContent = f[3];\n    box.classList.remove(\"is-in\");\n    text = String(opts.text == null ? \"\" : opts.text).replace(/\\s+/g, \" \").trim() || \"SET IN MOTION\";\n    stage.textContent = \"\";\n    stage.appendChild(make(\"span\", \"ef-ktr__sr\", text));\n    demo = make(\"span\", \"ef-ktr__demo\"); demo.setAttribute(\"aria-hidden\", \"true\");\n    var holder = demo;\n    if (fx === \"typewriter\") demo.className += \" ef-ktr__type\";\n    if (fx === \"splitflap\") demo.className += \" ef-ktr__demo--small\";\n    if (fx === \"stagger\" || fx === \"blur\" || fx === \"flip\") split(420);\n    if (fx === \"glitch\") { demo.className += \" ef-ktr__glitch\"; demo.setAttribute(\"data-text\", text); demo.textContent = text; }\n    if (fx === \"ink\") {\n      holder = make(\"span\", \"ef-ktr__ink\"); holder.setAttribute(\"aria-hidden\", \"true\");\n      demo.textContent = text; holder.appendChild(demo);\n      holder.insertAdjacentHTML(\"beforeend\", '<svg class=\"ef-ktr__line\" viewBox=\"0 0 260 18\" focusable=\"false\"><path d=\"M4 10 Q 60 2, 130 9 T 256 8\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\"/></svg>');\n    }\n    if (fx === \"curtain\") {\n      holder = make(\"span\", \"ef-ktr__curtain\"); holder.setAttribute(\"aria-hidden\", \"true\");\n      demo.textContent = text; holder.appendChild(demo); holder.appendChild(make(\"span\", \"ef-ktr__bar\"));\n    }\n    stage.appendChild(holder);\n    if (reduce) finish(); else if (inView) play();\n  }\n\n  function play() {\n    if (reduce || destroyed) return;\n    stopTimers();\n    box.classList.remove(\"is-in\");\n    void box.offsetWidth; // commit the hidden state so the transitions run\n    box.classList.add(\"is-in\");\n    var chars = Array.from(text);\n    if (fx === \"scramble\") {\n      var revealed = 0, frame = 0;\n      every(40, function (t) {\n        frame++;\n        var out = \"\";\n        for (var i = 0; i < chars.length; i++) {\n          if (chars[i] === \" \") { out += \" \"; continue; }\n          out += i < revealed ? chars[i] : glyph();\n        }\n        demo.textContent = out;\n        if (frame % 3 === 0) revealed++;\n        if (revealed > chars.length) { t.dead = true; demo.textContent = text; }\n      });\n    } else if (fx === \"typewriter\") {\n      var k = 0;\n      demo.textContent = \"\";\n      every(65, function (t) {\n        demo.textContent = chars.slice(0, k + 1).join(\"\");\n        k++;\n        if (k >= chars.length) t.dead = true;\n      });\n    } else if (fx === \"splitflap\") {\n      split(0);\n      spans.forEach(function (s) {\n        var count = 0, total = randInt(8, 16);\n        s.classList.add(\"is-flap\");\n        every(45 + s._i * 4, function (t) {\n          count++;\n          if (count >= total) { s.textContent = s._ch; t.dead = true; } else s.textContent = glyph();\n        });\n      });\n    }\n  }\n  function finish() {\n    box.classList.add(\"is-reduced\", \"is-in\");\n    if (fx === \"scramble\" || fx === \"typewriter\") demo.textContent = text;\n    if (fx === \"splitflap\") { split(0); spans.forEach(function (s) { s.classList.add(\"is-flap\"); }); }\n  }\n  function leave() { inView = false; stopTimers(); if (!reduce) box.classList.remove(\"is-in\"); }\n  function replay() { if (!reduce && !destroyed) play(); }\n\n  function paint() {\n    var fg = rgb(opts.color, \"fbf8f1\"), bg = rgb(opts.background, \"0c1e18\"), ac = rgb(opts.accent, \"e6ff55\"), s = box.style;\n    s.setProperty(\"--ef-ktr-fg\", \"rgb(\" + fg + \")\"); s.setProperty(\"--ef-ktr-fg-rgb\", fg.join(\",\"));\n    s.setProperty(\"--ef-ktr-bg\", \"rgb(\" + bg + \")\"); s.setProperty(\"--ef-ktr-bg-rgb\", bg.join(\",\"));\n    s.setProperty(\"--ef-ktr-top\", mix(bg, fg, 0.045)); s.setProperty(\"--ef-ktr-muted\", mix(bg, fg, 0.62));\n    s.setProperty(\"--ef-ktr-acc\", \"rgb(\" + ac + \")\"); s.setProperty(\"--ef-ktr-acc-rgb\", ac.join(\",\"));\n    s.setProperty(\"--ef-ktr-ghost\", \"rgb(\" + rgb(opts.ghost, \"e54c1e\") + \")\");\n    s.setProperty(\"--ef-ktr-k\", String(1 / opts.speed));\n    s.setProperty(\"--ef-ktr-size\", String(opts.size));\n    box.setAttribute(\"data-label\", opts.label ? \"1\" : \"0\");\n  }\n  function update(partial) {\n    var prev = opts;\n    opts = Object.assign({ effect: \"scramble\", text: \"SET IN MOTION\", speed: 1, size: 42, color: \"#fbf8f1\", accent: \"#e6ff55\", ghost: \"#e54c1e\", background: \"#0c1e18\", label: 1 }, opts, partial || {});\n    opts.speed = Math.min(5, Math.max(0.1, num(opts.speed, 1)));\n    opts.size = Math.max(10, num(opts.size, 42));\n    opts.label = !(opts.label === 0 || opts.label === \"0\" || opts.label === false || opts.label === \"off\");\n    paint();\n    if (destroyed) return;\n    if (!fx || prev.effect !== opts.effect || prev.text !== opts.text) build();\n  }\n\n  update(o);\n  if (\"IntersectionObserver\" in window) {\n    io = new IntersectionObserver(function (es) {\n      es.forEach(function (e) {\n        visible = e.isIntersecting;\n        box.classList.toggle(\"is-paused\", !visible);\n        var vh = e.rootBounds ? e.rootBounds.height : window.innerHeight;\n        if (e.isIntersecting && (e.intersectionRatio >= 0.35 || e.boundingClientRect.height > vh * 0.8)) {\n          if (!inView) { inView = true; play(); }\n        } else if (!e.isIntersecting && inView) leave();\n        if (visible) kick();\n      });\n    }, { threshold: [0, 0.35] });\n    io.observe(box);\n  } else { inView = true; play(); }\n  if (\"ResizeObserver\" in window) {\n    ro = new ResizeObserver(function () { if (!destroyed) box.classList.toggle(\"is-narrow\", box.clientWidth < 520); });\n    ro.observe(box);\n  }\n  function onVis() { if (!document.hidden) kick(); }\n  document.addEventListener(\"visibilitychange\", onVis);\n  return {\n    update: update,\n    replay: replay,\n    destroy: function () {\n      destroyed = true; stopTimers(); cancelAnimationFrame(raf); raf = 0;\n      if (io) io.disconnect();\n      if (ro) ro.disconnect();\n      document.removeEventListener(\"visibilitychange\", onVis);\n    }\n  };\n}"
  }
}