{
  "id": "kinetic-type-warp",
  "kind": "element",
  "title": "Kinetic type warp",
  "summary": "A giant canvas headline sliced into strips that ripple with scroll speed and swell under the pointer.",
  "url": "https://enrichr.dev/elements/kinetic-type-warp.html",
  "section": "text",
  "techniques": [
    "text-animation",
    "scroll-driven",
    "pointer-interaction"
  ],
  "stack": [
    "Vanilla JS",
    "Canvas 2D"
  ],
  "frameworks": [
    "React",
    "Next.js",
    "Vanilla"
  ],
  "mood": [
    "bold",
    "kinetic",
    "playful"
  ],
  "intents": [
    "warped headline on scroll",
    "wavy distorted text",
    "kinetic typography hero",
    "text that bulges under the cursor",
    "scroll velocity text distortion"
  ],
  "status": "tested",
  "params": [
    {
      "key": "text",
      "label": "Headline",
      "type": "text",
      "value": "Kinetic type"
    },
    {
      "key": "strength",
      "label": "Warp strength",
      "type": "range",
      "min": 0,
      "max": 100,
      "step": 5,
      "value": 60
    },
    {
      "key": "strip",
      "label": "Strip width (px)",
      "type": "range",
      "min": 2,
      "max": 12,
      "step": 1,
      "value": 4
    },
    {
      "key": "manual",
      "label": "Fixed warp % (0 reacts live)",
      "type": "range",
      "min": 0,
      "max": 100,
      "step": 5,
      "value": 0
    },
    {
      "key": "color",
      "label": "Text colour",
      "type": "color",
      "value": "#fbf8f1"
    },
    {
      "key": "accent",
      "label": "Echo colour",
      "type": "color",
      "value": "#e6ff55"
    },
    {
      "key": "background",
      "label": "Background",
      "type": "color",
      "value": "#0c1e18"
    }
  ],
  "license": "Free to use in personal and client projects during the preview. Final licence terms will be published here before any paid tier starts; ask before reselling the code as a collection.",
  "contract": "function mount(root, opts) -> { update(partialOpts), destroy() }; root must contain the element markup",
  "exports": {
    "claude": "Add the \"Kinetic type warp\" element to this project.\n\nThis is the \"Kinetic type warp\" element from the Enrichr Library: A giant canvas headline sliced into strips that ripple with scroll speed and swell under the pointer.\nPage: https://enrichr.dev/elements/kinetic-type-warp.html\nMachine-readable spec: https://enrichr.dev/elements/kinetic-type-warp.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-warp.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 warp\" 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 warp\" element from the Enrichr Library: A giant canvas headline sliced into strips that ripple with scroll speed and swell under the pointer.\nPage: https://enrichr.dev/elements/kinetic-type-warp.html\nMachine-readable spec: https://enrichr.dev/elements/kinetic-type-warp.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 warp\" element to this codebase.\n\nThis is the \"Kinetic type warp\" element from the Enrichr Library: A giant canvas headline sliced into strips that ripple with scroll speed and swell under the pointer.\nPage: https://enrichr.dev/elements/kinetic-type-warp.html\nMachine-readable spec: https://enrichr.dev/elements/kinetic-type-warp.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-warp.mdc so the rule stays with the project:\n---\ndescription: How to use the Enrichr Kinetic type warp 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 warp\" element. Tailwind is available but this component needs no utility classes.\n\nThis is the \"Kinetic type warp\" element from the Enrichr Library: A giant canvas headline sliced into strips that ripple with scroll speed and swell under the pointer.\nPage: https://enrichr.dev/elements/kinetic-type-warp.html\nMachine-readable spec: https://enrichr.dev/elements/kinetic-type-warp.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-warp.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-warp\"; // markup is the HTML string; mount is the JavaScript's mount function\n\nexport default function KineticTypeWarp(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 warp\" element to this React + Vite + TypeScript + Tailwind project. Do not install any packages.\n\nThis is the \"Kinetic type warp\" element from the Enrichr Library: A giant canvas headline sliced into strips that ripple with scroll speed and swell under the pointer.\nPage: https://enrichr.dev/elements/kinetic-type-warp.html\nMachine-readable spec: https://enrichr.dev/elements/kinetic-type-warp.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-warp.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/KineticTypeWarp.tsx):\n```tsx\n\"use client\";\nimport { useEffect, useRef } from \"react\";\nimport { markup, mount } from \"./kinetic-type-warp\"; // markup is the HTML string; mount is the JavaScript's mount function\n\nexport default function KineticTypeWarp(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 warp\" element.\n\nThis is the \"Kinetic type warp\" element from the Enrichr Library: A giant canvas headline sliced into strips that ripple with scroll speed and swell under the pointer.\nPage: https://enrichr.dev/elements/kinetic-type-warp.html\nMachine-readable spec: https://enrichr.dev/elements/kinetic-type-warp.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-warp.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 warp\" element. No packages, no server code.\n\nThis is the \"Kinetic type warp\" element from the Enrichr Library: A giant canvas headline sliced into strips that ripple with scroll speed and swell under the pointer.\nPage: https://enrichr.dev/elements/kinetic-type-warp.html\nMachine-readable spec: https://enrichr.dev/elements/kinetic-type-warp.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-warp.js and then main.js), style.css (the CSS below), kinetic-type-warp.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 warp\" 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 warp\" element from the Enrichr Library: A giant canvas headline sliced into strips that ripple with scroll speed and swell under the pointer.\nPage: https://enrichr.dev/elements/kinetic-type-warp.html\nMachine-readable spec: https://enrichr.dev/elements/kinetic-type-warp.json\n\nWhat it does: The headline is fitted to the box and drawn once to an off-screen canvas, in your colour and again in the echo colour. Every frame the visible canvas is rebuilt by copying that picture in thin vertical strips. Each strip is shifted up or down by a sine wave whose size follows an energy value, and strips near the pointer are stretched taller to make a bulge. Energy comes from scroll speed read off window.scrollY and from how fast the pointer moves, and it eases back to a gentle idle ripple. The echo copy is drawn first and slightly out of phase, which gives a coloured shadow while the type is moving.\nAccessibility: The canvas is hidden from assistive technology and the headline is also present as real text for screen readers. With prefers-reduced-motion the canvas is removed and the headline shows as ordinary styled text, with no warp. Keep the text and background contrast high, because the strips briefly stretch the letters.\n\nTunable settings:\n- Headline: text, default Kinetic type\n- Warp strength: range 0 to 100, step 5, default 60\n- Strip width (px): range 2 to 12, step 1, default 4\n- Fixed warp % (0 reacts live): range 0 to 100, step 5, default 0\n- Text colour: color, default #fbf8f1\n- Echo colour: color, default #e6ff55\n- Background: color, default #0c1e18\n\nCurrent settings:\n{{SETTINGS}}\n\nFor the developer: Element contract (vanilla JavaScript, no dependencies):\n- The JavaScript defines a function mount(root, opts).\n- root is an empty container element. Set root.innerHTML to the markup first, then call mount(root, opts).\n- It returns an object with update(partialOpts) and destroy(). Call destroy() when the element is removed. Some elements also return replay().\n- The CSS classes all start with \"ef-\" so they will not collide with your styles.\n\nIn Figma:\n- Draw the resting state as a frame and the end state as a second frame; link them with Smart Animate to show the motion in a prototype.\n- Put the settings above in the frame's notes or Dev Mode annotations so the developer matches them.\n- Link https://enrichr.dev/elements/kinetic-type-warp.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 warp\" 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 warp\" element from the Enrichr Library: A giant canvas headline sliced into strips that ripple with scroll speed and swell under the pointer.\nPage: https://enrichr.dev/elements/kinetic-type-warp.html\nMachine-readable spec: https://enrichr.dev/elements/kinetic-type-warp.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 KineticTypeWarp.\n2. Paste the JavaScript below into a separate code file named kinetic-type-warp.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-warp\"; // markup is the HTML string; mount is the JavaScript's mount function\n\nexport default function KineticTypeWarp(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(KineticTypeWarp, {\n  text: { type: ControlType.String, title: \"Headline\", defaultValue: \"Kinetic type\" },\n  strength: { type: ControlType.Number, title: \"Warp strength\", min: 0, max: 100, step: 5, defaultValue: 60 },\n  strip: { type: ControlType.Number, title: \"Strip width\", min: 2, max: 12, step: 1, defaultValue: 4 },\n  manual: { type: ControlType.Number, title: \"Fixed warp %\", min: 0, max: 100, step: 5, defaultValue: 0 },\n  color: { type: ControlType.Color, title: \"Text colour\", defaultValue: \"#fbf8f1\" },\n  accent: { type: ControlType.Color, title: \"Echo colour\", defaultValue: \"#e6ff55\" },\n  background: { type: ControlType.Color, title: \"Background\", defaultValue: \"#0c1e18\" },\n})\n```\n4. Keep the behaviour of the source unchanged. Do not add dependencies. Respect prefers-reduced-motion. Keep text as real HTML.\n\nSettings:\n{{SETTINGS}}\n\nSource:\n{{CODE}}",
    "webflow": "Add the \"Kinetic type warp\" 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 warp\" element from the Enrichr Library: A giant canvas headline sliced into strips that ripple with scroll speed and swell under the pointer.\nPage: https://enrichr.dev/elements/kinetic-type-warp.html\nMachine-readable spec: https://enrichr.dev/elements/kinetic-type-warp.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-warp\"></div>, and a <script> block with the JavaScript followed by:\n   mount(document.getElementById(\"enrichr-kinetic-type-warp\"), { ...your settings... });\n   (set the container's innerHTML to the markup first, as in the contract).\n2. Embed elements have a size limit (check Webflow's current number). If the code is longer, host the JS and CSS as files and link them from Custom code in the page settings, then keep only the container and the mount call in the Embed.\n3. Keep the behaviour of the source unchanged. Do not add dependencies. Respect prefers-reduced-motion. Keep text as real HTML.\n\nSettings:\n{{SETTINGS}}\n\nSource:\n{{CODE}}"
  },
  "exportTools": [
    "claude",
    "chatgpt",
    "cursor",
    "v0",
    "lovable",
    "bolt",
    "replit",
    "figma",
    "framer",
    "webflow"
  ],
  "accessibility": "The canvas is hidden from assistive technology and the headline is also present as real text for screen readers. With prefers-reduced-motion the canvas is removed and the headline shows as ordinary styled text, with no warp. Keep the text and background contrast high, because the strips briefly stretch the letters.",
  "performance": "One 2D canvas, redrawn each frame while on screen and paused when off screen. A 1200 px wide block at 4 px strips is about 300 small image copies per frame, which is light. Larger strips are cheaper, and the canvas resolution is capped at 2x.",
  "dependencies": [],
  "source": {
    "markup": "<div class=\"ef-ktw\"><span class=\"ef-ktw__txt\"></span><canvas class=\"ef-ktw__c\" aria-hidden=\"true\"></canvas></div>",
    "css": "/* Enrichr Library · https://enrichr.dev */\n.ef-ktw { position: relative; width: 100%; min-height: 18rem; overflow: hidden; background: var(--ef-ktw-bg, #0c1e18); color: var(--ef-ktw-fg, #fbf8f1); font-family: \"Helvetica Neue\", Arial, \"Segoe UI\", system-ui, sans-serif; }\n.ef-ktw__c { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: pan-y; }\n.ef-ktw__txt { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }\n.ef-ktw--plain .ef-ktw__txt { inset: 0; width: auto; height: auto; clip-path: none; white-space: normal; display: flex; align-items: center; justify-content: center; padding: 1rem; text-align: center; font-size: clamp(2.6rem, 14vw, 9rem); font-weight: 900; line-height: 0.95; letter-spacing: -0.04em; text-transform: uppercase; overflow-wrap: anywhere; }\n.ef-ktw--plain .ef-ktw__c { display: none; }\n@media (prefers-reduced-motion: reduce) { .ef-ktw__c { display: none; } .ef-ktw__txt { inset: 0; width: auto; height: auto; clip-path: none; white-space: normal; display: flex; align-items: center; justify-content: center; padding: 1rem; text-align: center; font-size: clamp(2.6rem, 14vw, 9rem); font-weight: 900; line-height: 0.95; letter-spacing: -0.04em; text-transform: uppercase; overflow-wrap: anywhere; } }",
    "js": "// Enrichr Library · https://enrichr.dev\n// Kinetic type warp: a giant headline drawn to a canvas and re-drawn as thin vertical strips. Scroll speed and pointer speed\n// feed a sine wave that ripples the strips up and down, and the pointer adds a bulge that swells the letters under it.\n// It reads window.scrollY itself, so it works with native scroll or any smooth-scroll library. With reduced motion it is plain text.\n// mount(root, { text, strength (0-100), strip (strip width px), manual (0 = live, 1-100 = fixed warp %), color, accent, background })\nfunction mount(root, o) {\n  var reduce = window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches;\n  var box = root.querySelector(\".ef-ktw\");\n  var canvas = root.querySelector(\".ef-ktw__c\");\n  var label = root.querySelector(\".ef-ktw__txt\");\n  var ctx = canvas.getContext(\"2d\");\n  var tex = document.createElement(\"canvas\"), ghost = document.createElement(\"canvas\");\n  var FONT = \"Helvetica Neue, Arial, Segoe UI, system-ui, sans-serif\";\n  var opts = {}, raf = 0, visible = true, io = null, ro = null;\n  var lastT = 0, lastY = window.scrollY, energy = 0, phase = 0, dir = 1, dpr = 1;\n  var px = 0.5, tx = 0.5, bulge = 0, bulgeT = 0, pvx = 0, plastX = null, plastT = 0, idle = 0;\n\n  function plan(c, text, w, h) {\n    var words = text.trim().split(/\\s+/);\n    function fit(ls) {\n      c.font = \"900 100px \" + FONT;\n      var mw = 0;\n      ls.forEach(function (l) { mw = Math.max(mw, c.measureText(l.toUpperCase()).width); });\n      return { ls: ls, size: Math.min(100 * (w * 0.94) / (mw || 1), (h * 0.72) / (ls.length * 0.9)) };\n    }\n    var best = fit([words.join(\" \")]);\n    for (var i = 1; i < words.length; i++) {\n      var cand = fit([words.slice(0, i).join(\" \"), words.slice(i).join(\" \")]);\n      if (cand.size > best.size * 1.05) best = cand;\n    }\n    return best;\n  }\n  function paintTex(t, color, w, h, p) {\n    t.width = w; t.height = h;\n    var c = t.getContext(\"2d\");\n    c.fillStyle = color;\n    c.textAlign = \"center\"; c.textBaseline = \"middle\";\n    c.font = \"900 \" + p.size.toFixed(1) + \"px \" + FONT;\n    if (\"letterSpacing\" in c) c.letterSpacing = (-p.size * 0.03).toFixed(1) + \"px\";\n    var lh = p.size * 0.9, y0 = h / 2 - (p.ls.length - 1) * lh / 2;\n    p.ls.forEach(function (l, i) { c.fillText(l.toUpperCase(), w / 2, y0 + i * lh + p.size * 0.03); });\n  }\n  function build() {\n    var r = box.getBoundingClientRect();\n    dpr = Math.min(2, window.devicePixelRatio || 1);\n    var w = Math.max(40, Math.round(r.width * dpr)), h = Math.max(40, Math.round(r.height * dpr));\n    canvas.width = w; canvas.height = h;\n    var p = plan(ctx, opts.text, w, h);\n    paintTex(tex, opts.color, w, h, p);\n    paintTex(ghost, opts.accent, w, h, p);\n    draw();\n  }\n  function draw() {\n    var cw = canvas.width, ch = canvas.height, sw = Math.max(2, Math.round(opts.strip * dpr));\n    ctx.clearRect(0, 0, cw, ch);\n    var amp = energy * (opts.strength / 100), bAmt = bulge * (0.1 + 0.25 * opts.strength / 100);\n    var freq = 2.2 + energy * 1.6;\n    function pass(src, alpha, off) {\n      ctx.globalAlpha = alpha;\n      for (var x = 0; x < cw; x += sw) {\n        var nx = x / cw;\n        var wv = Math.sin(nx * freq * 6.2832 + phase + off) * amp;\n        var d = (nx - px) / 0.2;\n        var dh = ch * (1 + bAmt * Math.exp(-d * d));\n        ctx.drawImage(src, x, 0, sw, ch, x, (ch - dh) / 2 + wv * ch * 0.16, sw + 0.5, dh);\n      }\n    }\n    if (amp > 0.04) pass(ghost, Math.min(0.75, amp * 1.1), 0.7);\n    pass(tex, 1, 0);\n    ctx.globalAlpha = 1;\n  }\n  function tick(t) {\n    raf = requestAnimationFrame(tick);\n    var dt = Math.min(0.05, Math.max(0.001, (t - lastT) / 1000)); lastT = t;\n    var y = window.scrollY, sv = (y - lastY) / dt; lastY = y;\n    if (!visible) return;\n    var target;\n    if (opts.manual > 0) { target = opts.manual / 100; bulgeT = 0.7; tx = 0.5; }\n    else {\n      idle += dt;\n      target = Math.max(Math.min(1, Math.abs(sv) / 2400), Math.min(1, Math.abs(pvx) / 2.5) * 0.85, 0.07 + 0.04 * Math.sin(idle * 0.9));\n      if (Math.abs(sv) > 40) dir = sv > 0 ? 1 : -1;\n      pvx *= 0.9;\n    }\n    energy += (target - energy) * 0.12;\n    px += (tx - px) * 0.14; bulge += (bulgeT - bulge) * 0.1;\n    phase += dir * dt * (1.2 + energy * 9);\n    draw();\n  }\n  function move(e) {\n    var r = box.getBoundingClientRect(), now = performance.now(), nx = (e.clientX - r.left) / r.width;\n    if (plastX !== null && now > plastT) pvx = (nx - plastX) / ((now - plastT) / 1000);\n    plastX = nx; plastT = now; tx = Math.min(1, Math.max(0, nx));\n    if (Math.abs(pvx) > 0.05) dir = pvx > 0 ? 1 : -1;\n    bulgeT = 1;\n  }\n  function leave() { bulgeT = 0; plastX = null; tx = 0.5; }\n  function update(next) {\n    opts = Object.assign({ text: \"Kinetic type\", strength: 60, strip: 4, manual: 0, color: \"#fbf8f1\", accent: \"#e6ff55\", background: \"#0c1e18\" }, opts, next || {});\n    [\"strength\", \"strip\", \"manual\"].forEach(function (k) { opts[k] = Number(opts[k]); });\n    box.style.setProperty(\"--ef-ktw-bg\", opts.background);\n    box.style.setProperty(\"--ef-ktw-fg\", opts.color);\n    label.textContent = opts.text;\n    if (!reduce) build();\n  }\n  update(o);\n  if (reduce) { box.classList.add(\"ef-ktw--plain\"); return { update: update, destroy: function () {} }; }\n  box.addEventListener(\"pointermove\", move);\n  box.addEventListener(\"pointerleave\", leave);\n  if (\"ResizeObserver\" in window) { ro = new ResizeObserver(function () { build(); }); ro.observe(box); }\n  if (\"IntersectionObserver\" in window) { io = new IntersectionObserver(function (e) { visible = e[0].isIntersecting; }); io.observe(box); }\n  raf = requestAnimationFrame(tick);\n  return { update: update, destroy: function () {\n    cancelAnimationFrame(raf); if (io) io.disconnect(); if (ro) ro.disconnect();\n    box.removeEventListener(\"pointermove\", move); box.removeEventListener(\"pointerleave\", leave);\n  } };\n}"
  }
}