// axi0 Motion 0.2.0: Scroll unblur. As the paragraph scrolls in, word after word comes out of the blur and up to full strength while the block levels out.
// Generated from src/scroll-unblur/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 ScrollUnblurProps extends HTMLAttributes<HTMLElement> {
  /** Head start of each word (share of the scroll) (default 0.06) */
  stagger?: number;
  /** Blur at the start (default 5) */
  blur?: number;
  /** Strength at the start (default 0.14) */
  dim?: number;
  /** Tilt at the start (default 3) */
  tilt?: number;
  /** Starts when the top reaches (share of the window height) (default 1) */
  start?: number;
  /** Ends when the top reaches (default 0.5) */
  end?: number;
  /** The element to render (default "div") */
  as?: string;
  children?: ReactNode;
}

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

export function ScrollUnblur({ as = "div", stagger, blur, dim, tilt, start, end, ...rest }: ScrollUnblurProps) {
  return createElement(as, { ...rest, "data-motion": "scroll-unblur", "data-motion-stagger": s(stagger), "data-motion-blur": s(blur), "data-motion-dim": s(dim), "data-motion-tilt": s(tilt), "data-motion-start": s(start), "data-motion-end": s(end) });
}

export default ScrollUnblur;
