Reference · Rockets, variants, parts and the fit check
FlightClockclass
The clock of one timeline: where it is and whether it runs. It only moves when told to, once a frame by whoever draws, so a timeline out of sight stands still.
Import it
import { FlightClock } from "@johnmorrisdotca/uchusen-rockets";
Definition
class FlightClock
new FlightClock(flight: Flight): FlightClock
Parameters
| Name | Type | Description |
|---|---|---|
flight | Flight | The flight whose clock this is. |
Members
| Name | Type | Description |
|---|---|---|
flight | Flight | |
position | number | |
playing | boolean | |
ended | boolean | |
play | (): void | |
pause | (): void | |
seek | (position: number): void | |
advance | (seconds: number): void | Moves on by |
Examples
import { FlightClock, flightOf } from "@johnmorrisdotca/uchusen-rockets";
const flight = flightOf("falcon-9", "block-5");
if (flight) {
const clock = new FlightClock(flight);
clock.play();
clock.advance(2.4);
console.log(clock.position, clock.ended);
}1 falseWhat it prints (run when this page was built)