import { type RaceRow } from "./pool.race.ts"; import type { ReplayEvent, ReplayTimeline } from "./replay.types.ts"; import type { Language, SurfaceOptions } from "./types.ts"; /** What a race replay is made with. */ export interface RaceReplayOptions { /** Frames a second. 10 by default. */ fps?: number; /** Seconds of waiting before the start signal and of staying on after the last touch. 1.5 and 3 by default. */ lead?: number; tail?: number; /** The language of the events' words. English by default. */ language?: Language; /** The reaction time of a swimmer that has none, in seconds. 0.7 by default. */ reaction?: number; /** How far behind the wall a swimmer on the block stands, in metres. 0.4 by default. */ block?: number; } /** The marks of a swimmer's progress: the seconds after the start signal at which the swimmer has swum each distance, from the splits (and the final time). */ export interface Progress { /** Distance in metres against the seconds after the signal; the first point is the reaction time at 0 m. */ points: [number, number][]; /** Whether the swimmer is a swimmer in the water at all (a swimmer who did not start stays on the block). */ swims: boolean; } /** The progress of one row over a race of `distance` metres with a split every `every` metres. */ export declare function progressOf(row: RaceRow, distance: number, every: number, reaction: number): Progress; /** The metres a swimmer has swum `t` seconds after the signal, by straight lines between the points of progress; before the reaction it is 0, after the last it stays. */ export declare function distanceAt(progress: Progress, t: number): number; /** The place along the pool, in metres from the starting wall, of a swimmer who has swum `d` metres in a pool of `length`: down the first length, back the next. */ export declare function alongPool(d: number, length: number): number; /** * The replay of a race by lane. Give the options of a swimming drawing (`{ pool: { race } }`, with a `course` and `lanes` if they are not the 50 m pool's of eight): each swimmer with splits is played back from them. * The timeline is in the pool's frame (`from: "swimming"`) in metres; its events are the turns at the walls and the finish, each with the swimmer's name and, at the finish, the time. * @throws TypeError when the options have no race, RangeError for a race with no swimmer that has splits or a time. * @example * ```ts * import { raceTimeline, drawFrame } from "@johnmorrisdotca/kyogijo-stadiums/replay"; * const pool = { race: { distance: 100, swimmers: [{ lane: 4, name: "A. Swimmer", splits: [26, 54.2] }, { lane: 5, name: "B. Swimmer", splits: [26.4, 55] }] } }; * const timeline = raceTimeline({ pool }); * console.log(timeline.frames.length > 100, timeline.events.map((e) => e.kind).join(), drawFrame({ sport: "swimming", pool }, timeline, 20).startsWith(", replay?: RaceReplayOptions): ReplayTimeline & { events: ReplayEvent[]; };