本文へ移動

Karakuriからくり

8つの標準のパズルで遊び、探索や再現できる物理を使い、ポインターやキーボードで操作する盤を表示できます。

「からくり」は、仕組みや工夫した装置を表す言葉です。 名前について(英語)

目次

リファレンス · パズルの盤の要素

KarakuriElementOptions型

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

Full native host options; attributes take priority over starting choices.

インポート

import type { KarakuriElementOptions } from "@johnmorrisdotca/karakuri/element";

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

定義

type KarakuriElementOptions = Partial<MountOptions>;

メンバー

名前型説明
game (省略可)"save-the-character" | "pin-rescue" | "nuts-and-bolts" | "stretch-grabber" | "grid-escape" | "rope-cut" | "tube-sort" | "choice-story" | undefined
controller (省略可)Controller | undefined

A matching host-owned controller, for preserving an existing position.

keyboard (省略可)boolean | undefined

Allow a focused canvas to use the keyboard. Default true.

keyboardStep (省略可)number | undefined

Arrow movement in game units; Shift always moves one unit. Default 10.

level (省略可)number | undefined

The level to start on, from 1.

lang (省略可)KarakuriLanguage | undefined

en or ja; the page's own language when left out.

ui (省略可)"full" | "board" | undefined

full (default) draws the bar above the board, the result card on it and the buttons below; board draws the board alone, for a page that has its own buttons.

room (省略可)(() => number) | undefined

The most height, in pixels, the board may take now. A page that puts something above or under the board says how much room is left (it is asked again whenever the board is fitted: on a resize, and when the box it sits in changes size). By default most of the window: 82% of its height, less 120 pixels for the bar and buttons when ui is full.

clock (省略可)"real" | "manual" | undefined

real (default) steps with the display; manual steps only when advance is called, for a test that must see exact frames.

onStatus (省略可)((event: StatusEvent) => void) | undefined

Called whenever the level's status changes (and once at the start, as playing).

onChange (省略可)((event: StatusEvent) => void) | undefined

Called after each move, release or step that changed what is shown (the bar's line included).

例

import type { KarakuriElementOptions } from "@johnmorrisdotca/karakuri/element";
const options: KarakuriElementOptions = { game: "tube-sort", keyboardStep: 10 };
console.log(options.game);
tube-sort

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

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

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