本文へ移動

Kyuubuキューブ

CSS 3Dのキューブをタッチ、キー、回転記号で回します。シードでスクランブルを再現し、名前付きの手順で解き方を追えます。

「キューブ」は、英語のcubeを表す日本語の表記です。 名前について(英語)

目次

リファレンス · キューブのエンジンと表示

DragHint型

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

What to drag to make a turn of one layer, or of several about one axis as one (a wide turn).

インポート

import type { DragHint } from "@johnmorrisdotca/kyuubu";

定義

type DragHint = {
    axis: CubeAxis;
    layers: number[];
    turns: CubeTurns;
    seam: boolean;
    slots: number[];
    face: CubeFace | null;
    grab: number | null;
    drag: [
        number,
        number
    ] | null;
    quarters: 1 | -1 | 2;
    atOnce: boolean;
    arrow: HintArrow | null;
};

メンバー

名前型説明
axisCubeAxis

The turn's axis.

layersnumber[]

The layers that turn, counted from the axis's negative side.

turnsCubeTurns

How far, by the right-hand rule.

seamboolean

Whether the turn is of two neighbouring layers on a cube of 3 or more: one drag that begins on the seam between them, at the tail of the arrow, or two fingers at once, turns both together.

slotsnumber[]

Every sticker those layers carry, as indexes into the state: the stickers to light.

face"U" | "R" | "F" | "D" | "L" | "B" | null

The face the arrow lies on, or null where no side of the layer can be seen well enough from here: look round the cube first.

grabnumber | null

The sticker to take hold of, at the arrow's tail, in the first of the layers; null with face, and for a turn of the whole cube, which no sticker is taken hold of for.

drag[number, number] | null

The way to drag across the screen (x right, y down), as a unit vector; null with face.

quarters1 | -1 | 2

What a drag along the arrow makes, as quartersForRelease counts it: 1 or −1 a quarter turn, 2 a half turn (twice as far, or two quarter turns the same way).

atOnceboolean

Whether the layer is picked as soon as the drag begins (DRAG_START_PX), or only once it has gone DRAG_DECIDE_PX: the arrow is right either way.

arrowHintArrow | null

The arrow to draw; null with face.

例

import type { DragHint } from "@johnmorrisdotca/kyuubu";
import { dragHint, parseMove, viewMatrix } from "@johnmorrisdotca/kyuubu";

const value: DragHint = dragHint(parseMove("R", 3)!, 3, viewMatrix(-30, -20))!;
console.log(value.layers);
[ 2 ]

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

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

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