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

PlayerHandletype

A player on the page.

Import it

import type { PlayerHandle } from "@johnmorrisdotca/kyuubu/player";

Definition

type PlayerHandle = {
    readonly plan: ReplayPlan | null;
    readonly fault: ReplayFault | null;
    load(source: ReplaySource, how?: {
        speed?: number;
        loop?: boolean;
        controls?: boolean;
        autoplay?: boolean;
        guide?: 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;
    follow(on: boolean): void;
    readonly following: boolean;
    readonly status: ReplayStatus | null;
    destroy(): void;
};

Members

NameTypeDescription
planReplayPlan | null

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

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

Another solve on the same cube, 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 cube 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 cube between where it was and where it goes.

animatingScrubboolean

Whether it does.

follow(on: boolean): void

Hand the cube to the viewer to turn, the next move shown on it (true), or take it back to be played (false).

followingboolean

Whether the viewer is turning it themselves.

statusReplayStatus | null
destroy(): void

Take it off the page, with every listener.

Examples

import type { PlayerHandle } from "@johnmorrisdotca/kyuubu/player";
import { mountPlayer } from "@johnmorrisdotca/kyuubu/player";

const value: PlayerHandle = mountPlayer(document.createElement("div"), { scramble: "R", solution: "R'", autoplay: false });
console.log(value.plan?.solved);

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