shipLevels関数
リファレンスの説明と例は英語です。見出しと目次は日本語です。
A ship in two passes: the coarse pieces of every module at once, for a first picture, and the fine pass as one batch of pieces for each module, nearest first if order says so. Adding the batches one after another
gives the same ship as shipPieces at the fine level; a viewer adds one a frame, so the picture never waits for the detail.
インポート
import { shipLevels } from "@johnmorrisdotca/uchusen-rockets";
定義
function shipLevels(ship: ShipList, options?: ModuleOptions, order?: readonly number[]): { coarse: Piece[]; fine: () => Generator<{ place: number; pieces: Piece[]; }>; }
引数
| 名前 | 型 | 説明 |
|---|---|---|
ship | ShipList | The ship's list. |
options (省略可) | ModuleOptions | What to draw, for every module. |
order (省略可) | readonly number[] | undefined | The places in the order the fine pass should take them. Left out: the order of the list. |
戻り値
{ coarse: Piece[]; fine: () => Generator<{ place: number; pieces: Piece[]; }>; }
The coarse pieces, and a function that yields the fine batches.
例
import { SAMPLE_SHIPS, shipLevels } from "@johnmorrisdotca/uchusen-rockets";
const { coarse, fine } = shipLevels(SAMPLE_SHIPS.scout);
console.log(coarse.length, [...fine()].length);43 11出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。