From badba0a9f76f7cb1b6e8989dbe8d4085c0e3922f Mon Sep 17 00:00:00 2001 From: Athena Date: Thu, 30 Apr 2026 23:37:58 +0200 Subject: [PATCH] Mountain: pause on click + figure 3x bigger Co-Authored-By: Claude Sonnet 4.6 --- src/app/components/MountainClimb.tsx | 51 ++++++++++++++++------------ 1 file changed, 30 insertions(+), 21 deletions(-) diff --git a/src/app/components/MountainClimb.tsx b/src/app/components/MountainClimb.tsx index 4b4cbfe..51017f0 100644 --- a/src/app/components/MountainClimb.tsx +++ b/src/app/components/MountainClimb.tsx @@ -59,6 +59,7 @@ const CARD_H = 128; export default function MountainClimb() { const [step, setStep] = useState(-1); + const [paused, setPaused] = useState(false); const sectionRef = useRef(null); const started = useRef(false); @@ -79,12 +80,12 @@ export default function MountainClimb() { return () => obs.disconnect(); }, []); - // Advance one step every 1.6 s + // Advance one step every 1.6 s — paused when user clicked useEffect(() => { - if (step < 0 || step >= STEPS.length - 1) return; + if (step < 0 || step >= STEPS.length - 1 || paused) return; const t = setTimeout(() => setStep((s) => s + 1), 1600); return () => clearTimeout(t); - }, [step]); + }, [step, paused]); const atSummit = step === STEPS.length - 1; const wp = step >= 0 ? WP[step] : WP[0]; @@ -92,8 +93,8 @@ export default function MountainClimb() { // Card x: centred on person, clamped inside viewBox const rawCX = wp.x - CARD_W / 2; const cardX = Math.min(Math.max(rawCX, 8), VW - CARD_W - 8); - // Card y: above figure head, clamped to top of viewBox - const cardY = Math.max(wp.y - CARD_H - 58, 4); + // Card y: above figure head (figure is 3× scaled → head at ~87 SVG units above foot) + const cardY = Math.max(wp.y - CARD_H - 110, 4); const replay = () => { started.current = true; @@ -115,7 +116,12 @@ export default function MountainClimb() { {/* ── Mountain animation (md+) ── */} -
+
!atSummit && setPaused((p) => !p)} + style={{ cursor: atSummit ? "default" : "pointer" }} + title={paused ? "Klicken um fortzusetzen" : "Klicken zum Pausieren"} + > - {/* Inner group — receives bounce animation at summit */} + {/* Inner group — 3× scale + bounce at summit */} - {/* Head */} - - {/* Body */} - - {/* Left arm (down, holding mountain) */} - - {/* Right arm (raised) */} - - {/* Legs */} - - + {/* strokeWidth 0.5 = visually 1.5 after scale(3) */} + + + + + + - {/* Flag — appears at summit, attached to raised right arm */} {atSummit && ( - + )} @@ -188,7 +190,7 @@ export default function MountainClimb() { x1={cardX + CARD_W / 2} y1={cardY + CARD_H} x2={wp.x} - y2={wp.y - 37} + y2={wp.y - 90} stroke="#c7d2fe" strokeWidth="1" strokeDasharray="4 3" @@ -236,6 +238,13 @@ export default function MountainClimb() { )} + {/* Pause hint */} + {step >= 0 && !atSummit && ( +

+ {paused ? "▶ Klicken zum Fortsetzen" : "⏸ Klicken zum Pausieren"} +

+ )} + {/* Replay button */} {atSummit && (