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

mountGuidefunction

A guide drawn in an element, for the cube in view: the view shows the hint, and a person makes each movement on it. The view must let a person turn it (interactive).

Import it

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

Definition

function mountGuide(host: HTMLElement, view: CubeView, options: GuidePanelOptions): GuideHandle

Parameters

NameTypeDescription
hostHTMLElement

The DOM element that receives the view and controls.

viewCubeView

The view matrix, or mounted CubeView for a guide.

optionsGuidePanelOptions

Options for this call; omitted fields retain their documented defaults.

Returns

GuideHandle

A guide drawn in an element, for the cube in view: the view shows the hint, and a person makes each movement on it. The view must let a person turn it (interactive).

Examples

import { CubeView, mountGuide } from "@johnmorrisdotca/kyuubu";

const host = document.createElement("div");
const panel = document.createElement("div");
host.style.cssText = "width:300px;height:300px;position:relative";
document.body.append(host, panel);
const cube = new CubeView(host, { size: 3, interactive: true });
const guide = mountGuide(panel, cube, { moves: "R U R' U'" });
console.log(guide.guide.next?.text);
// Call guide.destroy() and cube.destroy() when removing them.

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