Skip to content

Instantly share code, notes, and snippets.

View prathamVaidya's full-sized avatar
🙃
Living in Dark mode

Pratham Vaidya prathamVaidya

🙃
Living in Dark mode
View GitHub Profile
@prathamVaidya
prathamVaidya / useCTAPointerAnimation.ts
Last active April 30, 2025 10:20
React hook implementation to track CTA with an animated arrow.
import { useEffect, useRef, useState } from "react";
// Orignal codepen : https://codepen.io/TWilson/pen/raaGNGa
// Credits -> Tim Wilson
interface UseButtonPointerAnimationReturn {
canvasRef: React.RefObject<HTMLCanvasElement>;
targetRef: React.RefObject<HTMLButtonElement>;
initializeAnimation: () => void;
}