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

rotationHintfunction

WHICH WAY TO TURN THE WHOLE CUBE: no drag on a sticker makes it (a key or a button does: x, y, z), so there is no sticker to take hold of, but the way it goes can still be drawn. The arrow lies across the middle of the side the axis goes through that is seen best, as long as the side allows, and runs the way every sticker on it travels; two heads for a half turn. The sides the axis comes out of never cross the screen, so none is drawn on.

Null for moves that are not one turn of the whole cube; face and arrow are null where none of the four sides can be seen well enough (look round first).

Import it

import { rotationHint } from "@johnmorrisdotca/kyuubu";

Definition

function rotationHint(moves: CubeMove | readonly CubeMove[], n: number, view: Mat3): DragHint | null

Parameters

NameTypeDescription
movesCubeMove | readonly CubeMove[]

The turns, in their execution order.

nnumber

The cube’s side length.

viewMat3

The view matrix, or mounted CubeView for a guide.

Returns

DragHint | null

WHICH WAY TO TURN THE WHOLE CUBE: no drag on a sticker makes it (a key or a button does: x, y, z), so there is no sticker to take hold of, but the way it goes can still be drawn. The arrow lies across the middle of the side the axis goes through that is seen best, as long as the side allows, and runs the way every sticker on it travels; two heads for a half turn. The sides the axis comes out of never cross the screen, so none is drawn on. null for moves that are not one turn of the whole cube; face and arrow are null where none of the four sides can be seen well enough (look round first).

Examples

import { rotationHint, viewMatrix, wholeMove } from "@johnmorrisdotca/kyuubu";

const view = viewMatrix(-30, -20);
console.log(rotationHint(wholeMove("x", "cw"), 3, view));
{
  axis: 0,
  layers: [ 0, 1, 2 ],
  turns: 3,
  seam: false,
  slots: [
     0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11,
    12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
    24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
    36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
    48, 49, 50, 51, 52, 53
  ],
  quarters: -1,
  atOnce: false,
  face: 'F',
  grab: null,
  drag: [ 0, -1 ],
  arrow: {
    from: [ 0, -2.6, 3 ],
    along: [ -0, 1, -0 ],
    length: 5.2,
    width: 6,
    normal: [ 0, 0, 1 ]
  }
}

What it prints (run when this page was built)

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