{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "confetti",
  "type": "registry:component",
  "title": "Confetti",
  "description": "A celebratory confetti burst — pieces launch from an origin, fan outward, arc under gravity, tumble, and fade. Every per-piece value is seeded, so the same seed renders identically every time. Full-canvas layer; energetic but tasteful.",
  "dependencies": [
    "remotion",
    "zod",
    "react"
  ],
  "registryDependencies": [
    "lib-random"
  ],
  "files": [
    {
      "path": "registry/components/confetti/Confetti.tsx",
      "type": "registry:component",
      "target": "components/onda/confetti/Confetti.tsx",
      "content": "import React from 'react';\nimport { AbsoluteFill, useCurrentFrame, useVideoConfig, interpolate, Easing } from 'remotion';\nimport { seededRandom } from '../../../lib/random';\nimport { confettiSchema, type ConfettiProps } from './schema';\n\nexport { confettiSchema, type ConfettiProps };\n\nconst EASE_OUT = Easing.bezier(0.16, 1, 0.3, 1);\n\n/**\n * A celebratory confetti burst — a full-canvas layer. Pieces launch from an\n * origin, fan outward, arc under gravity, tumble, and fade. Every per-piece\n * value (angle, speed, spin, color, size) comes from a seeded PRNG, and all\n * motion is a pure function of the frame, so the same seed renders identically\n * every time (§1). Energetic but tasteful — the accent rides along with\n * neutrals. Drop it over your scene with `<AbsoluteFill>`.\n *\n * @example\n * <Confetti />\n */\nexport const Confetti: React.FC<ConfettiProps> = ({\n  seed, count, colors, originX, originY, delay, duration, spread, gravity, pieceSize,\n}) => {\n  const frame = useCurrentFrame();\n  const { width, height, fps } = useVideoConfig();\n  const rand = seededRandom(seed);\n\n  const local = frame - delay;\n  const ox = originX * width;\n  const oy = originY * height;\n  // Speed scaled to canvas + fps so the burst looks the same at any resolution.\n  const speedScale = (Math.min(width, height) / 1080) * (30 / fps);\n  const spreadRad = (spread * Math.PI) / 180;\n\n  const pieces = Array.from({ length: count }, (_, i) => {\n    // Draw a fixed slice of randoms per piece so order never shifts the result.\n    const aJit = rand();\n    const speed = 9 + rand() * 13;          // launch velocity (px/frame @ baseline)\n    const spin = (rand() - 0.5) * 28;        // degrees/frame\n    const spin0 = rand() * 360;              // initial rotation\n    const color = colors[Math.floor(rand() * colors.length)] ?? colors[0];\n    const wf = 0.7 + rand() * 0.6;           // size width factor (slim rectangles)\n    const sizeJit = 0.7 + rand() * 0.8;      // per-piece size variation\n    const lifeJit = 0.8 + rand() * 0.4;      // per-piece duration variation\n    const drift = (rand() - 0.5) * 4;        // horizontal sway amplitude (deg)\n\n    if (local < 0) return null;\n\n    const life = duration * lifeJit;\n    if (local > life) return null;\n\n    const t = local; // frames since launch (already >= 0)\n    // Aim around straight up (-90deg), fanned by spread.\n    const angle = -Math.PI / 2 + (aJit - 0.5) * spreadRad;\n    const vx = Math.cos(angle) * speed * speedScale;\n    const vy = Math.sin(angle) * speed * speedScale;\n    const g = 0.55 * gravity * speedScale;\n\n    // Ballistic path: gravity pulls pieces back down over time.\n    const x = ox + vx * t + Math.sin(t * 0.18 + i) * drift;\n    const y = oy + vy * t + 0.5 * g * t * t;\n\n    const opacity = interpolate(\n      t,\n      [0, life * 0.15, life * 0.7, life],\n      [0, 1, 1, 0],\n      { extrapolateLeft: 'clamp', extrapolateRight: 'clamp', easing: EASE_OUT },\n    );\n\n    const rotate = spin0 + spin * t;\n    const w = pieceSize * sizeJit * wf;\n    const h = pieceSize * sizeJit;\n\n    return (\n      <div\n        key={i}\n        style={{\n          position: 'absolute',\n          left: 0,\n          top: 0,\n          width: w,\n          height: h,\n          backgroundColor: color,\n          borderRadius: 1,\n          opacity,\n          transform: `translate(${x - w / 2}px, ${y - h / 2}px) rotate(${rotate}deg)`,\n          willChange: 'transform, opacity',\n        }}\n      />\n    );\n  });\n\n  return <AbsoluteFill>{pieces}</AbsoluteFill>;\n};\n\nexport default Confetti;\n"
    },
    {
      "path": "registry/components/confetti/schema.ts",
      "type": "registry:component",
      "target": "components/onda/confetti/schema.ts",
      "content": "import { z } from 'zod';\n\n/** Zod schema for {@link Confetti} props. */\nexport const confettiSchema = z.object({\n  /** Discriminator literal — matches this entry's registry slug. Auto-populated when omitted (`schema.parse({})` works as before). Lets consumers build `z.discriminatedUnion('kind', [...])` directly over onda schemas. */\n  kind: z.literal('confetti').default('confetti'),\n  /** Seed for every per-piece random (angle, velocity, spin, color, size) — same seed always produces the same burst (§1). */\n  seed: z.number().int().default(7),\n  /** Number of confetti pieces. ~80 reads full without thrashing the render. */\n  count: z.number().int().min(1).default(80),\n  /** Palette pieces are picked from. Defaults to the Onda accent plus tasteful neutrals. */\n  colors: z.array(z.string()).default(['var(--onda-accent, #D96B82)', 'var(--onda-accent-soft, #E89AAB)', 'var(--onda-text, #F2F2F4)', 'var(--onda-dim, #8E8E98)', 'var(--onda-border-lit, #26262E)']),\n  /** Burst origin X, as a fraction of canvas width (0 = left, 1 = right). */\n  originX: z.number().min(0).max(1).default(0.5),\n  /** Burst origin Y, as a fraction of canvas height (0 = top, 1 = bottom). */\n  originY: z.number().min(0).max(1).default(0.35),\n  /** Frames before the burst launches. */\n  delay: z.number().int().min(0).default(0),\n  /** Frames over which a piece travels, tumbles and fades out. */\n  duration: z.number().int().min(1).default(70),\n  /** Launch spread, in degrees, around straight up. Wider = more fan-out. */\n  spread: z.number().min(0).max(360).default(120),\n  /** Downward acceleration. Higher = pieces fall back faster. */\n  gravity: z.number().min(0).default(1),\n  /** Base piece size in pixels — each piece varies around this. */\n  pieceSize: z.number().min(1).default(12),\n});\n\n/** Inferred props for {@link Confetti}. */\nexport type ConfettiProps = z.infer<typeof confettiSchema>;\n"
    },
    {
      "path": "registry/components/confetti/confetti.meta.json",
      "type": "registry:file",
      "target": "components/onda/confetti/confetti.meta.json",
      "content": "{\n  \"name\": \"confetti\",\n  \"title\": \"Confetti\",\n  \"description\": \"A celebratory confetti burst — pieces launch from an origin, fan outward, arc under gravity, tumble, and fade. Every per-piece value is seeded, so the same seed renders identically every time. Full-canvas layer; energetic but tasteful.\",\n  \"pickWhen\": \"a literal celebration — milestone hit, signup confirmation, launch reveal. Once per piece, not per scene; it cashes the moment in.\",\n  \"category\": \"graphics\",\n  \"tags\": [\n    \"confetti\",\n    \"celebration\",\n    \"particles\",\n    \"burst\",\n    \"graphics\"\n  ],\n  \"dependencies\": [\n    \"remotion\",\n    \"zod\",\n    \"react\"\n  ]\n}\n"
    },
    {
      "path": "registry/components/confetti/README.md",
      "type": "registry:file",
      "target": "components/onda/confetti/README.md",
      "content": "# Confetti\n\nA celebratory confetti burst — pieces launch from an origin, fan outward, arc under gravity, tumble (rotation), and fade out. Every per-piece value (angle, velocity, spin, color, size) comes from a seeded PRNG keyed off the `seed` prop, and all motion is a pure function of the frame, so the same seed renders identically every time (§1). The default palette is the Onda accent plus tasteful neutrals. This is a full-canvas effect layer — no placement; the burst origin is set with `originX`/`originY` (0..1 fractions). Drop it over your scene with `<AbsoluteFill>`.\n\n## Props\n\n| Prop | Type | Default | Notes |\n| --- | --- | --- | --- |\n| `seed` | `number` | `7` | Seed for all per-piece randomness (deterministic). |\n| `count` | `number` | `80` | Number of confetti pieces. |\n| `colors` | `string[]` | accent + neutrals | Palette pieces are picked from. |\n| `originX` | `number` | `0.5` | Burst origin X, fraction of canvas width. |\n| `originY` | `number` | `0.35` | Burst origin Y, fraction of canvas height. |\n| `delay` | `number` | `0` | Frames before the burst launches. |\n| `duration` | `number` | `70` | Frames a piece travels, tumbles and fades. |\n| `spread` | `number` | `120` | Launch spread in degrees around straight up. |\n| `gravity` | `number` | `1` | Downward acceleration multiplier. |\n| `pieceSize` | `number` | `12` | Base piece size in pixels. |\n\n## Usage\n\n```tsx\nimport { AbsoluteFill, Sequence } from 'remotion';\nimport { Confetti } from './components/onda/confetti/Confetti';\n\nexport const Scene = () => (\n  <AbsoluteFill style={{ backgroundColor: '#08080A' }}>\n    {/* your celebratory content */}\n    <Sequence from={24}>\n      <Confetti />\n    </Sequence>\n  </AbsoluteFill>\n);\n```\n"
    }
  ]
}
