/** * Svelte action: animates a text element's content via JS RAF. * * Implemented modes: * • fade-letters — wraps each character in a and fades them in with stagger * • bounce-in — same wrapping, scale+translate pop per character * • handwriting — re-renders the text inside an with stroke + transparent * fill and animates `stroke-dashoffset` so the text appears to be * drawn left-to-right (works best with cursive/script fonts) * * Other modes (instant, typewriter, fade-words) are handled elsewhere by the * /present render path — this action no-ops for those. * * Each runner builds a `currentSeek(elapsedMs)` closure that snapshots the * setup state and computes the visual at any virtual time. The live RAF loop * calls it with real elapsed; the MP4/GIF export pipeline calls it via * `window.__seekAllTextAnims(virtualMs)` for frame-perfect captures. * * The action also registers a restart fn into `window.__svgAnimRestart` so the * server-side video export pipeline can reset all animations under the * virtual clock at the start of the slide hold (same pattern as FlowMarkers * and arrowClipDraw). */ export type TextAnimateMode = 'instant' | 'typewriter' | 'fade-words' | 'fade-letters' | 'handwriting' | 'bounce-in' | 'scramble-in' | 'slot-machine' | 'drop' | 'glitch' | 'marquee' | 'blur-in' | 'stretch' | 'slide-words' | 'wave' | 'typewriter-erase'; export interface TextAnimateParams { enabled: boolean; mode: TextAnimateMode; content: string; /** Total duration in ms for handwriting; for stagger modes it's the per-letter * delay budget — actual total = stagger * letterCount + perLetterDuration. */ duration: number; stagger?: number; loop?: boolean; /** Cosmetic: applied to the inner SVG text in handwriting mode. */ color?: string; fontSize?: number; fontFamily?: string; fontWeight?: number | string; fontStyle?: string; textAlign?: 'left' | 'center' | 'right'; /** Slide loop duration; when present the effective duration aligns to a * cycle that fits an integer number of times into slide_duration so GIF * loops are seamless in Flow mode. */ slideDuration?: number; /** Bumped by the host component when ANY meaningful prop changes — without * this the action would silently keep running with stale values. */ key?: unknown; } export declare function textAnimate(node: HTMLElement, params: TextAnimateParams): { update(p: TextAnimateParams): void; destroy(): void; };