stackLayout関数
リファレンスの説明と例は英語です。見出しと目次は日本語です。
Where the cards of a stack lie, from neat to messy, the same every time for the same seed: the cards under the top one, bottom first, at most
depth of them, as the top card is the live one and lies square. A card's place depends on its number from the bottom, so a card put
on top moves none of those under it.
The idea and the three parameters (messiness, seed, depth) come from toranpu's pileLayout (github.com/johnmorrisdotca/toranpu,
src/ui/layout.ts, MIT). This is written again here for a stack that has a true thickness: a card's height is not faked by moving it
down the page, so only the nudge and the turn are laid out.
インポート
import { stackLayout } from "@johnmorrisdotca/fuda-cards";
定義
function stackLayout(count: number, options?: StackLayoutOptions): StackPlace[]
引数
| 名前 | 型 | 説明 |
|---|---|---|
count | number | How many cards the stack holds; with none or one there is nothing under the top. |
options (省略可) | StackLayoutOptions | How messy, which seed and how deep. Unless said: 0.3, 1 and 10. |
戻り値
StackPlace[]
The places of the cards under the top one, bottom first; empty for a stack of one.
例
import { stackLayout } from "@johnmorrisdotca/fuda-cards";
const same = JSON.stringify(stackLayout(52, { seed: 7 })) === JSON.stringify(stackLayout(52, { seed: 7 }));
console.log(same, stackLayout(1).length, stackLayout(52).length); // true 0 10true 0 10出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。