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

dragHintfunction

The drag that makes this turn, from the way the cube is looked at now (view, as viewMatrix makes it). Several layers about one axis, turned as far, are one slab and get one arrow across it; each layer is still turned by a drag of its own. Null for a turn of the whole cube, which no drag on a sticker makes, and for turns that are not one movement.

Import it

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

Definition

function dragHint(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

The drag that makes this turn, from the way the cube is looked at now (view, as viewMatrix makes it). Several layers about one axis, turned as far, are one slab and get one arrow across it; each layer is still turned by a drag of its own. null for a turn of the whole cube, which no drag on a sticker makes, and for turns that are not one movement.

Examples

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

const view = viewMatrix(-30, -20);
const move = parseMove("R", 3)!;
console.log(dragHint(move, 3, view));
{
  axis: 0,
  layers: [ 2 ],
  turns: 3,
  seam: false,
  slots: [
     2,  5,  8,  9, 10, 11, 12,
    13, 14, 15, 16, 17, 20, 23,
    26, 29, 32, 35, 45, 48, 51
  ],
  face: 'F',
  grab: 26,
  drag: [ 0, -1 ],
  quarters: -1,
  atOnce: true,
  arrow: {
    from: [ 2, -2, 3 ],
    along: [ 0, 1, 0 ],
    length: 4.7,
    width: 2,
    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.