Skip to the content

Jarajaraジャラジャラ

Draw mahjong tiles, arrange racks and stacked boards, and play seeded Awase alone or at a shared table.

Jarajara is the Japanese sound of mahjong tiles rattling together. About the name

Contents

Reference · SVG faces and looks

tileAtfunction

Where a slot's tile face is drawn, raised by its layer along the thickness's direction. With a view that turns the board (mirror) the layout's width and height in half-tiles are needed too.

Import it

import { tileAt } from "@johnmorrisdotca/jarajara/faces";

Definition

function tileAt(slot: MahjongSlot, layers: number, mirror?: TileMirror, extent?: { width: number; height: number; }): { x: number; y: number; }

Parameters

NameTypeDescription
slotMahjongSlot

The zero-based slot index or slot coordinates specified by this signature.

layersnumber

The total number of stacked layers.

mirror (optional)"none" | "horizontal" | "vertical" | "both"

The native mirrored tile orientation.

extent (optional){ width: number; height: number; } | undefined

The complete layout width and height.

Returns

{ x: number; y: number; }

Where a slot's tile face is drawn, raised by its layer along the thickness's direction. With a view that turns the board (mirror) the layout's width and height in half-tiles are needed too.

Examples

import { layoutExtent, layoutFor } from "@johnmorrisdotca/jarajara";
import { tileAt } from "@johnmorrisdotca/jarajara/faces";

const layout = layoutFor(4)!;
console.log(tileAt(layout.slots[0],layoutExtent(layout).layers));
{ x: 5, y: 15 }

What it prints (run when this page was built)

View sourceEdit on GitHubMade from the source of @johnmorrisdotca/jarajara 1.7.0.