{"$schema":"https://ui.shadcn.com/schema/registry-item.json","name":"letters-rising-with-blur-to-sharp-text-animation","type":"registry:component","title":"Letters Rising with Blur to Sharp","description":"Free CSS text animation where each letter rises from below and settles from a soft blur into sharp type. React and plain HTML versions, ready to paste.","dependencies":[],"files":[{"path":"components/we-inc/letters-rising-with-blur-to-sharp-text-animation.tsx","type":"registry:component","content":"import { Fragment, useEffect, useRef } from \"react\";\nimport type { CSSProperties } from \"react\";\n\nconst BUSINESS = \"Halden Street Bakery\";\nconst HEADLINE = \"Bread worth waking up for.\";\nconst COPY = \"Long-fermented sourdough and seeded rye, out of the oven at half six and usually gone by noon on Saturdays.\";\n\nconst CSS = `\n/* Edit these first: colours, and how long one full cycle takes. */\n.rb-root {\n  --rb-bg: #f4eee3;\n  --rb-ink: #1f1a14;\n  --rb-muted: #65584a;\n  --rb-accent: #b0652c;\n  --rb-speed: 7.5s;\n  position: relative;\n  overflow: hidden;\n  box-sizing: border-box;\n  min-height: 480px;\n  display: flex;\n  align-items: center;\n  justify-content: center;\n  padding: 72px 20px;\n  background: var(--rb-bg);\n  color: var(--rb-ink);\n  font-family: \"Inter Tight\", Inter, ui-sans-serif, system-ui, -apple-system, \"Segoe UI\", sans-serif;\n  -webkit-font-smoothing: antialiased;\n}\n.rb-root *, .rb-root *::before, .rb-root *::after { box-sizing: border-box; }\n.rb-inner { position: relative; z-index: 1; width: 100%; max-width: 1040px; }\n.rb-eyebrow { margin: 0 0 22px; font-family: \"Inter Tight\", Inter, ui-sans-serif, system-ui, -apple-system, \"Segoe UI\", sans-serif; font-size: 13px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--rb-muted); }\n.rb-h { margin: 0; font-size: clamp(46px, 8.6vw, 112px); font-weight: 800; line-height: .98; letter-spacing: -.035em; }\n.rb-copy { margin: 28px 0 0; max-width: 34em; font-family: \"Inter Tight\", Inter, ui-sans-serif, system-ui, -apple-system, \"Segoe UI\", sans-serif; font-size: clamp(16px, 1.5vw, 19px); line-height: 1.6; color: var(--rb-muted); }\n.rb-sr { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }\n.rb-w { display: inline-block; white-space: nowrap; }\n.rb-l { display: inline-block; }\n/* Paused while scrolled out of view (the script sets data-paused). */\n.rb-root[data-paused=\"true\"] *, .rb-root[data-paused=\"true\"] *::before, .rb-root[data-paused=\"true\"] *::after { animation-play-state: paused !important; }\n@media (prefers-reduced-motion: reduce) {\n  .rb-root *, .rb-root *::before, .rb-root *::after { animation: none !important; }\n}\n\n.rb-h { max-width: 11em; }\n.rb-l {\n  animation: rb-rise var(--rb-speed) cubic-bezier(.2, .7, .2, 1) infinite both;\n  animation-delay: calc(var(--i) * 28ms); /* gap between letters */\n}\n.rb-eyebrow::before { content: \"\"; display: inline-block; width: 28px; height: 1px; margin-right: 12px; vertical-align: middle; background: var(--rb-accent); }\n@keyframes rb-rise {\n  0% { opacity: 0; transform: translateY(.5em); filter: blur(14px); }\n  12% { opacity: 1; transform: translateY(0); filter: blur(0); }\n  86% { opacity: 1; transform: translateY(0); filter: blur(0); animation-timing-function: cubic-bezier(.6, 0, .8, .3); }\n  97%, 100% { opacity: 0; transform: translateY(-.15em); filter: blur(10px); }\n}\n`;\n\n/** Splits text into words (so lines still wrap) and letters, each letter numbered with --i. */\nfunction Letters({ text }: { text: string }) {\n  let i = 0;\n  return (\n    <span aria-hidden=\"true\">\n      {text.split(\" \").map((word, w) => (\n        <Fragment key={w}>\n          {w > 0 && \" \"}\n          <span className=\"rb-w\">\n            {[...word].map((ch, c) => (\n              <span key={c} className=\"rb-l\" style={{ \"--i\": i++ } as CSSProperties}>\n                {ch}\n              </span>\n            ))}\n          </span>\n        </Fragment>\n      ))}\n    </span>\n  );\n}\n\nexport default function LettersRisingBlurToSharp() {\n  const rootRef = useRef<HTMLElement>(null);\n\n  // Pause the CSS animation while the section is off screen.\n  useEffect(() => {\n    const el = rootRef.current;\n    if (!el || typeof IntersectionObserver === \"undefined\") return;\n    const io = new IntersectionObserver(([entry]) => {\n      el.dataset.paused = entry.isIntersecting ? \"false\" : \"true\";\n    });\n    io.observe(el);\n    return () => io.disconnect();\n  }, []);\n\n  return (\n    <section ref={rootRef} data-paused=\"false\" className=\"rb-root w-full\">\n      <style>{CSS}</style>\n      <div className=\"rb-inner\">\n        <p className=\"rb-eyebrow\">{BUSINESS}</p>\n        <h2 className=\"rb-h\">\n          <span className=\"rb-sr\">{HEADLINE}</span>\n          <Letters text={HEADLINE} />\n        </h2>\n        <p className=\"rb-copy\">{COPY}</p>\n      </div>\n    </section>\n  );\n}\n"}]}
