本文へ移動

Fuda Cards札

画像やライブ3Dを入れるコレクション用のカード枠です。本物の厚み、縁、箔、山、傷み、バインダーを、2つのWebコンポーネントで使えます。

「札(ふだ)」は、カードや札を指す日本語です。 名前について(英語)

目次

リファレンス · 設定、素材、山、傷み

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[]

引数

名前型説明
countnumber

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 10
true 0 10

出力(このページを作ったときに実行した結果)

ソースを見るGitHub で編集@johnmorrisdotca/fuda-cards 0.11.0 のソースから作成しました。

この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。