Skip to content

Type Alias: DieOptions ​

ts
type DieOptions = object;

Defined in: src/ui/die.ts:32

What a lone die is told when it is made. Everything may be left out.

Properties ​

sides? ​

ts
optional sides?: Sides;

Defined in: src/ui/die.ts:34

The kind of die: 2 to 1000 sides, or "F" for a Fate die. 6 when left out.


faces? ​

ts
optional faces?: CustomFace[];

Defined in: src/ui/die.ts:36

A die of your own: its faces, in order, in place of numbers. sides is then their count.


face? ​

ts
optional face?: number;

Defined in: src/ui/die.ts:38

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? ​

ts
optional rollable?: boolean;

Defined in: src/ui/die.ts:40

Whether a tap rolls it: true when left out. False is a die that only shows a face.


size? ​

ts
optional size?: DieSize;

Defined in: src/ui/die.ts:42

small, medium (unless said) or large. width wins.


width? ​

ts
optional width?: number;

Defined in: src/ui/die.ts:44

Its width in pixels, in place of size.


onePip? ​

ts
optional onePip?: "red" | "black";

Defined in: src/ui/die.ts:46

The colour of a d6's one pip: "red" (unless said) or "black".


cloth? ​

ts
optional cloth?: Cloth;

Defined in: src/ui/die.ts:48

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 is laid over it.


theme? ​

ts
optional theme?: Record<`--kk-${string}`, string>;

Defined in: src/ui/die.ts:50

CSS variables for the die, such as { "--kk-die": "#fff" }.


locale? ​

ts
optional locale?: string;

Defined in: src/ui/die.ts:52

"ja…" for Japanese, anything else English. The page's own language when left out.


strings? ​

ts
optional strings?: Partial<RollerStrings>;

Defined in: src/ui/die.ts:54

Words to use instead of the built-in ones.


source? ​

ts
optional source?: RandomSource;

Defined in: src/ui/die.ts:56

Where the throw comes from: seededSource("table") makes the same throws for everyone. Cryptographic when left out.


animationMs? ​

ts
optional animationMs?: number;

Defined in: src/ui/die.ts:58

The length of the tumble in milliseconds: 600 when left out. Reduced motion always skips it.


sound? ​

ts
optional sound?: boolean;

Defined in: src/ui/die.ts:60

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? ​

ts
optional playSound?: PlaySound;

Defined in: src/ui/die.ts:62

A sound of your own for each throw, in place of the recorded dice. Used only when sound is true.


onRoll? ​

ts
optional onRoll?: (face) => void;

Defined in: src/ui/die.ts:64

Called once the die has landed, with the face.

Parameters ​

face ​

number

Returns ​

void

MIT © John Morris