/** * Effect runner (spec: "Map Stories / Effect verbs", Phase C) — drives the * per-frame channel for the verbs that need a clock (`trace`, `pulse`). * `fade` is NOT here: it's pure attribute mechanics (opacity + transition), * which keeps it DOM-visible and scrub-capturable. * * One active effect per (core, layer): starting a new one cancels the old * (last-write-wins, the library-wide action rule). prefers-reduced-motion * jumps straight to the final frame — same contract as camera animation. */ import type { RuntimeCore } from "./runtime-core"; /** Pure easing/oscillation math — unit-testable without a clock. */ /** * Named easing curves for effect verbs (``). * Applied to the effect clock BEFORE the frame callback — one place, every verb. */ export declare const EASINGS: Record number>; export declare function traceProgress(t01: number, t0: number, t1: number): number; /** Oscillates 1 → low → 1 per cycle (cosine), ending exactly at 1 for whole cycles. */ export declare function pulseOpacity(t01: number, cycles: number, low?: number): number; export declare function prefersReducedMotion(): boolean; export interface LayerEffect { /** t01 ∈ [0, 1] → the plain-prop patch for this frame. */ frame(t01: number): Record; /** What to do at the end: hold the final frame's patch, or clear it. */ end: "hold" | "clear"; /** Optional clock easing (see EASINGS) — applied before `frame`. */ easing?: (t: number) => number; /** Runs after the end state is applied — phase chaining (trace: draw → reveal → dissolve). */ onDone?(): void; } /** * Per-feature trace geometry (spec: "Effect verbs / per-feature trace") — * pure: a GeoJSON-ish feature (or bare geometry / flat row) → the outline * path with CUMULATIVE-DISTANCE timestamps, so the draw speed is uniform * around the perimeter regardless of vertex spacing. Polygon → outer ring; * MultiPolygon → EVERY part's outer ring, drawn in sequence longest-first * (one currentTime sweep, ring timestamps offset by the running total); * LineString → the line itself. * Returns null for untraceable geometry (points, missing geometry). */ export interface TraceSegment { path: [number, number][]; timestamps: number[]; } export declare function buildTraceOutline(feature: unknown): { segments: TraceSegment[]; total: number; } | null; export declare function cancelLayerEffect(core: RuntimeCore, layerId: string): void; export declare function cancelAllLayerEffects(core: RuntimeCore): void; export declare function runLayerEffect(core: RuntimeCore, layerId: string, durationMs: number, effect: LayerEffect): void;