// axi0 Motion 0.2.0: Halftone lens. A halftone print of a picture whose dots swell into the real photo under the pointer.
// Generated from src/halftone-lens/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 HalftoneLensProps extends HTMLAttributes<HTMLElement> {
  /** the dot grid in pixels (default 7) */
  cell?: number;
  /** the lens radius in pixels (default 130) */
  radius?: number;
  /** dots in the picture's colors; `false` for one ink (default true) */
  color?: boolean;
  /** The element to render (default "div") */
  as?: string;
  children?: ReactNode;
}

const s = (v: unknown) => (v === undefined ? undefined : String(v));

export function HalftoneLens({ as = "div", cell, radius, color, ...rest }: HalftoneLensProps) {
  return createElement(as, { ...rest, "data-motion": "halftone-lens", "data-motion-cell": s(cell), "data-motion-radius": s(radius), "data-motion-color": s(color) });
}

export default HalftoneLens;
