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
| Name | Type | Description |
|---|---|---|
steps | readonly (readonly CubeMove[])[] | The ordered steps of the solve. |
from | number | The starting step position. |
to | number | 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)