placesFor関数
リファレンスの説明と例は英語です。見出しと目次は日本語です。
Where each part stands: up the stack joint to joint, or spread apart on a diagonal of the ground, or one part alone.
インポート
import { placesFor } from "@johnmorrisdotca/uchusen-rockets";
定義
function placesFor(parts: readonly { slot: string; part: PartRecord; }[], show: string, widthOf: WidthOf): Place[]
引数
| 名前 | 型 | 説明 |
|---|---|---|
parts | readonly { slot: string; part: PartRecord; }[] | The parts with their slots, from the bottom. |
show | string | What to show. |
widthOf | WidthOf | The width of a part, for spacing when they are apart. |
戻り値
Place[]
A place for each part.
例
import { build } from "@johnmorrisdotca/uchusen-rockets/build";
import { placesFor } from "@johnmorrisdotca/uchusen-rockets";
const rocket = build({ rocket: "falcon-9", variant: "block-5" });
const parts = rocket.parts.map((part) => ({ slot: part.slot, part: part.record }));
console.log(placesFor(parts, "apart", (part) => part.diameter / 2).map((place) => place.slot));[ 'first-stage', 'second-stage', 'fairing' ]出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。