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

partedHandLayoutfunction

A HAND PARTED AT ONE CARD: that card lifted a little, upright and wholly in view, and the cards to its left and right drawn apart from it into a group on each side (one group where it is the first or the last). The groups close up to make room, down to a sliver of each card, so the hand keeps the room its fan takes wherever it can; a hand too short to close up that far takes a little more. Built on the open fan of handLayout, its dip and turn kept for every card but the one parted. Where at is no card of the hand, the fan itself.

partedHandLayout(7, 3); // three cards squared up on the left, the fourth lifted clear, three on the right

Import it

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

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

Definition

function partedHandLayout(count: number, at: number, options?: HandLayoutOptions & PartOptions): CardPlace[]

Parameters

NameTypeDescription
countnumber

The requested number of cards, sounds or layout positions.

atnumber

The zero-based split or card position.

options (optional)HandLayoutOptions & PartOptions

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

Returns

CardPlace[]

A HAND PARTED AT ONE CARD: that card lifted a little, upright and wholly in view, and the cards to its left and right drawn apart from it into a group on each side (one group where it is the first or the last). The groups close up to make room, down to a sliver of each card, so the hand keeps the room its fan takes wherever it can; a hand too short to close up that far takes a little more. Built on the open fan of handLayout, its dip and turn kept for every card but the one parted. Where at is no card of the hand, the fan itself. ts partedHandLayout(7, 3); // three cards squared up on the left, the fourth lifted clear, three on the right

Examples

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

console.log(partedHandLayout(3, 1, { gap: 30 }));
[
  { x: 0, y: 0.06, rotate: -4 },
  { x: 31, y: -0.2, rotate: 0 },
  { x: 62, 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.