/** The stages of the fly-through, in order. */ export type StageId = "map" | "city" | "arena" | "bowl" | "rink" | "game"; /** The stages that exist, in the order of the path. */ export declare const STAGE_IDS: readonly StageId[]; /** The channels of the camera. */ export declare const CHANNELS: readonly ["logSpan", "ax", "ay", "north", "map", "site", "arena", "yaw", "pitch", "logZoom", "logLens", "roof", "game"]; export type Channel = (typeof CHANNELS)[number]; /** * Where the camera is. `logSpan` is the natural logarithm of the metres the container's width shows (so that a zoom is a straight line); `ax` and `ay` are where the arena stands on the screen, as a * share of the width and of the height from the middle; `north` is how far the map and the site plan are turned, in degrees clockwise (the rink's long side lies along the page when it reaches the * venue's); `map`, `site` and `arena` are how much of the map, of the site plan and of the 3D arena shows (0 to 1); `yaw`, `pitch` and `logZoom` are the 3D view's turn and tip in degrees and the natural logarithm of its zoom; * `logLens` is the natural logarithm of the eye's lens, as a multiple of the stage's longer side (a long lens looks from far outside, a short one from inside the bowl), `roof` is how much of the building's roof shows and `game` how much of the * play on the ice shows (each 0 to 1). */ export type Camera = Record; /** What the path needs to know of the page and the venue. */ export interface FlightInput { /** How far the venue's plan is turned from north-up, in degrees clockwise (`venueOrientation(venue).north`). */ north: number; /** The metres the container's width shows when the 3D arena seen from straight above is as large as the site plan is: where the plan hands over to the 3D arena. */ siteSpan: number; /** The metres the width shows at the start, on the map. 9,000 km by default. */ startSpan?: number; /** The metres the width shows when the camera reaches the city. Eight times the site span, and at least 1.5 km, by default. */ citySpan?: number; /** Where the arena stands on the screen at the start and at the 3D arena, as shares of the width and the height from the middle: `[0, 0]` for both by default. */ anchorStart?: readonly [number, number]; anchorEnd?: readonly [number, number]; /** The stages to fly, in the order of the path (the others are left out, and the camera goes from where the stage before them ended): all by default. */ stages?: readonly StageId[]; /** The 3D view the arena settles in: the sport's main camera by default. */ view?: { yaw: number; pitch: number; }; /** Degrees a second the arena turns at, once it is turning: 12 by default. */ turn?: number; /** The seat's viewpoint the camera settles at in the bowl: the tip of the 3D view in degrees, its zoom and the eye's lens. 77, 2.8 and 1 by default. */ seat?: { pitch: number; zoom: number; lens: number; }; /** Degrees a second the rink turns at, from the seat: 8 by default. */ rinkTurn?: number; } /** A keyframe: the camera at a moment, and where it must be going where that is not what the neighbours say. */ export interface Keyframe { t: number; camera: Camera; /** Channels' speeds (units a second) to pass through this keyframe at, in place of the monotone cubic's own. */ slope?: Partial; } /** A path: the keyframes, where each stage starts, and what happens after the last keyframe. */ export interface Flight { keys: readonly Keyframe[]; /** The stages flown and the time each starts at, in order. */ stages: readonly { id: StageId; start: number; }[]; /** The time of the last keyframe. */ end: number; /** After `end`, the view goes on turning at this many degrees a second (negative: the near side goes to the right), and nothing else moves: the arena's turn, or the rink's from the seat. */ tail: number; /** The camera of each stage at rest: what a reader who prefers reduced motion is shown (one layer, nothing half-faded). */ rest: Readonly>; input: Required> & { anchorStart: readonly [number, number]; anchorEnd: readonly [number, number]; view: { yaw: number; pitch: number; }; }; } /** Zero to one with a zero slope at both ends. */ export declare const smooth: (t: number) => number; /** * The speeds a monotone cubic passes the keyframes of one channel at: zero at both ends and where the neighbours' slopes change sign (a plateau or a turning point), else the weighted harmonic mean of the * two slopes (Fritsch and Butland), which keeps every piece between its two values. */ export declare function monotoneSlopes(t: readonly number[], y: readonly number[]): number[]; /** The camera at a moment of a path. After the last keyframe the arena goes on turning and nothing else moves. Before the first, the first. */ export declare function cameraAt(flight: Flight, time: number): Camera; /** The stage a moment is in: the last whose start is not after it. */ export declare function stageAt(flight: Flight, time: number): StageId; /** When a stage starts, or `undefined` for a stage the path does not fly. */ export declare const startOf: (flight: Flight, id: StageId) => number | undefined; /** The stages a path flies, in order. */ export declare const stagesOf: (flight: Flight) => StageId[]; /** The seconds one turn of the arena takes once it is turning, and so how far a moment after the end can be brought back to without a change of view. */ export declare const turnPeriod: (flight: Flight) => number; /** A moment after the end brought back by whole turns of the arena to one near the end: the same view, and a time that does not grow without end. */ export declare function foldTime(flight: Flight, time: number): number; /** How a path is paced: the seconds of each part. `hold` is how long the arena turns, whole, before the camera goes in; `over` and `settle` the two parts of the way into the bowl; `stay` how long the rink turns bare before the play comes onto it, and `fade` how long the play takes to show. */ export declare const PACE: { readonly dwell: 1.6; readonly step: 1.25; readonly cityDwell: 0.9; readonly approach: 1.6; readonly rise: 0.8; readonly hand: 0.7; readonly tilt: 3.2; readonly hold: 3.5; readonly over: 2.2; readonly settle: 2.2; readonly stay: 2; readonly fade: 0.6; }; /** * The path from the map to the rink, for the stages asked (all by default): the map holds a moment, then the camera falls to the city in four even steps of the logarithm of the distance (the * map turning as it comes to the venue's own orientation and giving way to the site plan), holds there, comes in until the plan is as large as the 3D arena seen from above, the arena rises out of it, * tips to the sport's main camera and turns; then the roof lifts away and the camera comes in over the stands, the eye's lens shortening as it goes, and settles at a seat's viewpoint, from where the rink turns. */ export declare function flightPlan(input: FlightInput): Flight; /** The 3D view the arena settles in, as the sport's main camera: its yaw and pitch. */ export declare const mainView: (sport?: string) => { yaw: number; pitch: number; }; /** A glide of the clock from one moment of the path to another: zero to one with a zero slope at both ends, so that a skip starts and ends at rest. */ export declare const glide: (from: number, to: number, elapsed: number, seconds: number) => number; /** How long a skip over `distance` seconds of the path takes: quick, and never so long that a long skip is slow or so short that it is a cut. */ export declare const glideSeconds: (distance: number) => number; /** The seconds the clock takes to go from still to the path's pace and back. */ export declare const RAMP = 0.45; /** The speed the clock runs at after `dt` seconds: it goes to 1 while playing and to 0 when not, at one steady rate of change, reaching it in `RAMP` seconds and never at once. */ export declare function nextRate(rate: number, playing: boolean, dt: number): number; /** The metres in a degree of latitude on the sphere the venues' geometry uses, and its radius. */ export declare const METRES_PER_DEGREE: number; /** How a map's canvas relates to the ground round the arena: the canvas point it stands at and the metres one unit of the canvas is, across and down. */ export interface MapFrame { /** The arena on the map's canvas. */ at: readonly [number, number]; /** Metres in one canvas unit, along x and along y, at the arena. */ metresX: number; metresY: number; } /** * The map's frame at an arena, from the map's own projection: the canvas point of the arena and of a point a hundredth of a degree east of it and north of it give the metres a unit is, so that the * map can be drawn true to the ground round the arena (the world's projection is not, and a map stretched to be square on the ground there is the same map, stretched). `project` answers `null` where the map has no * place for a point, and then there is no frame. */ export declare function mapFrame(project: (lon: number, lat: number) => readonly [number, number] | null, lon: number, lat: number): MapFrame | undefined; /** * The viewBox of the map layer: a square of `metres` on the ground, centred on the arena, as canvas units (`metres` along x over the metres of a unit, and along y). Drawn into a square box with `preserveAspectRatio="none"`. */ export declare function mapBox(frame: MapFrame, metres: number): { x: number; y: number; w: number; h: number; }; /** The side, in pixels, of the square the map is drawn in so that it covers a `width` by `height` container whichever way it is turned about the arena, which stands at `(x, y)` in it. */ export declare const coverSide: (width: number, height: number, x: number, y: number) => number; /** A distance a scale bar can show: 1, 2 or 5 times a power of ten metres, the longest that fits in `maxPixels` at `metresPerPixel`. */ export declare function niceLength(metresPerPixel: number, maxPixels: number): number; /** A length in metres as a scale bar says it: `500 m`, `2 km`. */ export declare const lengthWords: (metres: number) => string;