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 · Cuboid player

CuboidPlayerHandletype

A cuboid player on the page.

Import it

import type { CuboidPlayerHandle } from "@johnmorrisdotca/kyuubu/cuboid/play";

Definition

type CuboidPlayerHandle = {
    readonly plan: CuboidReplayPlan | null;
    readonly fault: CuboidReplayFault | null;
    load(source: CuboidReplaySource, how?: {
        speed?: number;
        loop?: boolean;
        controls?: boolean;
        autoplay?: boolean;
    }): void;
    play(): void;
    pause(): void;
    step(by: 1 | -1): void;
    seek(position: number): void;
    restart(): void;
    setSpeed(speed: number): void;
    setLoop(loop: boolean): void;
    setLocale(locale: KyuubuLanguage): void;
    setTheme(theme: CubeTheme): void;
    setAnimateScrub(on: boolean): void;
    readonly animatingScrub: boolean;
    readonly status: ReplayStatus | null;
    readonly view: CuboidView;
    destroy(): void;
};

Members

NameTypeDescription
planCuboidReplayPlan | null

The solve as it was read, or why it could not be.

faultCuboidReplayFault | null
load(source: CuboidReplaySource, how?: { speed?: number; loop?: boolean; controls?: boolean; autoplay?: boolean; }): void

Another solve on the same puzzle, in place of the one showing. The speed and the repeat are kept unless given.

play(): void
pause(): void
step(by: 1 | -1): void

One step on (1) or back (-1).

seek(position: number): void

To the puzzle after this many steps.

restart(): void
setSpeed(speed: number): void
setLoop(loop: boolean): void
setLocale(locale: KyuubuLanguage): void
setTheme(theme: CubeTheme): void
setAnimateScrub(on: boolean): void

Whether moving the slider turns the puzzle between where it was and where it goes.

animatingScrubboolean

Whether it does.

statusReplayStatus | null
viewCuboidView

The puzzle as drawn, for a page that wants to look at it.

destroy(): void

Take it off the page, with every listener.

Examples

import type { CuboidPlayerHandle } from "@johnmorrisdotca/kyuubu/cuboid/play";
import { mountCuboidPlayer } from "@johnmorrisdotca/kyuubu/cuboid/play";

const value: CuboidPlayerHandle = mountCuboidPlayer(document.createElement("div"), { dims: [2, 3, 3], scramble: "R", solution: "R'", autoplay: false });
console.log(value.plan?.solved);

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