clickEffect function exported
Last updated: 2026-03-05T11:38:55.014Z
Metrics
LOC: 34
Complexity: 2
Params: 0
Signature
clickEffect(): : Promise<void>
Summary
Show a brief "click" ripple effect at the cursor's current position.
Source Code
export function clickEffect(): Promise<void> {
return new Promise((resolve) => {
if (!cursorEl) {
resolve();
return;
}
const ripple = document.createElement("div");
ripple.style.cssText = [
`position: fixed`,
`z-index: 2147483646`,
`pointer-events: none`,
`width: 30px`,
`height: 30px`,
`border-radius: 50%`,
`background: rgba(26, 115, 232, 0.3)`,
`transform: translate(${currentX - 5}px, ${currentY - 5}px) scale(0)`,
`transition: transform 0.3s ease-out, opacity 0.3s ease-out`,
].join(";");
document.body.appendChild(ripple);
// Start animation on next frame
requestAnimationFrame(() => {
ripple.style.transform = `translate(${currentX - 5}px, ${currentY - 5}px) scale(1.5)`;
ripple.style.opacity = "0";
});
setTimeout(() => {
ripple.remove();
resolve();
}, 350);
});
}
No outgoing dependencies.
Impact (Incoming)
| Source | Type |
|---|---|
| FillableElement | uses |