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

PlayerOptionstype

How a player is set up: the solve, and how it is shown.

Import it

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

Definition

type PlayerOptions = ReplaySource & {
    autoplay?: boolean;
    loop?: boolean;
    controls?: boolean;
    speed?: number;
    theme?: CubeTheme;
    cloth?: Cloth;
    guide?: boolean;
    readout?: boolean;
    moveList?: boolean;
    animateScrub?: boolean;
    locale?: KyuubuLanguage;
    onChange?: (status: ReplayStatus) => void;
    onEnd?: () => void;
};

Members

NameTypeDescription
size (optional)number | undefined

The cube's side: 3 when left out.

scramblestring

The scramble, as written.

solutionstring

The solve, as written; comments and brackets are skipped.

timeMs (optional)number | undefined

How long the solve took, in milliseconds, when that is known.

stepMs (optional)readonly number[] | undefined

How long each step of the solution took, in milliseconds, when that is known; one for every step.

autoplay (optional)boolean | undefined

Start playing as soon as it is drawn.

loop (optional)boolean | undefined

Begin again when it ends.

controls (optional)boolean | undefined

Show the controls: true unless said otherwise. A cube with none still plays when autoplay is set.

speed (optional)number | undefined

The speed it starts at: 1 is the solve's own pace.

theme (optional)CubeTheme | undefined

The cube's colours.

cloth (optional)"green" | "blue" | "red" | "black" | "wood" | undefined

The cloth the stage behind the cube is laid in: "green", "blue", "red", "black" or "wood", the family's five. With none, the stage is clear.

guide (optional)boolean | undefined

Start with the cube for the viewer to turn themselves, the solve's next move shown on it, rather than played for them.

readout (optional)boolean | undefined

Show the code of the move just made in large type, with what it turns in words, and say it to a screen reader as it changes. True unless said otherwise; with controls: false, off unless this says true.

moveList (optional)boolean | undefined

Show the moves as buttons, the one just made marked and scrolled into view, each one taking the replay to it. True unless said otherwise; with controls: false, off unless this says true.

animateScrub (optional)boolean | undefined

Whether moving the slider, or choosing a move, turns the cube between where it was and where it goes: forwards going on, each turn undone going back, a long jump catching up at once. True unless said otherwise.

locale (optional)KyuubuLanguage | undefined

English or Japanese; the page's lang when left out.

onChange (optional)((status: ReplayStatus) => void) | undefined

Called after every step, and whenever it starts, stops or is moved.

onEnd (optional)(() => void) | undefined

Called each time the end is reached.

Examples

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


const value: PlayerOptions = { size: 3, scramble: "R", solution: "R'", autoplay: false };
console.log(value.size);
3

What it prints (run when this page was built)

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