Skip to the content

Toranpuトランプ

Use a deck, play eleven games with computers, solve a solitaire, or display cards in your own design.

Toranpu is Japanese for playing cards. About the name

Contents

Reference · Cards, hands and piles

handLayoutfunction

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 it

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

Also exported from: @johnmorrisdotca/toranpu/element/define

Definition

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

Parameters

NameTypeDescription
countnumber

The requested number of cards, sounds or layout positions.

options (optional)HandLayoutOptions

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

Returns

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.

Examples

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 }
]

What it prints (run when this page was built)

View sourceEdit on GitHubMade from the source of @johnmorrisdotca/toranpu 2.15.0.