本文へ移動

Dominoドミノ

シード付きでドミノを配り、標準のルールとコンピューターでメキシカントレインを遊び、保存したゲームを再生します。

「ドミノ」は、英語の domino をそのまま日本語に取り入れた言葉です。 名前について(英語)

目次

リファレンス

音の操作

import { … } from "@johnmorrisdotca/domino/tile-sounds";

最小化と gzip 圧縮をしたサイズは 19.3 kB(読み込むものをすべて含み、esbuild で計測)

リファレンスの説明と例は英語です。見出しと目次は日本語です。

THE SOUNDS OF A DOMINO TABLE: tiles shuffled, a tile drawn from the boneyard, a tile laid, a knock on the table for a pass. The recordings are poker chips set down and handled (Kenney's Casino Audio, CC0; see CREDITS.md), the nearest recorded sound of a hard tile on a table that is free to use. They are loaded the first time a sound is played and never before, so a page that stays silent never fetches them. Where they cannot be loaded or decoded, a short sound made in the browser stands in. Nothing here throws: a platform with no audio, a context the browser holds still, or a failed decode is simply silent.

Domino never makes a sound by itself. A table asks for one with play.

エクスポート

名前種類概要
createTileSounds関数A table's tile sounds.
MOST_SOUNDS_AT_ONCE定数As many sounds as one call plays: fifteen tiles drawn are eight clicks, not a wall of noise.
PlayTileSoundOptions型How one sound is played.
soundTimes関数When each of count sounds starts, in milliseconds from the first: one every gap, and no more than MOST_SOUNDS_AT_ONCE, spread over the same time.
TILE_SOUND_KINDS定数Every kind of sound, in the order a game meets them.
TileSoundData型The recordings, by name (lay-2), as base64 AAC.
TileSoundKind型One kind of sound: shuffle the tiles stirred face down, draw a tile taken from the boneyard, lay a tile set down on a train, knock a rap on the table, which is how a pass is announced.
TileSounds型A table's sounds: play one, mute and unmute, change the volume, close when the table goes.
TileSoundsOptions型How a table's sounds are made.
TileSoundWindow型The parts of a window the sounds use: an audio context and atob.

ソースを見るGitHub で編集@johnmorrisdotca/domino 1.1.4 のソースから作成しました。

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