Skip to the content

Kyuubuキューブ

Turn CSS 3D cubes by touch, keys or notation, reproduce a scramble from a seed, and follow a solve one named step at a time.

Kyuubu (キューブ) is the Japanese spelling of cube. About the name

Contents

Reference · Cube engine and views

DragHinttype

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

Import it

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

Definition

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;
};

Members

NameTypeDescription
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.

Examples

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 ]

What it prints (run when this page was built)

View sourceEdit on GitHubMade from the source of @johnmorrisdotca/kyuubu 1.14.1.