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

scrubPathfunction

What moving the slider from one position of a solve to another turns: the steps between, forwards when going on and each one undone, last first, when going back. A jump of more than shown steps goes straight to shown steps short of the end and turns only those, so that a long drag catches up at once and does not play every turn. steps is each step's layers.

Import it

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

Definition

function scrubPath(steps: readonly (readonly CubeMove[])[], from: number, to: number, shown?: number): ScrubPath

Parameters

NameTypeDescription
stepsreadonly (readonly CubeMove[])[]

The ordered steps of the solve.

fromnumber

The starting step position.

tonumber

The destination step position.

shown (optional)number

The maximum number of turns animated during a scrub.

Returns

ScrubPath

What moving the slider from one position of a solve to another turns: the steps between, forwards when going on and each one undone, last first, when going back. A jump of more than shown steps goes straight to shown steps short of the end and turns only those, so that a long drag catches up at once and does not play every turn. steps is each step's layers.

Examples

import { parseMoves, parseSolve, scrubPath } from "@johnmorrisdotca/kyuubu";

const reading = parseSolve("R U", 3);
const steps = reading.steps;
const moves = parseMoves("R U2", 3)!;
console.log(scrubPath(steps.map((step) => step.moves), 0, 2));
{ from: 0, turns: [ [ [Object] ], [ [Object] ] ] }

What it prints (run when this page was built)

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