本文へ移動

Toranpuトランプ

デッキを使い、11種類のゲームでコンピューターと対戦し、ソリティアを解いたり、独自の絵柄でカードを表示したりできます。

「トランプ」は、日本語で playing cards を指す言葉です。 名前について(英語)

目次

リファレンス

音の操作

import { … } from "@johnmorrisdotca/toranpu/card-sounds";

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

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

The sounds of a card table, from real recorded cards: a card dealt, turned over or played, the deck shuffled, a pile gathered in, a hand fanned. Off unless a table asks: nothing plays and nothing is fetched until play.

import { createCardSounds } from "@johnmorrisdotca/toranpu/card-sounds";

const sounds = createCardSounds();
sounds.play("shuffle");
sounds.play("deal", { count: 13, delay: 900 });

The recordings themselves are @johnmorrisdotca/toranpu/sounds, loaded by the first sound played. Kenney's Casino Audio, CC0: see docs/credits.md.

エクスポート

名前種類概要
CARD_SOUND_KINDS定数Every kind of sound, in the order a game meets them.
CardSoundData型The recordings, by name (deal-2), as base64 AAC.
CardSoundKind型One kind of sound: deal a card sent to a hand, flip a card turned over, play a card laid on the table, shuffle the deck shuffled, gather a pile swept in, fan a hand spread open.
CardSounds型A table's sounds: play one, mute and unmute, change the volume, close when the table goes.
CardSoundsOptions型How a table's sounds are made.
CardSoundWindow型The parts of a window the sounds use: an audio context and atob.
createCardSounds関数A table's card sounds.
MOST_SOUNDS_AT_ONCE定数As many sounds as one call plays: thirteen cards dealt are eight slides, not a wall of noise.
PlayCardSoundOptions型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.

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

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