UNPKG

@izhann/react-cursor-fx

Version:

Interactive cursor effects for React and Next.js applications — zero runtime dependencies

20 lines (19 loc) 760 B
/** * Programmatically trigger a cursor visual effect at any screen position * without requiring an actual user interaction. * * CursorClickEffect automatically listens for the `cursor:click` custom event * fired by this function, so any mounted CursorClickEffect will react to it. * * @example * // Trigger the current click effect at the screen centre * emitCursorEvent("click", { x: window.innerWidth / 2, y: window.innerHeight / 2 }) * * // Trigger at a specific element's centre * const rect = buttonRef.current.getBoundingClientRect() * emitCursorEvent("click", { x: rect.left + rect.width / 2, y: rect.top + rect.height / 2 }) */ export declare function emitCursorEvent(type: "click", options?: { x?: number; y?: number; }): void;