import { type Camera, type StageId } from "./flythrough.path.ts"; import type { Language } from "./types.ts"; /** A map to start on: chizu's world (or any map of the same shape) with chizu's `drawChizu` and `projectPoint`, which are handed over, not imported, so that the package has no dependency. */ export interface FlythroughStart { /** The map: chizu's `WORLD`, for instance. */ map?: M; /** Draws the map as an SVG string: chizu's `drawChizu`. It is called with `{ style: true, language }`. */ draw?: (map: M, options: { style: boolean; language: Language; }) => string; /** Puts a longitude and latitude on the map's canvas: chizu's `projectPoint`; `null` where the map has no place for it. */ project?: (map: M, lon: number, lat: number) => readonly [number, number] | null; /** The metres the container's width shows at the start. 9,000 km by default. */ span?: number; /** Where the camera starts looking, `[longitude, latitude]`: the arena stands off the middle of the screen and comes to the middle as the camera falls. The arena itself by default. */ centre?: readonly [number, number]; } /** What a fly-through is of. */ export interface FlythroughOptions { /** The arena's key in `ARENAS`: an arena that has a real venue (`VENUE_IDS`). */ arena: string; start?: FlythroughStart; /** The stages to fly, in the order of the path; all of them by default. */ stages?: readonly StageId[]; language?: Language; /** `light` or `dark`; the device's setting decides when it is left out. */ theme?: "light" | "dark"; /** Whether the building has its roof (true when left out): the roof is there over the arena and lifts away as the camera comes into the bowl. `false` keeps the roof off for the whole flight, the walls still standing, so that the bowl is seen from the first stage of the arena. */ roof?: boolean; } /** How it behaves. */ export interface FlythroughSettings { /** `auto` (the default) flies unless the reader prefers reduced motion, and then shows each stage as a still; `smooth` flies anyway and `none` shows stills. */ motion?: "auto" | "smooth" | "none"; /** Whether it starts flying when it is mounted (it does by default, unless the reader prefers reduced motion). */ autoPlay?: boolean; /** How many times faster than the path's own pace the clock runs. 1 by default. */ speed?: number; /** Whether the buttons under the stage are drawn. True when left out; the keys work either way. */ controls?: boolean; /** The prefix of the ids in the page, for a page with more than one. */ id?: string; /** Called with the stage when the camera enters one. */ onStage?: (stage: StageId) => void; /** Called with `true` when it starts flying and `false` when it stops. */ onPlayChange?: (playing: boolean) => void; } /** What `mountFlythrough` gives back. */ export interface Flythrough { /** `motion` flies; `stages` shows each stage as a still. */ readonly mode: "motion" | "stages"; readonly playing: boolean; /** The stage the camera is in. */ readonly stage: StageId; /** The stages flown, in order. */ readonly stages: readonly StageId[]; /** Seconds along the path now. */ readonly time: number; /** The seconds the path takes from the first stage to the last one's start (and then the arena turns for ever). */ readonly duration: number; /** The camera now. */ camera(): Camera; play(): void; pause(): void; /** Play when paused, pause when playing; gives whether it plays now. */ toggle(): boolean; /** Go to the stage after this one (the last one stays), and to the one before (the first starts again). */ next(): void; back(): void; /** Go to a stage (its name or its place in `stages`): the camera glides there along the path, or shows its still. */ goTo(stage: StageId | number): void; /** Put the camera at a moment of the path at once, whatever the mode (a scrubber, a test). */ seek(seconds: number): void; destroy(): void; } /** * Mount a fly-through of an arena in a container: a map that falls to the city and the building, which rises into the arena in 3D, turning. * @example * ```ts no-run * import { mountFlythrough } from "@johnmorrisdotca/kyogijo-stadiums/flythrough"; * import WORLD from "@johnmorrisdotca/chizu/world"; * import { drawChizu } from "@johnmorrisdotca/chizu/draw"; * import { projectPoint } from "@johnmorrisdotca/chizu"; * * const trip = mountFlythrough(document.querySelector("#trip")!, { arena: "honda-center", start: { map: WORLD, draw: drawChizu, project: projectPoint } }); * trip.goTo("city"); * ``` */ export declare function mountFlythrough(host: HTMLElement, options: FlythroughOptions, settings?: FlythroughSettings): Flythrough;