{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "particle-wave",
  "title": "Particle Wave",
  "author": "VenusUI",
  "description": "A WebGL field of points rolling like a wave, for hero and section backgrounds.",
  "dependencies": [
    "three",
    "@react-three/fiber"
  ],
  "devDependencies": [
    "@types/three"
  ],
  "registryDependencies": [
    "https://venusui.com/r/use-scene-state.json"
  ],
  "files": [
    {
      "path": "registry/default/ui/particle-wave.tsx",
      "content": "\"use client\"\n\nimport * as React from \"react\"\nimport { Canvas, useFrame } from \"@react-three/fiber\"\nimport type { Points } from \"three\"\n\nimport { cn } from \"@/lib/utils\"\nimport { useSceneState } from \"@/registry/default/hooks/use-scene-state\"\n\ninterface ParticleWaveProps {\n  /** Points along the x axis. */\n  columns?: number\n  /** Points along the z axis. */\n  rows?: number\n  /** Wave height. */\n  amplitude?: number\n  /** Accessible description of the graphic. */\n  label?: string\n  className?: string\n}\n\nfunction Wave({ columns, rows, amplitude, color }: { columns: number; rows: number; amplitude: number; color: string }) {\n  const ref = React.useRef<Points>(null)\n  const positions = React.useMemo(() => {\n    const array = new Float32Array(columns * rows * 3)\n    let i = 0\n    for (let x = 0; x < columns; x++) {\n      for (let z = 0; z < rows; z++) {\n        array.set([(x - columns / 2) * 0.18, 0, (z - rows / 2) * 0.18], i)\n        i += 3\n      }\n    }\n    return array\n  }, [columns, rows])\n\n  useFrame(({ clock }) => {\n    const geometry = ref.current?.geometry\n    if (!geometry) return\n    const attribute = geometry.attributes.position\n    if (!attribute) return\n    const t = clock.getElapsedTime()\n    const array = attribute.array as Float32Array\n    for (let i = 0; i < array.length; i += 3) {\n      const x = array[i] ?? 0\n      const z = array[i + 2] ?? 0\n      array[i + 1] = Math.sin(x * 0.9 + t) * amplitude * 0.5 + Math.cos(z * 0.8 + t * 0.8) * amplitude * 0.5\n    }\n    attribute.needsUpdate = true\n  })\n\n  return (\n    <points ref={ref}>\n      <bufferGeometry>\n        <bufferAttribute attach=\"attributes-position\" args={[positions, 3]} />\n      </bufferGeometry>\n      <pointsMaterial color={color} size={2} sizeAttenuation={false} transparent opacity={0.8} />\n    </points>\n  )\n}\n\n/**\n * A field of points rolling like a wave, seen from a low angle. Works well as\n * a hero background. Uses the CSS text color; pauses off screen and with\n * reduced motion.\n */\nfunction ParticleWave({ columns = 70, rows = 40, amplitude = 0.6, label = \"Animated wave of particles\", className }: ParticleWaveProps) {\n  const ref = React.useRef<HTMLDivElement>(null)\n  const { color, active } = useSceneState(ref)\n\n  return (\n    <div ref={ref} role=\"img\" aria-label={label} data-slot=\"particle-wave\" className={cn(\"relative h-72 w-full text-foreground\", className)}>\n      <Canvas\n        camera={{ position: [0, 2.2, 6], fov: 55 }}\n        dpr={[1, 2]}\n        frameloop={active ? \"always\" : \"demand\"}\n        fallback={<p className=\"p-4 text-sm text-muted-foreground\">3D graphics are not available in this browser.</p>}\n      >\n        <Wave columns={columns} rows={rows} amplitude={amplitude} color={color} />\n      </Canvas>\n    </div>\n  )\n}\n\nexport { ParticleWave, type ParticleWaveProps }\n",
      "type": "registry:ui"
    }
  ],
  "meta": {
    "version": "0.1.0"
  },
  "categories": [
    "3d",
    "backgrounds",
    "animations"
  ],
  "type": "registry:ui"
}