{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "motion-logo-lens",
  "type": "registry:component",
  "title": "Motion Logo Lens",
  "description": "An endless customer logo loop on a gentle arc with faded edges, where the logo passing the center grows under a lens and takes the accent color. A caption under the lens names the customer and their result.",
  "author": "Hyperblur <hello@hyperblur.dev>",
  "dependencies": [],
  "registryDependencies": [],
  "categories": [
    "motion",
    "logos",
    "marquee",
    "loop",
    "social proof",
    "customers",
    "lens"
  ],
  "docs": "https://hyperblur.dev/effects/motion-logo-lens",
  "files": [
    {
      "path": "registry/hyperblur/motion-logo-lens.tsx",
      "type": "registry:component",
      "target": "components/hyperblur/motion-logo-lens.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\n\nexport interface MotionLogoLensItem {\n  name: string;\n  note: string;\n  glyph?: number;\n}\n\nexport interface MotionLogoLensProps extends Omit<React.HTMLAttributes<HTMLDivElement>, \"onChange\"> {\n  logos?: MotionLogoLensItem[];\n  label?: string;\n  speed?: number;\n  arc?: number;\n  magnify?: number;\n  pauseOnHover?: boolean;\n  accent?: string;\n  progress?: number;\n  autoPlay?: boolean;\n  onFocusChange?: (index: number) => void;\n}\n\nconst defaultLogos: MotionLogoLensItem[] = [\n  { name: \"Northwind\", note: \"2,400 seats since 2025\", glyph: 0 },\n  { name: \"Quillr\", note: \"Cut review time by 41%\", glyph: 1 },\n  { name: \"Halden\", note: \"Runs 18 regional teams\", glyph: 2 },\n  { name: \"Orbitly\", note: \"Migrated in one weekend\", glyph: 3 },\n  { name: \"Fennec\", note: \"Ships twice a day\", glyph: 4 },\n  { name: \"Lumen&Co\", note: \"Saved $310k in year one\", glyph: 5 },\n  { name: \"Parcelo\", note: \"99.98% on-time builds\", glyph: 6 },\n  { name: \"Brightline\", note: \"From 3 tools down to 1\", glyph: 7 },\n];\n\nconst css = `\n.hb-wh8 {\n  --hb-wh8-a: #2f7bff;\n  position: relative;\n  width: 100%;\n  color: #ededed;\n  font-family: inherit;\n  container-type: inline-size;\n  padding: clamp(10px, 3cqw, 32px) 0 clamp(8px, 2.4cqw, 26px);\n}\n.hb-wh8 *, .hb-wh8 *::before, .hb-wh8 *::after { box-sizing: border-box; }\n.hb-wh8-label {\n  margin: 0 0 clamp(4px, 1.4cqw, 16px);\n  text-align: center;\n  font-family: var(--font-mono, ui-monospace, monospace);\n  font-size: clamp(8px, 1.3cqw, 12px);\n  letter-spacing: 0.18em;\n  text-transform: uppercase;\n  color: #7a7a7a;\n}\n.hb-wh8-track {\n  position: relative;\n  height: clamp(66px, 15cqw, 150px);\n  overflow: hidden;\n  -webkit-mask-image: linear-gradient(90deg, transparent 0%, rgba(0, 0, 0, 0.35) 10%, #000 34%, #000 66%, rgba(0, 0, 0, 0.35) 90%, transparent 100%);\n  mask-image: linear-gradient(90deg, transparent 0%, rgba(0, 0, 0, 0.35) 10%, #000 34%, #000 66%, rgba(0, 0, 0, 0.35) 90%, transparent 100%);\n}\n.hb-wh8-list { margin: 0; padding: 0; list-style: none; }\n.hb-wh8-li { display: contents; }\n.hb-wh8-lens {\n  position: absolute;\n  left: 50%;\n  top: 50%;\n  width: clamp(70px, 17cqw, 170px);\n  aspect-ratio: 1;\n  border-radius: 50%;\n  transform: translate(-50%, -54%);\n  background: radial-gradient(closest-side, color-mix(in srgb, var(--hb-wh8-a) 16%, transparent), transparent 75%);\n  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--hb-wh8-a) 28%, transparent);\n  pointer-events: none;\n}\n.hb-wh8-lens::before, .hb-wh8-lens::after {\n  content: \"\";\n  position: absolute;\n  left: 50%;\n  width: 1px;\n  height: 8%;\n  background: color-mix(in srgb, var(--hb-wh8-a) 70%, #fff);\n}\n.hb-wh8-lens::before { top: -4%; }\n.hb-wh8-lens::after { bottom: -4%; }\n.hb-wh8-item {\n  --k: 0;\n  position: absolute;\n  left: 0;\n  top: 50%;\n  display: inline-flex;\n  align-items: center;\n  gap: 0.45em;\n  font-family: var(--font-grotesk, var(--font-sans, system-ui));\n  font-size: clamp(11px, 2.1cqw, 21px);\n  font-weight: 600;\n  letter-spacing: -0.02em;\n  white-space: nowrap;\n  color: color-mix(in srgb, #ffffff calc(var(--k) * 100%), #6a6a6a);\n  will-change: transform;\n}\n.hb-wh8-item svg {\n  width: 1.35em;\n  height: 1.35em;\n  flex: none;\n  color: color-mix(in srgb, var(--hb-wh8-a) calc(var(--k) * 100%), #5a5a5a);\n}\n.hb-wh8-cap {\n  display: flex;\n  flex-direction: column;\n  align-items: center;\n  gap: 0.2em;\n  margin-top: clamp(2px, 1cqw, 12px);\n  min-height: 2.6em;\n  text-align: center;\n}\n.hb-wh8-cap b {\n  font-size: clamp(10px, 1.6cqw, 16px);\n  font-weight: 600;\n  color: #f2f2f2;\n  animation: hb-wh8-in 0.45s cubic-bezier(0.22, 1, 0.36, 1);\n}\n.hb-wh8-cap span {\n  font-size: clamp(9px, 1.35cqw, 14px);\n  color: #9a9a9a;\n  animation: hb-wh8-in 0.55s cubic-bezier(0.22, 1, 0.36, 1);\n}\n@keyframes hb-wh8-in { from { opacity: 0; transform: translateY(5px); filter: blur(3px); } to { opacity: 1; transform: none; filter: none; } }\n@media (prefers-reduced-motion: reduce) {\n  .hb-wh8-cap b, .hb-wh8-cap span { animation: none; }\n  .hb-wh8-item { will-change: auto; }\n}\n`;\n\nfunction Glyph({ kind }: { kind: number }) {\n  const k = ((kind % 8) + 8) % 8;\n  return (\n    <svg viewBox=\"0 0 24 24\" aria-hidden=\"true\">\n      {k === 0 ? <path d=\"M12 2 22 12 12 22 2 12Z M12 7 7 12l5 5 5-5Z\" fill=\"currentColor\" fillRule=\"evenodd\" /> : null}\n      {k === 1 ? <path d=\"M4 20c0-9 7-16 16-16-1 9-7 16-16 16Zm4-3c4-1 7-4 8-8\" fill=\"currentColor\" /> : null}\n      {k === 2 ? (\n        <g fill=\"currentColor\">\n          <rect x=\"3\" y=\"3\" width=\"8\" height=\"8\" rx=\"2\" />\n          <rect x=\"13\" y=\"3\" width=\"8\" height=\"8\" rx=\"4\" />\n          <rect x=\"3\" y=\"13\" width=\"8\" height=\"8\" rx=\"4\" />\n          <rect x=\"13\" y=\"13\" width=\"8\" height=\"8\" rx=\"2\" />\n        </g>\n      ) : null}\n      {k === 3 ? (\n        <g fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2.4\">\n          <circle cx=\"12\" cy=\"12\" r=\"4\" fill=\"currentColor\" stroke=\"none\" />\n          <ellipse cx=\"12\" cy=\"12\" rx=\"10\" ry=\"4.5\" transform=\"rotate(-25 12 12)\" />\n        </g>\n      ) : null}\n      {k === 4 ? <path d=\"M3 20 8 4l4 9 4-9 5 16h-4l-1-4-4 4-4-4-1 4Z\" fill=\"currentColor\" /> : null}\n      {k === 5 ? (\n        <g fill=\"currentColor\">\n          <circle cx=\"9\" cy=\"12\" r=\"7\" />\n          <circle cx=\"17\" cy=\"12\" r=\"5\" opacity=\"0.55\" />\n        </g>\n      ) : null}\n      {k === 6 ? <path d=\"M12 2 21 7v10l-9 5-9-5V7Zm0 4.3L7 9v6l5 2.8 5-2.8V9Z\" fill=\"currentColor\" fillRule=\"evenodd\" /> : null}\n      {k === 7 ? (\n        <g fill=\"currentColor\">\n          <rect x=\"3\" y=\"15\" width=\"4\" height=\"6\" rx=\"1\" />\n          <rect x=\"10\" y=\"9\" width=\"4\" height=\"12\" rx=\"1\" />\n          <rect x=\"17\" y=\"3\" width=\"4\" height=\"18\" rx=\"1\" />\n        </g>\n      ) : null}\n    </svg>\n  );\n}\n\nfunction clamp01(x: number) {\n  return Math.min(1, Math.max(0, x));\n}\n\nfunction findScroller(el: HTMLElement): HTMLElement | null {\n  let node = el.parentElement;\n  while (node && node !== document.body && node !== document.documentElement) {\n    const oy = getComputedStyle(node).overflowY;\n    if ((oy === \"auto\" || oy === \"scroll\" || oy === \"overlay\") && node.scrollHeight > node.clientHeight + 1) return node;\n    node = node.parentElement;\n  }\n  return null;\n}\n\nfunction layout(width: number, count: number) {\n  const gap = Math.min(220, Math.max(112, width / 4.6));\n  const copies = Math.max(1, Math.ceil((width + gap * 3) / (count * gap)));\n  return { gap, copies, total: count * copies * gap };\n}\n\nfunction place(i: number, offset: number, width: number, gap: number, total: number, arc: number, magnify: number) {\n  const raw = (((i * gap - offset) % total) + total) % total;\n  const x = raw - gap;\n  const c = width / 2;\n  const dx = x - c;\n  const prox = clamp01(1 - Math.abs(dx) / (gap * 1.25));\n  const e = prox * prox * (3 - 2 * prox);\n  const edge = Math.min(1, Math.abs(dx) / (width / 2 || 1));\n  const y = edge * edge * arc - e * arc * 0.35;\n  const s = 1 + e * magnify;\n  return { x, y, s, e };\n}\n\nexport function MotionLogoLens({\n  logos = defaultLogos,\n  label = \"Trusted by product teams at\",\n  speed = 46,\n  arc = 18,\n  magnify = 0.6,\n  pauseOnHover = true,\n  accent = \"#2f7bff\",\n  progress,\n  autoPlay = true,\n  onFocusChange,\n  className,\n  style,\n  ...rest\n}: MotionLogoLensProps) {\n  const ref = React.useRef<HTMLDivElement>(null);\n  const trackRef = React.useRef<HTMLDivElement>(null);\n  const items = React.useRef<(HTMLSpanElement | null)[]>([]);\n  const [width, setWidth] = React.useState(1000);\n  const [focus, setFocus] = React.useState(0);\n  const progressRef = React.useRef(progress);\n  const offsetRef = React.useRef(0);\n  const focusCb = React.useRef(onFocusChange);\n  const n = Math.max(1, logos.length);\n  const { gap, copies, total } = layout(width, n);\n  const controlled = typeof progress === \"number\";\n\n  React.useEffect(() => {\n    progressRef.current = progress;\n    focusCb.current = onFocusChange;\n  });\n\n  React.useEffect(() => {\n    const el = trackRef.current;\n    if (!el) return;\n    const ro = new ResizeObserver(() => {\n      const w = Math.round(el.clientWidth);\n      if (w > 0) setWidth((old) => (old === w ? old : w));\n    });\n    ro.observe(el);\n    return () => ro.disconnect();\n  }, []);\n\n  React.useEffect(() => {\n    const root = ref.current;\n    if (!root) return;\n    const count = n * copies;\n    let shown = -1;\n    const draw = (offset: number) => {\n      let best = -1;\n      let bestE = -1;\n      for (let i = 0; i < count; i++) {\n        const node = items.current[i];\n        if (!node) continue;\n        const { x, y, s, e } = place(i, offset, width, gap, total, arc, magnify);\n        node.style.transform = `translate3d(${x.toFixed(1)}px, ${y.toFixed(1)}px, 0) translate(-50%, -50%) scale(${s.toFixed(3)})`;\n        node.style.setProperty(\"--k\", e.toFixed(3));\n        node.style.zIndex = e > 0.01 ? \"2\" : \"1\";\n        if (e > bestE) {\n          bestE = e;\n          best = i % n;\n        }\n      }\n      if (best !== shown && best >= 0) {\n        shown = best;\n        setFocus(best);\n        focusCb.current?.(best);\n      }\n    };\n    const reduce = window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches;\n    if (controlled) {\n      draw((progressRef.current ?? 0) * n * gap);\n      return;\n    }\n    if (reduce) {\n      draw(0);\n      return;\n    }\n    let raf = 0;\n    let last = 0;\n    let offset = offsetRef.current;\n    let target = 0;\n    let hover = false;\n    let visible = true;\n    let rate = 1;\n    const sc = autoPlay ? null : findScroller(root);\n    const io = new IntersectionObserver((entries) => {\n      visible = entries[0]?.isIntersecting ?? true;\n    });\n    io.observe(root);\n    const enter = () => {\n      hover = true;\n    };\n    const leave = () => {\n      hover = false;\n    };\n    if (pauseOnHover) {\n      root.addEventListener(\"pointerenter\", enter);\n      root.addEventListener(\"pointerleave\", leave);\n      root.addEventListener(\"focusin\", enter);\n      root.addEventListener(\"focusout\", leave);\n    }\n    const tick = (now: number) => {\n      raf = requestAnimationFrame(tick);\n      const dt = last ? Math.min(50, now - last) : 16;\n      last = now;\n      if (!visible) return;\n      if (autoPlay) {\n        rate += ((hover ? 0 : 1) - rate) * Math.min(1, dt * 0.006);\n        offset += (dt / 1000) * speed * rate;\n      } else {\n        const r = root.getBoundingClientRect();\n        const top = sc ? r.top - sc.getBoundingClientRect().top : r.top;\n        const vh = sc ? sc.clientHeight : window.innerHeight;\n        target = clamp01((vh - top) / (vh + r.height)) * n * gap * 1.5;\n        offset += (target - offset) * Math.min(1, dt * 0.01);\n      }\n      offsetRef.current = offset;\n      draw(offset);\n    };\n    raf = requestAnimationFrame(tick);\n    return () => {\n      cancelAnimationFrame(raf);\n      io.disconnect();\n      root.removeEventListener(\"pointerenter\", enter);\n      root.removeEventListener(\"pointerleave\", leave);\n      root.removeEventListener(\"focusin\", enter);\n      root.removeEventListener(\"focusout\", leave);\n    };\n  }, [controlled, progress, autoPlay, speed, arc, magnify, pauseOnHover, width, gap, copies, total, n]);\n\n  const all = Array.from({ length: n * copies }, (_, i) => logos[i % n]);\n  const current = logos[focus] ?? logos[0];\n\n  return (\n    <div\n      ref={ref}\n      className={[\"hb-wh8\", className].filter(Boolean).join(\" \")}\n      style={{ \"--hb-wh8-a\": accent, ...style } as React.CSSProperties}\n      {...rest}\n    >\n      <style href=\"hb-motion-logo-lens\" precedence=\"default\">{css}</style>\n      {label ? <p className=\"hb-wh8-label\">{label}</p> : null}\n      <div className=\"hb-wh8-track\" ref={trackRef}>\n        <span className=\"hb-wh8-lens\" aria-hidden=\"true\" />\n        <ul className=\"hb-wh8-list\" aria-label={label || \"Customers\"}>\n          {all.map((logo, i) => {\n            const { x, y, s, e } = place(i, 0, width, gap, total, arc, magnify);\n            return (\n              <li key={i} aria-hidden={i >= n ? \"true\" : undefined} className=\"hb-wh8-li\">\n                <span\n                  className=\"hb-wh8-item\"\n                  ref={(node) => {\n                    items.current[i] = node;\n                  }}\n                  style={\n                    {\n                      transform: `translate3d(${x.toFixed(1)}px, ${y.toFixed(1)}px, 0) translate(-50%, -50%) scale(${s.toFixed(3)})`,\n                      \"--k\": e.toFixed(3),\n                    } as React.CSSProperties\n                  }\n                >\n                  <Glyph kind={logo.glyph ?? i} />\n                  {logo.name}\n                </span>\n              </li>\n            );\n          })}\n        </ul>\n      </div>\n      {current ? (\n        <div className=\"hb-wh8-cap\" key={focus}>\n          <b>{current.name}</b>\n          <span>{current.note}</span>\n        </div>\n      ) : null}\n    </div>\n  );\n}\n"
    }
  ]
}