// axi0 Motion 0.2.0: Particles. Balls fall, bounce and collide in a scene computed in WebAssembly.
// Generated from src/particles/meta.json by motion-pack: a thin wrapper. The loader (motion.js) must be on the page once;
// it starts the effect on the element this renders. Options left out keep the effect's own defaults.
import { createElement } from "react";
import type { HTMLAttributes, ReactNode } from "react";

export interface ParticlesProps extends HTMLAttributes<HTMLElement> {
  /** how many balls (default 70) */
  count?: number;
  /** the same seed always gives the same scene (default 7) */
  seed?: number;
  /** 1 is about 1,400 pixels per second squared (default 1) */
  gravity?: number;
  /** how much speed a bounce keeps (default 0.55) */
  bounce?: number;
  /** ball size factor (radius 6 to 16 pixels at 1) (default 1) */
  size?: number;
  /** comma separated (default "#f6a04d,#ff6b8b,#8a7dff,#3ad0c1") */
  colors?: string;
  /** fill the nearest positioned parent, behind its content (default false) */
  cover?: boolean;
  children?: ReactNode;
}

const s = (v: unknown) => (v === undefined ? undefined : String(v));
// a present attribute is on; "false" turns off an option that is on by default
const flag = (v: boolean | undefined, d: boolean) => (v === undefined || v === d ? undefined : v ? "" : "false");

export function Particles({ count, seed, gravity, bounce, size, colors, cover, ...rest }: ParticlesProps) {
  return createElement("axi0-particles", { ...rest, "count": s(count), "seed": s(seed), "gravity": s(gravity), "bounce": s(bounce), "size": s(size), "colors": s(colors), "cover": flag(cover, false) });
}

export default Particles;
