{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "loader-morph-shapes",
  "type": "registry:component",
  "title": "Loader Morph Shapes",
  "description": "A single gradient shape morphs from a circle to a rounded square to a triangle and back, turning as it goes.",
  "author": "Hyperblur <hello@hyperblur.dev>",
  "dependencies": [],
  "registryDependencies": [],
  "categories": [
    "loaders",
    "loader",
    "morph",
    "shapes",
    "clip-path",
    "loading",
    "geometry"
  ],
  "docs": "https://hyperblur.dev/effects/loader-morph-shapes",
  "files": [
    {
      "path": "registry/hyperblur/loader-morph-shapes.tsx",
      "type": "registry:component",
      "target": "components/hyperblur/loader-morph-shapes.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\n\nexport interface LoaderMorphShapesProps extends React.HTMLAttributes<HTMLSpanElement> {\n  size?: number;\n  color?: string;\n  accent?: string;\n  speed?: number;\n  label?: string;\n}\n\nconst COUNT = 18;\n\nfunction pt(x: number, y: number) {\n  return `${x.toFixed(2)}% ${y.toFixed(2)}%`;\n}\n\nfunction circle() {\n  const out: string[] = [];\n  for (let k = 0; k < COUNT; k++) {\n    const a = ((-90 + (k * 360) / COUNT) * Math.PI) / 180;\n    out.push(pt(50 + 50 * Math.cos(a), 50 + 50 * Math.sin(a)));\n  }\n  return `polygon(${out.join(\", \")})`;\n}\n\nfunction squircle() {\n  const out: string[] = [];\n  for (let k = 0; k < COUNT; k++) {\n    const a = ((-90 + (k * 360) / COUNT) * Math.PI) / 180;\n    const cx = Math.cos(a);\n    const sy = Math.sin(a);\n    const x = Math.sign(cx) * Math.pow(Math.abs(cx), 0.5);\n    const y = Math.sign(sy) * Math.pow(Math.abs(sy), 0.5);\n    out.push(pt(50 + 44 * x, 50 + 44 * y));\n  }\n  return `polygon(${out.join(\", \")})`;\n}\n\nfunction triangle() {\n  const corners = [-90, 30, 150].map((d) => {\n    const a = (d * Math.PI) / 180;\n    return [50 + 50 * Math.cos(a), 50 + 50 * Math.sin(a)];\n  });\n  const per = COUNT / 3;\n  const out: string[] = [];\n  for (let e = 0; e < 3; e++) {\n    const from = corners[e];\n    const to = corners[(e + 1) % 3];\n    for (let s = 0; s < per; s++) {\n      const t = s / per;\n      out.push(pt(from[0] + (to[0] - from[0]) * t, from[1] + (to[1] - from[1]) * t));\n    }\n  }\n  return `polygon(${out.join(\", \")})`;\n}\n\nconst css = `\n.hb-qc7 {\n  position: relative;\n  display: inline-flex;\n  flex-direction: column;\n  align-items: center;\n  gap: 0.7em;\n  box-sizing: border-box;\n  font-family: inherit;\n  color: #ededed;\n  vertical-align: middle;\n}\n.hb-qc7 *, .hb-qc7 *::before, .hb-qc7 *::after { box-sizing: border-box; }\n.hb-qc7-g {\n  position: relative;\n  flex: none;\n  display: grid;\n  place-items: center;\n  width: var(--hb-qc7-s);\n  height: var(--hb-qc7-s);\n}\n.hb-qc7-shape {\n  grid-area: 1 / 1;\n  width: 78%;\n  height: 78%;\n  background: linear-gradient(135deg, var(--hb-qc7-a), var(--hb-qc7-c));\n  clip-path: ${circle()};\n  animation: hb-qc7-morph var(--hb-qc7-t) ease-in-out infinite;\n}\n.hb-qc7-shadow {\n  position: absolute;\n  left: 50%;\n  bottom: 0;\n  width: 60%;\n  height: 8%;\n  margin-left: -30%;\n  border-radius: 50%;\n  background: radial-gradient(closest-side, color-mix(in srgb, var(--hb-qc7-c) 45%, transparent), transparent);\n  animation: hb-qc7-shadow var(--hb-qc7-t) ease-in-out infinite;\n}\n.hb-qc7-l { font-size: 12px; line-height: 1.3; color: #a1a1a1; white-space: nowrap; }\n.hb-qc7-sr {\n  position: absolute;\n  width: 1px;\n  height: 1px;\n  margin: -1px;\n  padding: 0;\n  overflow: hidden;\n  clip-path: inset(50%);\n  white-space: nowrap;\n  border: 0;\n}\n@keyframes hb-qc7-morph {\n  0% { clip-path: ${circle()}; transform: rotate(0deg) scale(1); }\n  16% { clip-path: ${circle()}; transform: rotate(0deg) scale(1); }\n  33% { clip-path: ${squircle()}; transform: rotate(120deg) scale(0.92); }\n  49% { clip-path: ${squircle()}; transform: rotate(120deg) scale(0.92); }\n  66% { clip-path: ${triangle()}; transform: rotate(240deg) scale(1.06); }\n  82% { clip-path: ${triangle()}; transform: rotate(240deg) scale(1.06); }\n  100% { clip-path: ${circle()}; transform: rotate(360deg) scale(1); }\n}\n@keyframes hb-qc7-shadow {\n  0%, 16%, 100% { transform: scaleX(1); opacity: 0.8; }\n  33%, 49% { transform: scaleX(0.82); opacity: 0.55; }\n  66%, 82% { transform: scaleX(1.12); opacity: 0.9; }\n}\n@media (prefers-reduced-motion: reduce) {\n  .hb-qc7-shape, .hb-qc7-shadow { animation: none; }\n}\n`;\n\nexport function LoaderMorphShapes({\n  size = 56,\n  color = \"#2f7bff\",\n  accent = \"#9fc6ff\",\n  speed = 3.6,\n  label,\n  className = \"\",\n  style,\n  ...rest\n}: LoaderMorphShapesProps) {\n  const vars = {\n    \"--hb-qc7-s\": `${size}px`,\n    \"--hb-qc7-c\": color,\n    \"--hb-qc7-a\": accent,\n    \"--hb-qc7-t\": `${speed}s`,\n    ...style,\n  } as React.CSSProperties;\n\n  return (\n    <>\n      <style href=\"hb-loader-morph-shapes\" precedence=\"default\">{css}</style>\n      <span role=\"status\" className={`hb-qc7 ${className}`} style={vars} {...rest}>\n        <span className=\"hb-qc7-g\" aria-hidden=\"true\">\n          <span className=\"hb-qc7-shape\" />\n          <span className=\"hb-qc7-shadow\" />\n        </span>\n        <span className={label ? \"hb-qc7-l\" : \"hb-qc7-sr\"}>{label ?? \"Loading\"}</span>\n      </span>\n    </>\n  );\n}\n"
    }
  ]
}