"use client"; import { useRef } from "react"; import { motion, useReducedMotion, useScroll, useSpring, useTransform, type MotionValue } from "motion/react"; interface Step { number: string; title: string; text: string; } /** * "Vom Bienenstock ins Glas" als Weg, den der Honig nimmt: eine Honiglinie * fuellt sich im Takt des Scrollens und laesst die Waben der einzelnen * Schritte der Reihe nach aufleuchten. Hier traegt die Bewegung Bedeutung — * die Reihenfolge IST der Inhalt. * * Ab lg waagerecht (sechs Spalten), darunter senkrecht mit Linie links. * Bei reduzierter Bewegung ist der Weg von Anfang an gefuellt. */ export function ProcessPath({ steps }: { steps: Step[] }) { const ref = useRef(null); const reduceMotion = useReducedMotion(); const { scrollYProgress } = useScroll({ target: ref, offset: ["start 85%", "end 55%"] }); // Gefedert statt direkt am Scrollwert: die Linie "fliesst" nach, wie Honig. const smooth = useSpring(scrollYProgress, { stiffness: 90, damping: 22, mass: 0.6 }); const full = useTransform(smooth, () => 1); const progress = reduceMotion ? full : smooth; return (
    {/* Leitung (Grundlinie) und Honigfuellung — waagerecht ab lg, sonst senkrecht. */}
); } function ProcessStep({ step, index, total, progress, }: { step: Step; index: number; total: number; progress: MotionValue; }) { // Die Wabe "entzuendet" sich, sobald die Linie ihre Position erreicht. const at = total > 1 ? index / (total - 1) : 0; const lit = useTransform(progress, [Math.max(0, at - 0.06), at + 0.02], [0, 1]); const scale = useTransform(lit, [0, 1], [0.85, 1]); return (
  • {step.number}

    {step.title}

    {step.text}

  • ); }