DieOptions型
リファレンスの説明と例は英語です。見出しと目次は日本語です。
What a lone die is told when it is made. Everything may be left out.
インポート
import type { DieOptions } from "@johnmorrisdotca/korokoro";
定義
type DieOptions = {
sides?: Sides;
faces?: CustomFace[];
face?: number;
rollable?: boolean;
size?: DieSize;
width?: number;
onePip?: "red" | "black";
cloth?: Cloth;
theme?: Record<`--kk-${string}`, string>;
locale?: string;
strings?: Partial<RollerStrings>;
source?: RandomSource;
animationMs?: number;
sound?: boolean;
playSound?: PlaySound;
onRoll?: (face: number) => void;
};
メンバー
| 名前 | 型 | 説明 |
|---|---|---|
sides (省略可) | Sides | undefined | The kind of die: 2 to 1000 sides, or "F" for a Fate die. 6 when left out. |
faces (省略可) | CustomFace[] | undefined | A die of your own: its faces, in order, in place of numbers. |
face (省略可) | number | undefined | The face showing at first, from 1 (from −1 for a Fate die). Left out, the highest face of the die, or a 6 on a d6. |
rollable (省略可) | boolean | undefined | Whether a tap rolls it: true when left out. False is a die that only shows a face. |
size (省略可) | DieSize | undefined |
|
width (省略可) | number | undefined | Its width in pixels, in place of |
onePip (省略可) | "red" | "black" | undefined | The colour of a d6's one pip: |
cloth (省略可) | "green" | "blue" | "red" | "black" | "wood" | undefined | A cloth's name, for the page's own colours to follow the tray's: only the ink and the die's edge on a felt. |
theme (省略可) | Record<`--kk-${string}`, string> | undefined | CSS variables for the die, such as |
locale (省略可) | string | undefined | "ja…" for Japanese, anything else English. The page's own language when left out. |
strings (省略可) | Partial<RollerStrings> | undefined | Words to use instead of the built-in ones. |
source (省略可) | RandomSource | undefined | Where the throw comes from: |
animationMs (省略可) | number | undefined | The length of the tumble in milliseconds: 600 when left out. Reduced motion always skips it. |
sound (省略可) | boolean | undefined | Whether a throw makes the sound of dice. Off when left out, because a die on its own is a thing on somebody's page, and a page that has not asked for noise gets none. |
playSound (省略可) | PlaySound | undefined | A sound of your own for each throw, in place of the recorded dice. Used only when |
onRoll (省略可) | ((face: number) => void) | undefined | Called once the die has landed, with the face. |
例
import type { DieOptions } from "@johnmorrisdotca/korokoro";
const value: DieOptions = { sides: 20, face: 6, sound: false };
console.log(value.sides);20出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。