{
  "id": "kinetic-type-loops",
  "kind": "element",
  "title": "Kinetic type loops",
  "summary": "Six looping text studies, wave, shimmer, breathing glow, liquid wobble, an eased marquee and a word rotator, picked from one menu.",
  "url": "https://enrichr.dev/elements/kinetic-type-loops.html",
  "section": "text",
  "techniques": [
    "text-animation",
    "stagger"
  ],
  "stack": [
    "Vanilla JS",
    "CSS"
  ],
  "frameworks": [
    "React",
    "Next.js",
    "Vanilla"
  ],
  "mood": [
    "kinetic",
    "polished"
  ],
  "intents": [
    "wave text animation css",
    "shimmer text effect",
    "glowing text animation",
    "rotating words headline",
    "eased marquee text"
  ],
  "status": "tested",
  "params": [
    {
      "key": "effect",
      "label": "Study",
      "type": "select",
      "options": [
        [
          "wave",
          "10 Wave"
        ],
        [
          "shimmer",
          "11 Shimmer sweep"
        ],
        [
          "glow",
          "12 Breathing glow"
        ],
        [
          "liquid",
          "13 Liquid wobble"
        ],
        [
          "marquee",
          "14 Eased marquee"
        ],
        [
          "rotator",
          "15 Kinetic rotator"
        ]
      ],
      "value": "wave"
    },
    {
      "key": "text",
      "label": "Text",
      "type": "text",
      "value": "KEEP IT MOVING"
    },
    {
      "key": "lead",
      "label": "Rotator lead-in",
      "type": "text",
      "value": "DESIGNED FOR"
    },
    {
      "key": "words",
      "label": "Rotator words (comma separated)",
      "type": "text",
      "value": "SPEED, CLARITY, CRAFT, RHYTHM"
    },
    {
      "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 (shimmer band, glow, label)",
      "type": "color",
      "value": "#e6ff55"
    },
    {
      "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 loops\" element to this project.\n\nThis is the \"Kinetic type loops\" element from the Enrichr Library: Six looping text studies, wave, shimmer, breathing glow, liquid wobble, an eased marquee and a word rotator, picked from one menu.\nPage: https://enrichr.dev/elements/kinetic-type-loops.html\nMachine-readable spec: https://enrichr.dev/elements/kinetic-type-loops.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-loops.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 loops\" 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 loops\" element from the Enrichr Library: Six looping text studies, wave, shimmer, breathing glow, liquid wobble, an eased marquee and a word rotator, picked from one menu.\nPage: https://enrichr.dev/elements/kinetic-type-loops.html\nMachine-readable spec: https://enrichr.dev/elements/kinetic-type-loops.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 loops\" element to this codebase.\n\nThis is the \"Kinetic type loops\" element from the Enrichr Library: Six looping text studies, wave, shimmer, breathing glow, liquid wobble, an eased marquee and a word rotator, picked from one menu.\nPage: https://enrichr.dev/elements/kinetic-type-loops.html\nMachine-readable spec: https://enrichr.dev/elements/kinetic-type-loops.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-loops.mdc so the rule stays with the project:\n---\ndescription: How to use the Enrichr Kinetic type loops 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 loops\" element. Tailwind is available but this component needs no utility classes.\n\nThis is the \"Kinetic type loops\" element from the Enrichr Library: Six looping text studies, wave, shimmer, breathing glow, liquid wobble, an eased marquee and a word rotator, picked from one menu.\nPage: https://enrichr.dev/elements/kinetic-type-loops.html\nMachine-readable spec: https://enrichr.dev/elements/kinetic-type-loops.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-loops.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-loops\"; // markup is the HTML string; mount is the JavaScript's mount function\n\nexport default function KineticTypeLoops(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 loops\" element to this React + Vite + TypeScript + Tailwind project. Do not install any packages.\n\nThis is the \"Kinetic type loops\" element from the Enrichr Library: Six looping text studies, wave, shimmer, breathing glow, liquid wobble, an eased marquee and a word rotator, picked from one menu.\nPage: https://enrichr.dev/elements/kinetic-type-loops.html\nMachine-readable spec: https://enrichr.dev/elements/kinetic-type-loops.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-loops.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/KineticTypeLoops.tsx):\n```tsx\n\"use client\";\nimport { useEffect, useRef } from \"react\";\nimport { markup, mount } from \"./kinetic-type-loops\"; // markup is the HTML string; mount is the JavaScript's mount function\n\nexport default function KineticTypeLoops(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 loops\" element.\n\nThis is the \"Kinetic type loops\" element from the Enrichr Library: Six looping text studies, wave, shimmer, breathing glow, liquid wobble, an eased marquee and a word rotator, picked from one menu.\nPage: https://enrichr.dev/elements/kinetic-type-loops.html\nMachine-readable spec: https://enrichr.dev/elements/kinetic-type-loops.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-loops.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 loops\" element. No packages, no server code.\n\nThis is the \"Kinetic type loops\" element from the Enrichr Library: Six looping text studies, wave, shimmer, breathing glow, liquid wobble, an eased marquee and a word rotator, picked from one menu.\nPage: https://enrichr.dev/elements/kinetic-type-loops.html\nMachine-readable spec: https://enrichr.dev/elements/kinetic-type-loops.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-loops.js and then main.js), style.css (the CSS below), kinetic-type-loops.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 loops\" 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 loops\" element from the Enrichr Library: Six looping text studies, wave, shimmer, breathing glow, liquid wobble, an eased marquee and a word rotator, picked from one menu.\nPage: https://enrichr.dev/elements/kinetic-type-loops.html\nMachine-readable spec: https://enrichr.dev/elements/kinetic-type-loops.json\n\nWhat it does: Every study is a CSS keyframe loop with the original timing. Wave lifts each letter 14 px and back over 1.8 s, each one starting 60 ms after the last. Shimmer clips a 250%-wide gradient (dim, accent, bright, accent, dim) to the letters and slides it across every 3.2 s. Breathing glow swells an accent text-shadow from 4 px to 26 px and back every 2.6 s. Liquid wobble skews and stretches every letter through four poses on a 2.4 s loop. The eased marquee moves three copies of the line 46% of the track and back over 7 s on cubic-bezier(.65,0,.35,1), holding briefly at each end, so it speeds up, coasts and settles. The rotator changes the word every 2.2 s: the old word lifts and fades over 0.5 s, and 0.4 s in the next word is set and shown; because that change interrupts the running transition, the new word settles in from where the old one left, just as in the original. Loops start when about a third of the element is on screen and stop once it has gone; speed divides every duration. In the original pen the wave and liquid letters were never split into spans, so those two plates sat still; here they are split, so their keyframes play as written.\nAccessibility: The line (or, for the rotator, the lead-in and every word) is in the element as visually hidden text, and the animated copy is hidden from screen readers, so nothing is announced on each change. With prefers-reduced-motion every study shows one still frame: the shimmer band centred, a steady glow, the first rotator word. The loops are slow and nothing flashes. No keyboard input is needed.\n\nTunable settings:\n- Study: select (10 Wave / 11 Shimmer sweep / 12 Breathing glow / 13 Liquid wobble / 14 Eased marquee / 15 Kinetic rotator), default wave\n- Text: text, default KEEP IT MOVING\n- Rotator lead-in: text, default DESIGNED FOR\n- Rotator words (comma separated): text, default SPEED, CLARITY, CRAFT, RHYTHM\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 (shimmer band, glow, label): color, default #e6ff55\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-loops.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 loops\" 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 loops\" element from the Enrichr Library: Six looping text studies, wave, shimmer, breathing glow, liquid wobble, an eased marquee and a word rotator, picked from one menu.\nPage: https://enrichr.dev/elements/kinetic-type-loops.html\nMachine-readable spec: https://enrichr.dev/elements/kinetic-type-loops.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 KineticTypeLoops.\n2. Paste the JavaScript below into a separate code file named kinetic-type-loops.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-loops\"; // markup is the HTML string; mount is the JavaScript's mount function\n\nexport default function KineticTypeLoops(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(KineticTypeLoops, {\n  effect: { type: ControlType.Enum, title: \"Study\", options: [\"wave\",\"shimmer\",\"glow\",\"liquid\",\"marquee\",\"rotator\"], optionTitles: [\"10 Wave\",\"11 Shimmer sweep\",\"12 Breathing glow\",\"13 Liquid wobble\",\"14 Eased marquee\",\"15 Kinetic rotator\"], defaultValue: \"wave\" },\n  text: { type: ControlType.String, title: \"Text\", defaultValue: \"KEEP IT MOVING\" },\n  lead: { type: ControlType.String, title: \"Rotator lead-in\", defaultValue: \"DESIGNED FOR\" },\n  words: { type: ControlType.String, title: \"Rotator words (comma separated)\", defaultValue: \"SPEED, CLARITY, CRAFT, RHYTHM\" },\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 (shimmer band, glow, label)\", defaultValue: \"#e6ff55\" },\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 loops\" 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 loops\" element from the Enrichr Library: Six looping text studies, wave, shimmer, breathing glow, liquid wobble, an eased marquee and a word rotator, picked from one menu.\nPage: https://enrichr.dev/elements/kinetic-type-loops.html\nMachine-readable spec: https://enrichr.dev/elements/kinetic-type-loops.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-loops\"></div>, and a <script> block with the JavaScript followed by:\n   mount(document.getElementById(\"enrichr-kinetic-type-loops\"), { ...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 line (or, for the rotator, the lead-in and every word) is in the element as visually hidden text, and the animated copy is hidden from screen readers, so nothing is announced on each change. With prefers-reduced-motion every study shows one still frame: the shimmer band centred, a steady glow, the first rotator word. The loops are slow and nothing flashes. No keyboard input is needed.",
  "performance": "The loops are CSS animations of transform, text-shadow and background-position, so they run without JavaScript per frame. They stop when the element leaves the screen. Only the rotator uses a timer, on a requestAnimationFrame clock that pauses off screen and in hidden tabs.",
  "dependencies": [],
  "codepen": "https://codepen.io/Enrichr-Dev/pen/zxZyLyN",
  "source": {
    "markup": "<div class=\"ef-ktl\" data-fx=\"wave\" data-label=\"1\">\n  <div class=\"ef-ktl__head\">\n    <span class=\"ef-ktl__num\" aria-hidden=\"true\">10</span>\n    <span class=\"ef-ktl__meta\"><span class=\"ef-ktl__name\">Wave</span><span class=\"ef-ktl__desc\">A ripple runs continuously through the baseline.</span></span>\n    <span class=\"ef-ktl__tag\">continuous</span>\n  </div>\n  <div class=\"ef-ktl__stage\"><span class=\"ef-ktl__demo\">KEEP IT MOVING</span></div>\n</div>",
    "css": "/* Enrichr Library · https://enrichr.dev */\n.ef-ktl {\n  --ef-ktl-k: 1; --ef-ktl-size: 42;\n  --ef-ktl-fg: #fbf8f1; --ef-ktl-fg-rgb: 251, 248, 241; --ef-ktl-muted: #9ca39b;\n  --ef-ktl-bg: #0c1e18; --ef-ktl-bg-rgb: 12, 30, 24; --ef-ktl-top: #17281f;\n  --ef-ktl-acc: #e6ff55; --ef-ktl-acc-rgb: 230, 255, 85;\n  --ef-ktl-fs: min(calc(var(--ef-ktl-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-ktl-fg); font-family: 'Instrument Sans', system-ui, sans-serif;\n  background: radial-gradient(ellipse at 50% 120%, rgba(var(--ef-ktl-acc-rgb), .1), transparent 60%), linear-gradient(180deg, var(--ef-ktl-top), var(--ef-ktl-bg));\n  border: 1px solid rgba(var(--ef-ktl-acc-rgb), .2);\n  box-shadow: inset 0 1px 0 rgba(var(--ef-ktl-fg-rgb), .05);\n}\n.ef-ktl *, .ef-ktl *::before, .ef-ktl *::after { box-sizing: border-box; }\n\n/* specimen label */\n.ef-ktl .ef-ktl__head { position: relative; z-index: 2; display: flex; align-items: center; gap: 1rem; padding: 1.1rem 1.25rem 0; }\n.ef-ktl[data-label=\"0\"] .ef-ktl__head { display: none; }\n.ef-ktl .ef-ktl__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-ktl-bg); background: var(--ef-ktl-acc);\n  box-shadow: 0 0 0 1px rgba(var(--ef-ktl-acc-rgb), .4), 0 4px 14px -4px rgba(var(--ef-ktl-acc-rgb), .55);\n}\n.ef-ktl .ef-ktl__meta { display: block; min-width: 0; text-align: left; }\n.ef-ktl .ef-ktl__name { display: block; margin: 0 0 .15rem; font: 600 1.1rem/1.2 'Parkinsans', 'Space Grotesk', sans-serif; letter-spacing: .01em; color: var(--ef-ktl-fg); opacity: 1; }\n.ef-ktl .ef-ktl__desc { display: block; margin: 0; font-size: .84rem; line-height: 1.45; color: var(--ef-ktl-muted); opacity: 1; }\n.ef-ktl .ef-ktl__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-ktl-acc-rgb), .85); border: 1px solid rgba(var(--ef-ktl-acc-rgb), .35); background: rgba(var(--ef-ktl-acc-rgb), .06);\n}\n.ef-ktl.is-narrow .ef-ktl__tag, .ef-ktl.is-narrow .ef-ktl__desc { display: none; }\n\n/* stage and type */\n.ef-ktl .ef-ktl__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-ktl .ef-ktl__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-ktl .ef-ktl__demo {\n  display: inline-block; margin: 0; white-space: pre-wrap; color: var(--ef-ktl-fg); opacity: 1;\n  font-family: 'Parkinsans', 'Space Grotesk', sans-serif; font-weight: 500; font-size: var(--ef-ktl-fs); letter-spacing: .01em; line-height: 1.2;\n}\n.ef-ktl .ef-ktl__demo--small { font-family: 'Fira Code', ui-monospace, monospace; font-size: calc(var(--ef-ktl-fs) * .615); white-space: nowrap; }\n.ef-ktl .ef-ktl__w { display: inline-block; white-space: nowrap; }\n.ef-ktl .ef-ktl__ch { display: inline-block; will-change: transform, opacity, filter; }\n\n/* 10 wave (14px at the default 42px size) */\n.ef-ktl[data-fx=\"wave\"].is-in .ef-ktl__ch { animation: ef-ktl-wave calc(1.8s * var(--ef-ktl-k)) ease-in-out infinite; animation-delay: calc(var(--i) * 60ms * var(--ef-ktl-k)); }\n@keyframes ef-ktl-wave { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-.333em); } }\n\n/* 11 shimmer sweep */\n.ef-ktl[data-fx=\"shimmer\"] .ef-ktl__demo {\n  background: linear-gradient(100deg, var(--ef-ktl-muted) 30%, var(--ef-ktl-acc) 45%, var(--ef-ktl-fg) 50%, var(--ef-ktl-acc) 55%, var(--ef-ktl-muted) 70%);\n  background-size: 250% 100%; -webkit-background-clip: text; background-clip: text; color: transparent;\n}\n.ef-ktl[data-fx=\"shimmer\"].is-in .ef-ktl__demo { animation: ef-ktl-shimmer calc(3.2s * var(--ef-ktl-k)) linear infinite; }\n@keyframes ef-ktl-shimmer { 0% { background-position: 200% 0; } 100% { background-position: -100% 0; } }\n\n/* 12 breathing glow */\n.ef-ktl[data-fx=\"glow\"].is-in .ef-ktl__demo { animation: ef-ktl-glow calc(2.6s * var(--ef-ktl-k)) ease-in-out infinite; }\n@keyframes ef-ktl-glow {\n  0%, 100% { text-shadow: 0 0 4px rgba(var(--ef-ktl-acc-rgb), .15); }\n  50% { text-shadow: 0 0 26px rgba(var(--ef-ktl-acc-rgb), .8), 0 0 6px rgba(var(--ef-ktl-acc-rgb), .55); }\n}\n\n/* 13 liquid wobble */\n.ef-ktl[data-fx=\"liquid\"].is-in .ef-ktl__ch { animation: ef-ktl-liquid calc(2.4s * var(--ef-ktl-k)) ease-in-out infinite; }\n@keyframes ef-ktl-liquid {\n  0%, 100% { transform: skewX(0) scaleY(1); }\n  25% { transform: skewX(-6deg) scaleY(1.08); }\n  50% { transform: skewX(0) scaleY(.94); }\n  75% { transform: skewX(6deg) scaleY(1.05); }\n}\n\n/* 14 eased marquee */\n.ef-ktl[data-fx=\"marquee\"] .ef-ktl__stage { justify-content: flex-start; }\n.ef-ktl .ef-ktl__track { display: inline-flex; gap: 2.5rem; flex-shrink: 0; }\n.ef-ktl[data-fx=\"marquee\"].is-in .ef-ktl__track { animation: ef-ktl-marquee calc(7s * var(--ef-ktl-k)) cubic-bezier(.65, 0, .35, 1) infinite; }\n@keyframes ef-ktl-marquee {\n  0% { transform: translateX(6%); }\n  45% { transform: translateX(-40%); }\n  50% { transform: translateX(-40%); }\n  95% { transform: translateX(6%); }\n  100% { transform: translateX(6%); }\n}\n\n/* 15 kinetic rotator */\n.ef-ktl .ef-ktl__lead { font-size: 1rem; font-family: 'Instrument Sans', system-ui, sans-serif; color: var(--ef-ktl-fg); white-space: nowrap; }\n.ef-ktl .ef-ktl__rot { display: inline-block; transition: transform calc(.5s * var(--ef-ktl-k)) cubic-bezier(.5, 0, .2, 1), opacity calc(.5s * var(--ef-ktl-k)) ease; }\n\n/* off screen and reduced motion */\n.ef-ktl.is-paused * { animation-play-state: paused !important; }\n.ef-ktl.is-reduced *, .ef-ktl.is-reduced *::before, .ef-ktl.is-reduced *::after { transition: none !important; animation: none !important; }\n.ef-ktl.is-reduced[data-fx=\"shimmer\"] .ef-ktl__demo { background-position: 50% 0; }\n.ef-ktl.is-reduced[data-fx=\"glow\"] .ef-ktl__demo { text-shadow: 0 0 14px rgba(var(--ef-ktl-acc-rgb), .45); }\n@media (prefers-reduced-motion: reduce) {\n  .ef-ktl *, .ef-ktl *::before, .ef-ktl *::after { transition: none !important; animation: none !important; }\n}",
    "js": "// Enrichr Library · https://enrichr.dev\n// Kinetic type loops: the six looping studies from a kinetic type specimen book, one at a time (pick it with effect).\n// Wave: each letter bobs 14 px up and back on a 1.8 s sine-like ease-in-out loop, starting 60 ms after the letter before.\n// Shimmer sweep: a 250%-wide gradient (dim, accent, bright, accent, dim) slides across the clipped letters every 3.2 s.\n// Breathing glow: an accent glow swells from 4 px to 26 px and back every 2.6 s. Liquid wobble: every letter skews and\n// stretches through -6 deg / 108%, 94%, +6 deg / 105% on a 2.4 s loop. Eased marquee: three copies of the line glide left\n// 46% of the track and back on a 7 s loop with cubic-bezier(.65,0,.35,1) and a short hold at each end. Kinetic rotator: a\n// lead-in plus a word that changes every 2.2 s; the old word lifts 18 px and fades, the next drops in 0.4 s later.\n// Loops run while the element is in view and stop when it scrolls away; speed scales every duration.\n// Reduced motion shows one still frame of each study (the shimmer band centred, a steady glow, the first rotator word).\n// mount(root, { effect (wave | shimmer | glow | liquid | marquee | rotator), text, lead (rotator lead-in), words (rotator\n//               words, comma separated), speed (1 = original timing), size (px), color, accent, 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-ktl\");\n  var numEl = box.querySelector(\".ef-ktl__num\"), nameEl = box.querySelector(\".ef-ktl__name\");\n  var descEl = box.querySelector(\".ef-ktl__desc\"), tagEl = box.querySelector(\".ef-ktl__tag\");\n  var stage = box.querySelector(\".ef-ktl__stage\");\n  var FX = {\n    wave: [\"10\", \"Wave\", \"A ripple runs continuously through the baseline.\"],\n    shimmer: [\"11\", \"Shimmer sweep\", \"A band of light passes over the letterforms.\"],\n    glow: [\"12\", \"Breathing glow\", \"Light gathers and releases, slow as a held breath.\"],\n    liquid: [\"13\", \"Liquid wobble\", \"Each letter behaves like it's suspended in syrup.\"],\n    marquee: [\"14\", \"Eased marquee\", \"A ticker that accelerates, coasts, and settles, never linear.\"],\n    rotator: [\"15\", \"Kinetic rotator\", \"One role, many words, cycling like a headline.\"]\n  };\n  var opts = {}, fx = \"\", text = \"\", demo = null, rot = null, words = [], idx = 0, inView = false, visible = true;\n  var io = null, ro = null, destroyed = false, timers = [], clock = 0, last = 0, raf = 0, frame = 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 make(tag, cls, txt) { var e = document.createElement(tag); if (cls) e.className = cls; if (txt != null) e.textContent = txt; return e; }\n  function clean(v, d) { return String(v == null ? \"\" : v).replace(/\\s+/g, \" \").trim() || d; }\n\n  // one clock for the rotator's timers: it only runs on screen in a visible tab, 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);\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 after(ms, fn) { var t = { at: clock + ms, every: 0, fn: fn }; timers.push(t); kick(); return t; }\n  function stopTimers() { timers.forEach(function (t) { t.dead = true; }); timers = []; cancelAnimationFrame(frame); }\n\n  function split() {\n    demo.textContent = \"\";\n    var word = null;\n    Array.from(text).forEach(function (ch, i) {\n      if (/\\s/.test(ch)) { word = null; demo.appendChild(document.createTextNode(\" \")); return; }\n      if (!word) { word = make(\"span\", \"ef-ktl__w\"); demo.appendChild(word); }\n      var s = make(\"span\", \"ef-ktl__ch\", ch);\n      s.style.setProperty(\"--i\", i);\n      word.appendChild(s);\n    });\n  }\n\n  // the rotator, step for step as the original: set the word hidden 18 px low, then next frame show it; the browser\n  // retargets the still-running exit transition, so the new word settles from where the old one left (the very first word\n  // rises from 18 px below, because in the original page a layout read commits its hidden state first)\n  function show(first) {\n    rot.textContent = words[idx];\n    rot.style.opacity = 0;\n    rot.style.transform = \"translateY(.429em)\";\n    if (first) void rot.offsetWidth;\n    frame = requestAnimationFrame(function () { rot.style.opacity = 1; rot.style.transform = \"translateY(0)\"; });\n  }\n  function startRotator() {\n    stopTimers();\n    if (!rot) return;\n    idx = 0; show(!reduce);\n    if (reduce) return;\n    every(2200, function () {\n      rot.style.opacity = 0;\n      rot.style.transform = \"translateY(-.429em)\";\n      after(400, function () { idx = (idx + 1) % words.length; show(); });\n    });\n  }\n\n  function build() {\n    stopTimers();\n    fx = FX[opts.effect] ? opts.effect : \"wave\";\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 = \"continuous\";\n    text = clean(opts.text, \"KEEP IT MOVING\");\n    words = String(opts.words || \"\").split(\",\").map(function (w) { return w.trim(); }).filter(Boolean);\n    if (!words.length) words = [\"SPEED\", \"CLARITY\", \"CRAFT\", \"RHYTHM\"];\n    stage.textContent = \"\"; rot = null;\n    var lead = clean(opts.lead, \"\");\n    stage.appendChild(make(\"span\", \"ef-ktl__sr\", fx === \"rotator\" ? (lead ? lead + \" \" : \"\") + words.join(\", \") : text));\n    var holder;\n    if (fx === \"marquee\") {\n      holder = make(\"span\", \"ef-ktl__track\"); holder.setAttribute(\"aria-hidden\", \"true\");\n      for (var i = 0; i < 3; i++) holder.appendChild(make(\"span\", \"ef-ktl__demo ef-ktl__demo--small\", text));\n    } else if (fx === \"rotator\") {\n      holder = make(\"span\"); holder.setAttribute(\"aria-hidden\", \"true\");\n      if (lead) holder.appendChild(make(\"span\", \"ef-ktl__lead\", lead + \" \"));\n      rot = make(\"span\", \"ef-ktl__demo ef-ktl__rot\");\n      holder.appendChild(rot);\n    } else {\n      holder = demo = make(\"span\", \"ef-ktl__demo\"); demo.setAttribute(\"aria-hidden\", \"true\");\n      if (fx === \"wave\" || fx === \"liquid\") split(); else demo.textContent = text;\n    }\n    stage.appendChild(holder);\n    if (reduce) box.classList.add(\"is-reduced\");\n    if (rot) startRotator();\n  }\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-ktl-fg\", \"rgb(\" + fg + \")\"); s.setProperty(\"--ef-ktl-fg-rgb\", fg.join(\",\"));\n    s.setProperty(\"--ef-ktl-bg\", \"rgb(\" + bg + \")\"); s.setProperty(\"--ef-ktl-bg-rgb\", bg.join(\",\"));\n    s.setProperty(\"--ef-ktl-top\", mix(bg, fg, 0.045)); s.setProperty(\"--ef-ktl-muted\", mix(bg, fg, 0.62));\n    s.setProperty(\"--ef-ktl-acc\", \"rgb(\" + ac + \")\"); s.setProperty(\"--ef-ktl-acc-rgb\", ac.join(\",\"));\n    s.setProperty(\"--ef-ktl-k\", String(1 / opts.speed));\n    s.setProperty(\"--ef-ktl-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: \"wave\", text: \"KEEP IT MOVING\", lead: \"DESIGNED FOR\", words: \"SPEED, CLARITY, CRAFT, RHYTHM\", speed: 1, size: 42, color: \"#fbf8f1\", accent: \"#e6ff55\", 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 || prev.lead !== opts.lead || prev.words !== opts.words) build();\n  }\n\n  update(o);\n  // loops start when at least a third of the element is in view (or it fills the screen) and stop once it has left\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)) { inView = true; if (!reduce) box.classList.add(\"is-in\"); }\n        else if (!e.isIntersecting && inView) { inView = false; box.classList.remove(\"is-in\"); }\n        if (visible) kick();\n      });\n    }, { threshold: [0, 0.35] });\n    io.observe(box);\n  } else if (!reduce) box.classList.add(\"is-in\");\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    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}"
  }
}