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.
インポート
import { scrubPath } from "@johnmorrisdotca/kyuubu";
定義
function scrubPath(steps: readonly (readonly CubeMove[])[], from: number, to: number, shown?: number): ScrubPath
引数
| 名前 | 型 | 説明 |
|---|---|---|
steps | readonly (readonly CubeMove[])[] | The ordered steps of the solve. |
from | number | The starting step position. |
to | number | The destination step position. |
shown (省略可) | number | The maximum number of turns animated during a scrub. |
戻り値
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.
例
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] ] ] }出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。