Ver Fonte

fix: let the headline rest while the glass period is pulled away

The pull captures the pointer, so the headline's weight wave kept
getting moves after the lens left it and turned every letter thin until
release. Moves outside the headline now count as leaving it; pulling the
lens back across the letters still melts them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QEPoSHwHCYMNpm2iKxY9hL
Claude há 1 mês atrás
pai
commit
87407ee6ce
1 ficheiros alterados com 7 adições e 1 exclusões
  1. 7 1
      components/cards/hero-title.tsx

+ 7 - 1
components/cards/hero-title.tsx

@@ -131,9 +131,15 @@ export function HeroTitle() {
     const onMove = (e: PointerEvent) => {
       if (e.pointerType === "touch") return;
       const { clientX: x, clientY: y } = e;
+      // Pulling the bead captures the pointer, so moves keep arriving once it
+      // has left the headline: out there the letters rest, as on leaving.
+      const r = wrap.getBoundingClientRect();
+      const inside = x >= r.left && x <= r.right && y >= r.top && y <= r.bottom;
 
       cancelAnimationFrame(frame);
-      frame = requestAnimationFrame(() => setWeights(near(x, y)));
+      frame = requestAnimationFrame(() =>
+        setWeights(inside ? near(x, y) : () => null),
+      );
     };
     const onLeave = () => {
       cancelAnimationFrame(frame);