{
  "id": "wind-scatter-text",
  "kind": "element",
  "title": "Wind scatter text",
  "summary": "A headline whose letters blow away like leaves in the wind as you scroll, tumbling in 3D and fading, then fly back when you scroll up.",
  "url": "https://enrichr.dev/elements/wind-scatter-text.html",
  "section": "text",
  "techniques": [
    "text-animation",
    "scroll-driven",
    "3d-css",
    "stagger"
  ],
  "stack": [
    "Vanilla JS",
    "CSS"
  ],
  "frameworks": [
    "React",
    "Next.js",
    "Vanilla"
  ],
  "mood": [
    "kinetic",
    "editorial"
  ],
  "intents": [
    "text blown away on scroll",
    "letters scatter on scroll animation",
    "wind blown text effect",
    "scroll scrub split text 3d",
    "headline letters fly away scrolling"
  ],
  "status": "tested",
  "params": [
    {
      "key": "text",
      "label": "Text",
      "type": "text",
      "value": "Type flies away, blown by a breeze"
    },
    {
      "key": "autoplay",
      "label": "Autoplay (no scrolling needed)",
      "type": "select",
      "options": [
        [
          "on",
          "On"
        ],
        [
          "off",
          "Off, follow the scroll"
        ]
      ],
      "value": "on"
    },
    {
      "key": "speed",
      "label": "Autoplay speed",
      "type": "range",
      "min": 0.25,
      "max": 3,
      "step": 0.05,
      "value": 1
    },
    {
      "key": "mode",
      "label": "Scroll direction",
      "type": "select",
      "options": [
        [
          "scatter",
          "Scrolling scatters the text"
        ],
        [
          "reveal",
          "Scrolling reveals the text"
        ]
      ],
      "value": "scatter"
    },
    {
      "key": "windAngle",
      "label": "Wind angle (degrees, 0 is right, 90 is up)",
      "type": "range",
      "min": 0,
      "max": 360,
      "step": 1,
      "value": 18
    },
    {
      "key": "windStrength",
      "label": "Wind strength (px)",
      "type": "range",
      "min": 0,
      "max": 1200,
      "step": 10,
      "value": 550
    },
    {
      "key": "scatter",
      "label": "Scatter (px)",
      "type": "range",
      "min": 0,
      "max": 500,
      "step": 5,
      "value": 100
    },
    {
      "key": "maxRotation",
      "label": "Max rotation (degrees)",
      "type": "range",
      "min": 0,
      "max": 1080,
      "step": 10,
      "value": 480
    },
    {
      "key": "stagger",
      "label": "Stagger (spread of start times)",
      "type": "range",
      "min": 0,
      "max": 2,
      "step": 0.05,
      "value": 0.7
    },
    {
      "key": "depth",
      "label": "Depth (px)",
      "type": "range",
      "min": 0,
      "max": 600,
      "step": 10,
      "value": 160
    },
    {
      "key": "order",
      "label": "Order",
      "type": "select",
      "options": [
        [
          "random",
          "Random"
        ],
        [
          "ltr",
          "Left to right"
        ],
        [
          "rtl",
          "Right to left"
        ],
        [
          "outward",
          "Edges first"
        ]
      ],
      "value": "random"
    },
    {
      "key": "randomness",
      "label": "Randomness of the order",
      "type": "range",
      "min": 0,
      "max": 1,
      "step": 0.05,
      "value": 0
    },
    {
      "key": "gustiness",
      "label": "Gustiness (px)",
      "type": "range",
      "min": 0,
      "max": 400,
      "step": 5,
      "value": 0
    },
    {
      "key": "gustFrequency",
      "label": "Gust frequency",
      "type": "range",
      "min": 0,
      "max": 4,
      "step": 0.1,
      "value": 1
    },
    {
      "key": "gustPhaseSpread",
      "label": "Gust phase spread",
      "type": "range",
      "min": 0,
      "max": 1,
      "step": 0.05,
      "value": 1
    },
    {
      "key": "animationDuration",
      "label": "Share of the scroll used",
      "type": "range",
      "min": 0.1,
      "max": 1,
      "step": 0.05,
      "value": 0.6
    },
    {
      "key": "startY",
      "label": "Start when the text top reaches (share of the viewport)",
      "type": "range",
      "min": 0.2,
      "max": 1,
      "step": 0.05,
      "value": 0.5
    },
    {
      "key": "easing",
      "label": "Easing",
      "type": "select",
      "options": [
        [
          "auto",
          "Default (power3)"
        ],
        [
          "none",
          "Linear"
        ],
        [
          "power2.in",
          "Power2 in"
        ],
        [
          "power3.in",
          "Power3 in"
        ],
        [
          "power3.out",
          "Power3 out"
        ],
        [
          "power2.inOut",
          "Power2 in-out"
        ],
        [
          "elastic",
          "Elastic out"
        ]
      ],
      "value": "auto"
    },
    {
      "key": "seed",
      "label": "Random seed",
      "type": "range",
      "min": 1,
      "max": 999,
      "step": 1,
      "value": 42
    },
    {
      "key": "background",
      "label": "Background",
      "type": "color",
      "value": "#fbf8f1"
    },
    {
      "key": "color",
      "label": "Text colour",
      "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 \"Wind scatter text\" element to this project.\n\nThis is the \"Wind scatter text\" element from the Enrichr Library: A headline whose letters blow away like leaves in the wind as you scroll, tumbling in 3D and fading, then fly back when you scroll up.\nPage: https://enrichr.dev/elements/wind-scatter-text.html\nMachine-readable spec: https://enrichr.dev/elements/wind-scatter-text.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/wind-scatter-text.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 \"Wind scatter text\" 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 \"Wind scatter text\" element from the Enrichr Library: A headline whose letters blow away like leaves in the wind as you scroll, tumbling in 3D and fading, then fly back when you scroll up.\nPage: https://enrichr.dev/elements/wind-scatter-text.html\nMachine-readable spec: https://enrichr.dev/elements/wind-scatter-text.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 \"Wind scatter text\" element to this codebase.\n\nThis is the \"Wind scatter text\" element from the Enrichr Library: A headline whose letters blow away like leaves in the wind as you scroll, tumbling in 3D and fading, then fly back when you scroll up.\nPage: https://enrichr.dev/elements/wind-scatter-text.html\nMachine-readable spec: https://enrichr.dev/elements/wind-scatter-text.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-wind-scatter-text.mdc so the rule stays with the project:\n---\ndescription: How to use the Enrichr Wind scatter text 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 \"Wind scatter text\" element. Tailwind is available but this component needs no utility classes.\n\nThis is the \"Wind scatter text\" element from the Enrichr Library: A headline whose letters blow away like leaves in the wind as you scroll, tumbling in 3D and fading, then fly back when you scroll up.\nPage: https://enrichr.dev/elements/wind-scatter-text.html\nMachine-readable spec: https://enrichr.dev/elements/wind-scatter-text.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- wind-scatter-text.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 \"./wind-scatter-text\"; // markup is the HTML string; mount is the JavaScript's mount function\n\nexport default function WindScatterText(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 \"Wind scatter text\" element to this React + Vite + TypeScript + Tailwind project. Do not install any packages.\n\nThis is the \"Wind scatter text\" element from the Enrichr Library: A headline whose letters blow away like leaves in the wind as you scroll, tumbling in 3D and fading, then fly back when you scroll up.\nPage: https://enrichr.dev/elements/wind-scatter-text.html\nMachine-readable spec: https://enrichr.dev/elements/wind-scatter-text.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- wind-scatter-text.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/WindScatterText.tsx):\n```tsx\n\"use client\";\nimport { useEffect, useRef } from \"react\";\nimport { markup, mount } from \"./wind-scatter-text\"; // markup is the HTML string; mount is the JavaScript's mount function\n\nexport default function WindScatterText(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 \"Wind scatter text\" element.\n\nThis is the \"Wind scatter text\" element from the Enrichr Library: A headline whose letters blow away like leaves in the wind as you scroll, tumbling in 3D and fading, then fly back when you scroll up.\nPage: https://enrichr.dev/elements/wind-scatter-text.html\nMachine-readable spec: https://enrichr.dev/elements/wind-scatter-text.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), wind-scatter-text.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 \"Wind scatter text\" element. No packages, no server code.\n\nThis is the \"Wind scatter text\" element from the Enrichr Library: A headline whose letters blow away like leaves in the wind as you scroll, tumbling in 3D and fading, then fly back when you scroll up.\nPage: https://enrichr.dev/elements/wind-scatter-text.html\nMachine-readable spec: https://enrichr.dev/elements/wind-scatter-text.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 wind-scatter-text.js and then main.js), style.css (the CSS below), wind-scatter-text.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 \"Wind scatter text\" 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 \"Wind scatter text\" element from the Enrichr Library: A headline whose letters blow away like leaves in the wind as you scroll, tumbling in 3D and fading, then fly back when you scroll up.\nPage: https://enrichr.dev/elements/wind-scatter-text.html\nMachine-readable spec: https://enrichr.dev/elements/wind-scatter-text.json\n\nWhat it does: The real heading text stays in the page for screen readers, an invisible copy holds its size, and each letter gets an absolutely placed twin measured with the Range API so it sits exactly on its glyph. A seeded random generator (sfc32 seeded by splitmix32, seed 42) gives every letter a start time inside the stagger window, a duration of about one second, a push along the wind angle plus a random sideways scatter, a depth and a turn on all three axes. Each letter eases out on a power3.in curve with perspective 500px, in GSAP's transform order, and fades. Gustiness adds a sine wobble across the wind that is pinned to zero at both ends of the flight. The whole timeline is stretched so the letters finish within the chosen share of the scroll, then scrubbed like a ScrollTrigger with scrub 1: it starts when the text's top reaches half the viewport and ends when its bottom leaves the top, and every change restarts a one second power3.out catch-up, which gives the soft lag. Autoplay drives the same scrub with a virtual scroll that waits, scatters, holds and scrolls back.\nAccessibility: The full sentence stays in the heading as visually hidden text and the moving letters are hidden from screen readers, so it reads normally. With prefers-reduced-motion no letter moves: in autoplay the text stays still, and in scroll mode the heading only fades as you scroll, which is what the original does. Nothing needs keyboard input.\n\nTunable settings:\n- Text: text, default Type flies away, blown by a breeze\n- Autoplay (no scrolling needed): select (On / Off, follow the scroll), default on\n- Autoplay speed: range 0.25 to 3, step 0.05, default 1\n- Scroll direction: select (Scrolling scatters the text / Scrolling reveals the text), default scatter\n- Wind angle (degrees, 0 is right, 90 is up): range 0 to 360, step 1, default 18\n- Wind strength (px): range 0 to 1200, step 10, default 550\n- Scatter (px): range 0 to 500, step 5, default 100\n- Max rotation (degrees): range 0 to 1080, step 10, default 480\n- Stagger (spread of start times): range 0 to 2, step 0.05, default 0.7\n- Depth (px): range 0 to 600, step 10, default 160\n- Order: select (Random / Left to right / Right to left / Edges first), default random\n- Randomness of the order: range 0 to 1, step 0.05, default 0\n- Gustiness (px): range 0 to 400, step 5, default 0\n- Gust frequency: range 0 to 4, step 0.1, default 1\n- Gust phase spread: range 0 to 1, step 0.05, default 1\n- Share of the scroll used: range 0.1 to 1, step 0.05, default 0.6\n- Start when the text top reaches (share of the viewport): range 0.2 to 1, step 0.05, default 0.5\n- Easing: select (Default (power3) / Linear / Power2 in / Power3 in / Power3 out / Power2 in-out / Elastic out), default auto\n- Random seed: range 1 to 999, step 1, default 42\n- Background: color, default #fbf8f1\n- Text colour: 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/wind-scatter-text.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 \"Wind scatter text\" 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 \"Wind scatter text\" element from the Enrichr Library: A headline whose letters blow away like leaves in the wind as you scroll, tumbling in 3D and fading, then fly back when you scroll up.\nPage: https://enrichr.dev/elements/wind-scatter-text.html\nMachine-readable spec: https://enrichr.dev/elements/wind-scatter-text.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 WindScatterText.\n2. Paste the JavaScript below into a separate code file named wind-scatter-text.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 \"./wind-scatter-text\"; // markup is the HTML string; mount is the JavaScript's mount function\n\nexport default function WindScatterText(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(WindScatterText, {\n  text: { type: ControlType.String, title: \"Text\", defaultValue: \"Type flies away, blown by a breeze\" },\n  autoplay: { type: ControlType.Enum, title: \"Autoplay (no scrolling needed)\", options: [\"on\",\"off\"], optionTitles: [\"On\",\"Off, follow the scroll\"], defaultValue: \"on\" },\n  speed: { type: ControlType.Number, title: \"Autoplay speed\", min: 0.25, max: 3, step: 0.05, defaultValue: 1 },\n  mode: { type: ControlType.Enum, title: \"Scroll direction\", options: [\"scatter\",\"reveal\"], optionTitles: [\"Scrolling scatters the text\",\"Scrolling reveals the text\"], defaultValue: \"scatter\" },\n  windAngle: { type: ControlType.Number, title: \"Wind angle\", min: 0, max: 360, step: 1, defaultValue: 18 },\n  windStrength: { type: ControlType.Number, title: \"Wind strength\", min: 0, max: 1200, step: 10, defaultValue: 550 },\n  scatter: { type: ControlType.Number, title: \"Scatter\", min: 0, max: 500, step: 5, defaultValue: 100 },\n  maxRotation: { type: ControlType.Number, title: \"Max rotation\", min: 0, max: 1080, step: 10, defaultValue: 480 },\n  stagger: { type: ControlType.Number, title: \"Stagger\", min: 0, max: 2, step: 0.05, defaultValue: 0.7 },\n  depth: { type: ControlType.Number, title: \"Depth\", min: 0, max: 600, step: 10, defaultValue: 160 },\n  order: { type: ControlType.Enum, title: \"Order\", options: [\"random\",\"ltr\",\"rtl\",\"outward\"], optionTitles: [\"Random\",\"Left to right\",\"Right to left\",\"Edges first\"], defaultValue: \"random\" },\n  randomness: { type: ControlType.Number, title: \"Randomness of the order\", min: 0, max: 1, step: 0.05, defaultValue: 0 },\n  gustiness: { type: ControlType.Number, title: \"Gustiness\", min: 0, max: 400, step: 5, defaultValue: 0 },\n  gustFrequency: { type: ControlType.Number, title: \"Gust frequency\", min: 0, max: 4, step: 0.1, defaultValue: 1 },\n  gustPhaseSpread: { type: ControlType.Number, title: \"Gust phase spread\", min: 0, max: 1, step: 0.05, defaultValue: 1 },\n  animationDuration: { type: ControlType.Number, title: \"Share of the scroll used\", min: 0.1, max: 1, step: 0.05, defaultValue: 0.6 },\n  startY: { type: ControlType.Number, title: \"Start when the text top reaches\", min: 0.2, max: 1, step: 0.05, defaultValue: 0.5 },\n  easing: { type: ControlType.Enum, title: \"Easing\", options: [\"auto\",\"none\",\"power2.in\",\"power3.in\",\"power3.out\",\"power2.inOut\",\"elastic\"], optionTitles: [\"Default (power3)\",\"Linear\",\"Power2 in\",\"Power3 in\",\"Power3 out\",\"Power2 in-out\",\"Elastic out\"], defaultValue: \"auto\" },\n  seed: { type: ControlType.Number, title: \"Random seed\", min: 1, max: 999, step: 1, defaultValue: 42 },\n  background: { type: ControlType.Color, title: \"Background\", defaultValue: \"#fbf8f1\" },\n  color: { type: ControlType.Color, title: \"Text colour\", 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 \"Wind scatter text\" 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 \"Wind scatter text\" element from the Enrichr Library: A headline whose letters blow away like leaves in the wind as you scroll, tumbling in 3D and fading, then fly back when you scroll up.\nPage: https://enrichr.dev/elements/wind-scatter-text.html\nMachine-readable spec: https://enrichr.dev/elements/wind-scatter-text.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-wind-scatter-text\"></div>, and a <script> block with the JavaScript followed by:\n   mount(document.getElementById(\"enrichr-wind-scatter-text\"), { ...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 sentence stays in the heading as visually hidden text and the moving letters are hidden from screen readers, so it reads normally. With prefers-reduced-motion no letter moves: in autoplay the text stays still, and in scroll mode the heading only fades as you scroll, which is what the original does. Nothing needs keyboard input.",
  "performance": "Each letter is one span moved with a CSS transform and opacity, so the browser composites them without layout. A letter is only restyled when its own progress changes, and nothing runs while the scrub is at rest, off screen or in a hidden tab. Letters are measured once after the fonts load and again only when the heading's size changes, with a 200 ms pause like the original.",
  "dependencies": [],
  "codepen": "https://codepen.io/Enrichr-Dev/pen/PwpXBVX",
  "source": {
    "markup": "<div class=\"ef-wst\">\n  <h2 class=\"ef-wst__t\">Type flies away, blown by a breeze</h2>\n</div>",
    "css": "/* Enrichr Library · https://enrichr.dev */\n.ef-wst { position: relative; box-sizing: border-box; width: 100%; height: 100%; min-height: 24rem; display: flex; align-items: center; justify-content: center; padding: 2.5rem 2rem; overflow: hidden; border-radius: 1rem; background: #fbf8f1; color: #0c1e18; container-type: inline-size; }\n.ef-wst .ef-wst__t { position: relative; box-sizing: border-box; width: 100%; max-width: 56.25rem; margin: 0; padding: 0; opacity: 1; color: inherit; font-family: 'Parkinsans', 'Space Grotesk', sans-serif; font-size: clamp(2.25rem, 9cqw, 7.5rem); font-weight: 800; line-height: 0.95; letter-spacing: -0.02em; text-align: left; text-transform: none; }\n.ef-wst .ef-wst__sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }\n.ef-wst .ef-wst__ph { visibility: hidden; pointer-events: none; user-select: none; }\n.ef-wst .ef-wst__ov { position: absolute; top: 0; left: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }\n.ef-wst .ef-wst__c { position: absolute; white-space: nowrap; will-change: transform, opacity; }",
    "js": "// Enrichr Library · https://enrichr.dev\n// Wind scatter text: a headline whose letters are blown away like leaves as you scroll, then fly back when you scroll up.\n// Each letter is measured where it sits (Range API) and given an absolutely placed twin. A seeded random generator (sfc32,\n// seed 42) gives each letter a start time inside the stagger window (random, left to right, right to left or outward), a\n// duration near one second, a push along the wind angle plus a random sideways scatter, a depth, and turns on all three\n// axes; letters ease out with power3.in and fade. Gustiness adds a de-trended sine wobble across the wind. The timeline is\n// scrubbed by scroll exactly like a ScrollTrigger with scrub: 1 (start when the text's top reaches startY of the viewport,\n// end when its bottom leaves the top; each change restarts a one second power3.out catch-up). With autoplay on, a virtual\n// scroll plays the scatter forward and back on a loop so it shows without scrolling. Reduced motion: autoplay shows the\n// still text, scroll mode only fades the text, as in the original. The loop pauses off screen and in hidden tabs.\n// mount(root, { text, autoplay (on | off), speed (autoplay speed), mode (scatter | reveal), windAngle (deg), windStrength (px),\n//               scatter (px), maxRotation (deg), stagger, depth (px), order (random | ltr | rtl | outward), randomness,\n//               gustiness (px), gustFrequency, gustPhaseSpread, animationDuration (share of the scroll), startY (0-1),\n//               easing (auto | none | power2.in | power3.in | power3.out | power2.inOut | elastic), seed, background, color })\nfunction mount(root, o) {\n  var reduce = window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches;\n  var wrap = root.querySelector(\".ef-wst\");\n  var el = root.querySelector(\".ef-wst__t\");\n  var opts = {}, raf = 0, visible = true, io = null, ro = null, destroyed = false, last = 0, resizeTimer = 0;\n  var raw = \"\", sr = null, ph = null, ov = null, chars = [], total = 1, animEnd = 1, built = false;\n  var prog = 0, scrub = null, auto = 0, lastW = 0, lastH = 0, pending = false;\n\n  function num(v, d) { v = Number(v); return isFinite(v) ? v : d; }\n  function clamp01(v) { return Math.max(0, Math.min(1, v)); }\n  function lerp(a, b, t) { return a + (b - a) * t; }\n\n  // ---- the original's seeded random: splitmix32 seeds sfc32, warmed up 12 times ----\n  function sfc32(a, b, c, d) {\n    return function () {\n      a |= 0; b |= 0; c |= 0; d |= 0;\n      var t = (a + b | 0) + d | 0;\n      d = d + 1 | 0;\n      a = b ^ b >>> 9;\n      b = c + (c << 3) | 0;\n      c = c << 21 | c >>> 11;\n      c = c + t | 0;\n      return (t >>> 0) / 4294967296;\n    };\n  }\n  function seededRandom(seed) {\n    var s = seed >>> 0;\n    function splitmix32() {\n      s = s + 0x9e3779b9 | 0;\n      var t = s ^ s >>> 16;\n      t = Math.imul(t, 0x21f0aaad);\n      t = t ^ t >>> 15;\n      t = Math.imul(t, 0x735a2d97);\n      return (t ^ t >>> 15) >>> 0;\n    }\n    var f = sfc32(splitmix32(), splitmix32(), splitmix32(), splitmix32());\n    for (var i = 0; i < 12; i++) f();\n    return f;\n  }\n  var r = seededRandom(42);\n  function rand(min, max) { return min + r() * (max - min); }\n\n  // ---- GSAP eases, same maths ----\n  function elasticOut(a, period) {\n    var p1 = a >= 1 ? a : 1, p2 = (period || 0.3) / (a < 1 ? a : 1), p3 = p2 / (Math.PI * 2) * (Math.asin(1 / p1) || 0);\n    p2 = Math.PI * 2 / p2;\n    return function (p) { return p === 1 ? 1 : p1 * Math.pow(2, -10 * p) * Math.sin((p - p3) * p2) + 1; };\n  }\n  var EASES = {\n    none: function (p) { return p; },\n    \"power2.in\": function (p) { return p * p * p; },\n    \"power3.in\": function (p) { return p * p * p * p; },\n    \"power3.out\": function (p) { return 1 - Math.pow(1 - p, 4); },\n    \"power2.inOut\": function (p) { return p < 0.5 ? Math.pow(p * 2, 3) / 2 : 1 - Math.pow((1 - p) * 2, 3) / 2; },\n    elastic: elasticOut(1, 0.7) // elastic.out(1, 0.7), the reveal example in the original\n  };\n  function power1Out(p) { return 1 - (1 - p) * (1 - p); }\n  function power3Out(p) { return 1 - Math.pow(1 - p, 4); }\n\n  // ---- DOM: hidden real text, an invisible placeholder that keeps the size, and an overlay of letter spans ----\n  function structure() {\n    raw = String(opts.text == null ? \"\" : opts.text).replace(/\\s+/g, \" \").trim();\n    el.textContent = \"\";\n    sr = document.createElement(\"span\"); sr.className = \"ef-wst__sr\"; sr.textContent = raw; el.appendChild(sr);\n    ph = document.createElement(\"span\"); ph.className = \"ef-wst__ph\"; ph.setAttribute(\"aria-hidden\", \"true\"); ph.textContent = raw; el.appendChild(ph);\n    ov = document.createElement(\"span\"); ov.className = \"ef-wst__ov\"; ov.setAttribute(\"aria-hidden\", \"true\"); el.appendChild(ov);\n  }\n  function measure() {\n    ov.textContent = \"\";\n    chars = [];\n    var box = el.getBoundingClientRect(), node = ph.firstChild;\n    if (!node) return;\n    for (var i = 0; i < raw.length; i++) {\n      if (raw[i] === \" \") continue;\n      var range = document.createRange();\n      range.setStart(node, i); range.setEnd(node, i + 1);\n      var q = range.getBoundingClientRect();\n      var s = document.createElement(\"span\");\n      s.className = \"ef-wst__c\";\n      s.textContent = raw[i];\n      s.style.cssText = \"left:\" + (q.left - box.left) + \"px;top:\" + (q.top - box.top) + \"px;width:\" + q.width + \"px;height:\" + q.height + \"px;line-height:\" + q.height + \"px\";\n      ov.appendChild(s);\n      chars.push({ el: s, x: q.left - box.left, last: -1 });\n    }\n    // 0 = leftmost letter on any line, 1 = rightmost, so ordered sweeps work on multi-line text\n    var xMin = Infinity, xMax = -Infinity;\n    chars.forEach(function (c) { xMin = Math.min(xMin, c.x); xMax = Math.max(xMax, c.x); });\n    var xr = (xMax - xMin) || 1;\n    chars.forEach(function (c) { c.nx = (c.x - xMin) / xr; });\n  }\n\n  function charStartTime(c, n, order, stagger, randomness) {\n    if (n <= 1) return 0;\n    var x = c.nx, ordered;\n    switch (order) {\n      case \"ltr\": ordered = x * stagger; break;\n      case \"rtl\": ordered = (1 - x) * stagger; break;\n      case \"outward\": ordered = (1 - Math.abs(x - 0.5) * 2) * stagger; break;\n      default: return rand(0, stagger);\n    }\n    return ordered * (1 - randomness) + rand(0, stagger) * randomness;\n  }\n\n  // ---- the timeline, built exactly like the original's, but stored as numbers to evaluate at any time ----\n  function timeline() {\n    r = seededRandom(Math.round(opts.seed));\n    var reverse = opts.mode === \"reveal\", p = opts;\n    var rad = p.windAngle * Math.PI / 180, windX = Math.cos(rad), windY = -Math.sin(rad), perpX = Math.sin(rad), perpY = Math.cos(rad);\n    var custom = EASES[p.easing] || null;\n    var sharedAmp = p.gustiness > 0 ? rand(0.1, 1.0) * p.gustiness * (r() > 0.5 ? 1 : -1) : 0;\n    var end = 0;\n    chars.forEach(function (c, i) {\n      var startTime = charStartTime(c, chars.length, p.order, p.stagger, p.randomness);\n      var duration = rand(1 - p.randomness * 0.5, 1 + p.randomness * 0.5);\n      var scatterAngle = rand(0, Math.PI * 2), scatterDist = rand(0, p.scatter);\n      var syncPhase = Math.PI * p.gustFrequency * startTime;\n      var indexPhase = i / Math.max(1, chars.length - 1) * Math.PI * 2;\n      var phase = lerp(syncPhase, indexPhase, p.gustPhaseSpread);\n      c.start = startTime; c.dur = duration;\n      c.fx = windX * p.windStrength + Math.cos(scatterAngle) * scatterDist;\n      c.fy = windY * p.windStrength + Math.sin(scatterAngle) * scatterDist;\n      c.fz = rand(-p.depth, p.depth);\n      c.rx = rand(-p.maxRotation, p.maxRotation);\n      c.ry = rand(-p.maxRotation * 0.7, p.maxRotation * 0.7);\n      c.rz = rand(-p.maxRotation * 0.3, p.maxRotation * 0.3);\n      c.gust = p.gustiness > 0;\n      if (c.gust) {\n        var individualAmp = rand(0.1, 1.0) * p.gustiness * (r() > 0.5 ? 1 : -1);\n        c.amp = lerp(sharedAmp, individualAmp, p.gustPhaseSpread);\n        c.phase = phase;\n        c.s0 = Math.sin(phase);\n        c.s1 = Math.sin(Math.PI * p.gustFrequency + phase);\n        c.ease = custom || EASES[\"power3.in\"];\n      } else {\n        c.ease = custom || (reverse ? EASES[\"power3.out\"] : EASES[\"power3.in\"]);\n      }\n      c.last = -1;\n      end = Math.max(end, startTime + duration);\n    });\n    total = end || 1;\n    // the original stretches the timeline so the letters finish within animationDuration of the scroll\n    var ad = p.animationDuration;\n    if (ad > 0 && ad < 1) total = total / ad;\n    animEnd = (end || 1) / total;\n  }\n\n  // ---- render every letter at timeline progress pr ----\n  function render(pr) {\n    var reverse = opts.mode === \"reveal\", T = pr * total, gf = opts.gustFrequency;\n    if (reduce) {\n      // the original's reduced-motion timeline: the whole heading fades over the scroll, letters stay put\n      var e = power1Out(clamp01(pr));\n      el.style.opacity = opts.autoplay === \"on\" ? 1 : reverse ? e : 1 - e;\n      return;\n    }\n    for (var i = 0; i < chars.length; i++) {\n      var c = chars[i], local = clamp01((T - c.start) / c.dur);\n      if (local === c.last) continue; // nothing changed for this letter\n      c.last = local;\n      var t = c.ease(local), x, y, z, rx, ry, rz, op;\n      if (c.gust) {\n        var s = reverse ? 1 - t : t;\n        var g = c.amp * (Math.sin(Math.PI * gf * t + c.phase) - c.s0 - t * (c.s1 - c.s0)); // de-trended: 0 at both ends\n        x = s * c.fx + Math.sin(opts.windAngle * Math.PI / 180) * g;\n        y = s * c.fy + Math.cos(opts.windAngle * Math.PI / 180) * g;\n        z = s * c.fz; rx = c.rx * s; ry = c.ry * s; rz = c.rz * s;\n        op = clamp01((1 - s) / 0.6);\n      } else {\n        var k = reverse ? 1 - t : t; // fromTo(scattered -> natural) on reveal, (natural -> scattered) on scatter\n        x = c.fx * k; y = c.fy * k; z = c.fz * k; rx = c.rx * k; ry = c.ry * k; rz = c.rz * k;\n        op = 1 - k;\n      }\n      // GSAP's transform order: perspective, translate3d, rotate (z), rotateY, rotateX\n      c.el.style.transform = \"perspective(500px) translate3d(\" + x + \"px,\" + y + \"px,\" + z + \"px) rotate(\" + rz + \"deg) rotateY(\" + ry + \"deg) rotateX(\" + rx + \"deg)\";\n      c.el.style.opacity = op;\n    }\n  }\n\n  function build() {\n    if (destroyed) return;\n    structure();\n    el.style.opacity = \"\";\n    if (!reduce) { measure(); timeline(); }\n    else { ph.style.visibility = \"visible\"; ph.setAttribute(\"aria-hidden\", \"true\"); }\n    built = true;\n    render(prog);\n  }\n\n  // ---- scroll progress, like ScrollTrigger: start \"top startY%\", end \"bottom top\" (scatter) or \"top 20%\" (reveal) ----\n  function scrollProgress() {\n    var b = el.getBoundingClientRect(), vh = window.innerHeight || document.documentElement.clientHeight || 1;\n    var start = vh * Math.round(opts.startY * 100) / 100;\n    var endTop = opts.mode === \"reveal\" ? vh * 0.2 : -b.height;\n    return clamp01((start - b.top) / Math.max(1, start - endTop));\n  }\n  // scrub: 1 -> every new target restarts a 1 s power3.out tween from where the progress is now\n  function aim(v, now) {\n    if (scrub ? Math.abs(scrub.to - v) < 1e-6 : Math.abs(prog - v) < 1e-6) return;\n    scrub = { from: prog, to: v, t0: now };\n  }\n  // like ScrollTrigger, scroll events are batched and handled once per frame, after that frame's render\n  function onScroll() { pending = true; }\n\n  // autoplay: a virtual scroll that waits, scatters, holds, and scrolls back, on a loop\n  function autoTarget(dt) {\n    var sp = Math.max(0.05, opts.speed), A = 1.0, R = 2.4, B = 0.8;\n    auto = (auto + dt * sp) % (A + R + B + R);\n    var t = auto, v;\n    if (t < A) v = 0;\n    else if (t < A + R) v = (t - A) / R;\n    else if (t < A + R + B) v = 1;\n    else v = 1 - (t - A - R - B) / R;\n    return v * Math.min(1, animEnd + 0.02);\n  }\n\n  function loop(now) {\n    raf = requestAnimationFrame(loop);\n    var dt = Math.min(0.1, (now - last) / 1000 || 0); last = now;\n    if (!visible || document.hidden || !built) return;\n    // GSAP renders the scrub tween first, then ScrollTrigger restarts it for the new target, so a restarted tween first\n    // moves on the next frame (about 6% of the way per frame while the target keeps moving)\n    if (scrub) {\n      var p = Math.min(1, (now - scrub.t0) / 1000);\n      prog = scrub.from + (scrub.to - scrub.from) * power3Out(p);\n      if (p >= 1) { prog = scrub.to; scrub = null; }\n      render(prog);\n    }\n    if (opts.autoplay === \"on\" && !reduce) aim(autoTarget(dt), now);\n    else if (pending) { pending = false; aim(scrollProgress(), now); }\n  }\n\n  function update(partial) {\n    var prev = opts;\n    opts = Object.assign({ text: \"Type flies away, blown by a breeze\", autoplay: \"on\", speed: 1, mode: \"scatter\", windAngle: 18, windStrength: 550,\n      scatter: 100, maxRotation: 480, stagger: 0.7, depth: 160, order: \"random\", randomness: 0, gustiness: 0, gustFrequency: 1, gustPhaseSpread: 1,\n      animationDuration: 0.6, startY: 0.5, easing: \"auto\", seed: 42, background: \"#fbf8f1\", color: \"#0c1e18\" }, opts, partial || {});\n    [\"speed\", \"windAngle\", \"windStrength\", \"scatter\", \"maxRotation\", \"stagger\", \"depth\", \"randomness\", \"gustiness\", \"gustFrequency\", \"gustPhaseSpread\", \"animationDuration\", \"startY\", \"seed\"].forEach(function (k) {\n      opts[k] = num(opts[k], { speed: 1, windAngle: 18, windStrength: 550, scatter: 100, maxRotation: 480, stagger: 0.7, depth: 160, randomness: 0, gustiness: 0, gustFrequency: 1, gustPhaseSpread: 1, animationDuration: 0.6, startY: 0.5, seed: 42 }[k]);\n    });\n    wrap.style.background = opts.background;\n    wrap.style.color = opts.color;\n    if (destroyed || !built) return;\n    if (opts.text !== prev.text) { build(); }\n    else if (!reduce) { timeline(); render(prog); }\n    if (opts.autoplay !== prev.autoplay) { auto = 0; prog = 0; scrub = null; if (opts.autoplay !== \"on\") prog = scrollProgress(); render(prog); }\n  }\n\n  function start() {\n    if (destroyed) return;\n    build();\n    if (opts.autoplay !== \"on\") { prog = scrollProgress(); render(prog); }\n  }\n\n  update(o);\n  if (document.fonts && document.fonts.ready) {\n    // measure after the fonts land so every letter box uses the right metrics\n    document.fonts.ready.then(start);\n    if (document.fonts.load) document.fonts.load(\"800 64px Parkinsans\").then(function () { if (built && !destroyed) { build(); } }, function () {});\n  } else start();\n  window.addEventListener(\"scroll\", onScroll, { passive: true, capture: true });\n  window.addEventListener(\"resize\", onScroll, { passive: true });\n  if (\"IntersectionObserver\" in window) { io = new IntersectionObserver(function (e) { visible = e[0].isIntersecting; }); io.observe(wrap); }\n  if (\"ResizeObserver\" in window) {\n    ro = new ResizeObserver(function (entries) {\n      var b = entries[0].contentRect;\n      if (b.width === lastW && b.height === lastH) return;\n      lastW = b.width; lastH = b.height;\n      clearTimeout(resizeTimer);\n      resizeTimer = setTimeout(function () { if (built && !destroyed) { build(); onScroll(); } }, 200); // the original's 200 ms debounce\n    });\n    ro.observe(el);\n  }\n  last = performance.now(); raf = requestAnimationFrame(loop);\n  return {\n    update: update,\n    destroy: function () {\n      destroyed = true; cancelAnimationFrame(raf); clearTimeout(resizeTimer);\n      window.removeEventListener(\"scroll\", onScroll, { capture: true });\n      window.removeEventListener(\"resize\", onScroll);\n      if (io) io.disconnect();\n      if (ro) ro.disconnect();\n    }\n  };\n}"
  }
}