'use client'; import { motion, useTransform, type MotionValue } from 'framer-motion'; import { Wordmark } from '@/components/primitives/Wordmark'; // One beat of the pinned conversation, staged as two calling cards laid on a // table: the reader's, in white, and creeer's, in navy, handed back. // // The cards are driven by STATE, not by scroll position. Mapping opacity // straight onto scroll made every intermediate position a valid frame, so // stopping mid-swipe left creeer's card as a half-transparent grey rectangle — // it read as a rendering fault. Scroll now only decides which beat we are on; // the cards animate to that beat over time and always land somewhere finished, // wherever the reader lets go. // // Every scene stays mounted and stacked in the same place. Mounting only the // active one would animate more cheaply and would strip five sixths of the // section out of the static export. const EASE = [0.22, 1, 0.36, 1] as const; export function EscenaDialogo({ i, total, progreso, activa, respondida, n, name, situacion, respuesta, }: { i: number; total: number; progreso: MotionValue; activa: boolean; respondida: boolean; n: string; name: string; situacion: string; respuesta: string; }) { const paso = 1 / total; // The one thing still tied to scroll. A drifting numeral never looks broken // at any position it can be caught in, so it costs nothing and keeps the // stage from feeling frozen between beats. const cifraY = useTransform(progreso, [i * paso - paso, (i + 1) * paso + paso], [60, -60]); return ( {/* One card per frame — never both. Both live in the same grid cell so the second can take the stage the first leaves, instead of stacking under it: the question is asked, it goes, and then the answer is the only thing on screen. They come in from opposite sides so the swap reads as one card replacing another, not as one fading into the same spot. */}

{n} · {name}

«{situacion}»

{/* creeer's card, handed back: navy against the reader's white, tilted the other way, and coming in from the opposite margin. */}
); }