Reference · Rolls and exact odds
SoundThrowtype
The sound of a roll: a shake while the dice tumble and a knock as each one lands. The recordings are real dice (see SOUNDS.md), loaded the first time a tray with its sound on rolls and never before, so a page that stays silent never fetches them. Where they cannot be loaded or decoded, a short knock made in the browser stands in. Nothing here throws: a platform with no audio, a blocked context or a failed decode is simply silent.
Import it
import type { SoundThrow } from "@johnmorrisdotca/korokoro";
Definition
type SoundThrow = {
dice: number;
ms: number;
landings: number[];
};
Members
| Name | Type | Description |
|---|---|---|
dice | number | How many dice were thrown. |
ms | number | How long the tumble lasts, in milliseconds. Nought when the dice land at once. |
landings | number[] | When each die lands, in milliseconds from the throw, in the order thrown. |
Examples
import type { SoundThrow } from "@johnmorrisdotca/korokoro";
const value: SoundThrow = { dice: 2, ms: 300, landings: [150, 300] };
console.log(value.landings);[ 150, 300 ]What it prints (run when this page was built)