Reference · Rockets, variants, parts and the fit check
phaseAtfunction
Which phase a place on the timeline is in, and how far along to the next. A value that is not a number is the start.
Import it
import { phaseAt } from "@johnmorrisdotca/uchusen-rockets";
Definition
function phaseAt(flight: Flight, position: number): { index: number; along: number; phase: FlightPhase; }
Parameters
| Name | Type | Description |
|---|---|---|
flight | Flight | A flight. |
position | number | A place on the timeline: 0 is the first phase, 1 the second, 1.5 halfway to the third. |
Returns
{ index: number; along: number; phase: FlightPhase; }
The phase index, how far along to the next (0 to 1) and the phase.
Examples
import { flightOf, phaseAt } from "@johnmorrisdotca/uchusen-rockets";
const flight = flightOf("falcon-9", "block-5");
if (flight) console.log(phaseAt(flight, 1.5).phase.name);LiftoffWhat it prints (run when this page was built)