Liquid Cursor
paceui-gsap/liquid-cursorFreeComponent
A smooth, fluid cursor that follows your mouse with gentle stretch and bounce effects.
Live preview
live · rendered by the registry
Rendered by PaceUI GSAP on their own page — this is the component running, not a screenshot of it.Install it
npx shadcn@latest add https://gsap.paceui.com/r/liquid-cursor.jsonSource
1"use client";23import { ComponentProps, useRef } from "react";45import { useGSAP } from "@gsap/react";6import gsap from "gsap";78import { cn } from "@/lib/utils";910type LiquidCursorProps = Omit<ComponentProps<"div">, "children"> & {11 size?: number;12 strong?: boolean;13};1415export const LiquidCursor = ({ size = 40, strong = false, className, ...props }: LiquidCursorProps) => {16 const cursorRef = useRef<HTMLDivElement>(null);17 const prevPos = useRef({ x: 0, y: 0 });18 const prevAngle = useRef(0);1920 useGSAP(() => {21 const clickDrop = () => {22 if (!cursorRef.current) return;2324 gsap.to(cursorRef.current, {25 scale: 1.3,26 duration: 0.3,27 ease: "power2.out",28 onComplete: () => {29 gsap.to(cursorRef.current, {30 scale: 1,31 duration: 0.4,32 ease: "bounce.out",33 });34 },35 });36 };37 const moveDrop = (e: MouseEvent) => {38 if (!cursorRef.current) return;3940 const dx = e.clientX - prevPos.current.x;41 const dy = e.clientY - prevPos.current.y;4243 const distance = Math.sqrt(dx * dx + dy * dy);44 const angle = Math.atan2(dy, dx) * (180 / Math.PI);4546 let delta = angle - prevAngle.current;47 if (delta > 180) delta -= 360;48 if (delta < -180) delta += 360;4950 const smoothingFactor = 0.2;51 const smoothAngle = prevAngle.current + delta * smoothingFactor;5253 const maxStretch = 1.2;54 const stretch = Math.min(distance / 30, maxStretch);5556 const absDx = Math.abs(dx);57 const absDy = Math.abs(dy);58 const total = absDx + absDy || 1;59 const xRatio = absDx / total;6061 const scaleX = 1 + xRatio * stretch;62 const scaleY = 1 - xRatio * stretch * 0.3;6364 gsap.to(cursorRef.current, {65 duration: 1,66 left: e.clientX - size / 2,67 top: e.clientY - size / 2,68 scaleX,69 scaleY,70 rotate: smoothAngle,71 ease: "power2.out",72 });7374 prevAngle.current = smoothAngle;75 prevPos.current = { x: e.clientX, y: e.clientY };76 };7778 window.addEventListener("click", clickDrop);7980// … truncated
What it pulls in
npm packages
Files it writes
More from PaceUI GSAP
All 29 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Modal Ability Selectorai-modal-ability-selector | PaceUI GSAP | Components | Free | 2 deps | |
| Modal Selectorai-modal-selector | PaceUI GSAP | Components | Free | 2 deps | |
| Response Writerai-response-writer | PaceUI GSAP | Components | Free | 2 deps · 2 files | |
| AI Suggestionsai-suggestions | PaceUI GSAP | Components | Free | 2 deps | |
| Modal Ability Selectorai-token-counter | PaceUI GSAP | Components | Free | 2 deps | |
| Animated Stackanimated-stack | PaceUI GSAP | Components | Free | 2 deps | |
| Bouncing Textbouncing-text | PaceUI GSAP | Components | Free | 2 deps | |
| Dot Flowdot-flow | PaceUI GSAP | Components | Free | 2 deps |
