UNPKG

@twallpaper/react

Version:

🌈 Multicolor gradient wallpaper created algorithmically and shimmers smoothly.

50 lines (49 loc) • 1.19 kB
/** * name: @twallpaper/react * description: 🌈 Multicolor gradient wallpaper created algorithmically and shimmers smoothly. * version: 2.1.2 * homepage: https://twallpaper.js.org */ "use client"; import r from "react"; import { TWallpaper as c } from "twallpaper"; const p = r.forwardRef( ({ options: n, ...u }, o) => { const a = r.useRef(null), t = r.useRef(); return r.useImperativeHandle(o, () => ({ animate(e) { t.current.animate(e); }, scrollAnimate(e) { t.current.scrollAnimate(e); }, updateColors(e) { t.current.updateColors(e); }, updateFrametime(e) { t.current.updateFrametime(e); }, updatePattern(e) { t.current.updatePattern(e); }, updateTails(e) { t.current.updateTails(e); }, toNextPosition(e) { t.current.toNextPosition(e); } })), r.useEffect(() => (t.current || (t.current = new c(a.current)), t.current.init(n), () => { t.current.dispose(); }), []), /* @__PURE__ */ r.createElement( "div", { ...u, ref: a } ); } ); export { p as TWallpaper, p as default };