소스 검색

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 1 개월 전
부모
커밋
87407ee6ce
1개의 변경된 파일과 7개의 추가작업 그리고 1개의 파일을 삭제
  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);