本文へ移動

Toranpuトランプ

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

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

目次

リファレンス · カード・手札・山札

handLayout関数

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

Where each card of a hand of count lies: a fan when open, a squared-up stack with a sliver of each card showing when closed, and every shape in between. The middle card turns least; the first lies at x 0.

インポート

import { handLayout } from "@johnmorrisdotca/toranpu/element";

ほかのエクスポート元: @johnmorrisdotca/toranpu/element/define

定義

function handLayout(count: number, options?: HandLayoutOptions): CardPlace[]

引数

名前型説明
countnumber

The requested number of cards, sounds or layout positions.

options (省略可)HandLayoutOptions

Options for this call; omitted fields retain their documented defaults.

戻り値

CardPlace[]

Where each card of a hand of count lies: a fan when open, a squared-up stack with a sliver of each card showing when closed, and every shape in between. The middle card turns least; the first lies at x 0.

例

import { handLayout } from "@johnmorrisdotca/toranpu/element";

console.log(handLayout(3, { open: 1 }));
[
  { x: 0, y: 0.06, rotate: -4 },
  { x: 0.42, y: 0, rotate: 0 },
  { x: 0.84, y: 0.06, rotate: 4 }
]

出力(このページを作ったときに実行した結果)

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

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