CuboidViewOptions型
リファレンスの説明と例は英語です。見出しと目次は日本語です。
Everything a cuboid on the screen can be told when it is made. Only dims is needed.
インポート
import type { CuboidViewOptions } from "@johnmorrisdotca/kyuubu/cuboid/draw";
定義
type CuboidViewOptions = {
dims: CuboidDims;
state?: string;
colours?: Partial<Record<CubeFace, string>>;
plastic?: string;
theme?: CubeTheme;
rounded?: boolean;
locale?: KyuubuLanguage;
interactive?: boolean;
keyboard?: "focus" | "page" | "none";
turnMs?: number;
commitAngle?: number;
yaw?: number;
pitch?: number;
fill?: number;
onTurn?: (move: CuboidMove, state: string) => void;
onLook?: (yaw: number, pitch: number) => void;
label?: string;
};
メンバー
| 名前 | 型 | 説明 |
|---|---|---|
dims | CuboidDims | The puzzle's width, height and depth: each 1 to 7, and not 1×1×1. |
state (省略可) | string | undefined | The stickers, one letter each ( |
colours (省略可) | Partial<Record<"U" | "R" | "F" | "D" | "L" | "B", string>> | undefined | Colours for the six faces, by the letter a solved face carries. A face left out takes its CSS custom property ( |
plastic (省略可) | string | undefined | The colour of the plastic between stickers and inside the puzzle. Left out, it is |
theme (省略可) | CubeTheme | undefined | A whole look at once: colours, plastic and the shape of a sticker. |
rounded (省略可) | boolean | undefined | Whether the puzzle's corners are rounded, like the plastic of a real one: true when left out. |
locale (省略可) | KyuubuLanguage | undefined | The language of the puzzle's accessible name: English or Japanese. Left out, it follows the page's |
interactive (省略可) | boolean | undefined | Whether a person can turn it. A look-only puzzle still turns when asked ( |
keyboard (省略可) | "focus" | "page" | "none" | undefined | Where the keys are listened for: the puzzle itself once it has focus (the default), the whole page, or nowhere. |
turnMs (省略可) | number | undefined | How long a quarter turn takes, in milliseconds, when it is made by a key, by notation or from code: 160 when left out. A device that asks for reduced motion gets no animation, whatever this says. |
commitAngle (省略可) | number | undefined | The point of no return of a dragged layer that turns by quarters, in degrees: 30 when left out. From 5 to 85. |
yaw (省略可) | number | undefined | How the puzzle is first seen: turned about its up axis, in degrees. |
pitch (省略可) | number | undefined | How the puzzle is first seen: tipped towards the viewer, in degrees. |
fill (省略可) | number | undefined | How much of the space the puzzle fills, 0 to 1. |
onTurn (省略可) | ((move: CuboidMove, state: string) => void) | undefined | A turn a person made, with the stickers once it is done. |
onLook (省略可) | ((yaw: number, pitch: number) => void) | undefined | Every time the view is turned, for anything that wants to keep it. |
label (省略可) | string | undefined | What a screen reader calls the puzzle. Left out, it is "A 2×3×3 cuboid" in the puzzle's language. |
例
import type { CuboidViewOptions } from "@johnmorrisdotca/kyuubu/cuboid/draw";
const value: CuboidViewOptions = { dims: [2, 3, 3], interactive: true, keyboard: "focus" };
console.log(value.dims);[ 2, 3, 3 ]出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。