import type { ReplayChange, ReplaySettings, ReplayState, ReplayTimeline } from "./replay.types.ts"; /** The speeds the controls offer. Any speed from the least to the greatest is allowed. */ export declare const REPLAY_SPEEDS: readonly number[]; /** The slowest and the fastest speed of play. */ export declare const REPLAY_SPEED_RANGE: readonly [number, number]; /** What `createReplay` gives back. */ export interface ReplayController { /** A copy of the state now. */ state(): Readonly; /** Start playing, from the start if it stopped at the end. In step mode, play moves one step and never plays by itself. */ play(): void; pause(): void; toggle(): void; /** Go to a time, in seconds on the timeline's clock; held to the first and last moments. */ seek(t: number): void; /** Pause and go to the next frame (1) or the one before (-1). In step mode, move `stepSeconds`. */ step(direction: 1 | -1): void; /** Move by seconds, backward or forward. */ jump(seconds: number): void; /** 0.25 to 4. */ setSpeed(speed: number): void; setLoop(loop: boolean): void; /** `step` for a reader who prefers reduced motion: playing stops, and play steps. */ setMotion(motion: "smooth" | "step"): void; /** Tell the clock that seconds went by: while playing, the time moves by that many seconds times the speed. */ advance(seconds: number): void; /** Be told of every change. Returns a function that stops it. */ subscribe(listener: (change: ReplayChange) => void): () => void; } /** * The controller of a replay: a state machine over a timeline's clock. It plays, pauses, seeks, steps by a frame, changes speed, loops, and says which * events went by in each move so that they can be announced. It never reads a clock or the page: `advance(seconds)` is how time passes. * @example * ```ts * import { createReplay } from "@johnmorrisdotca/kyogijo-stadiums/replay"; * const frames = [0, 1, 2, 3, 4].map((t) => ({ t, objects: [{ id: "ball", team: "ball" as const, x: t * 10, y: 0 }] })); * const replay = createReplay({ frames, events: [{ t: 2, kind: "goal" }] }, { speed: 2 }); * replay.play(); * replay.advance(1.5); * console.log(replay.state().t, replay.state().playing); * replay.advance(5); * console.log(replay.state().t, replay.state().playing, replay.state().ended); * // 3 true * // 4 false true * ``` */ export declare function createReplay(timeline: ReplayTimeline, settings?: ReplaySettings): ReplayController;