本文へ移動

Kyuubuキューブ

CSS 3Dのキューブをタッチ、キー、回転記号で回します。シードでスクランブルを再現し、名前付きの手順で解き方を追えます。

「キューブ」は、英語のcubeを表す日本語の表記です。 名前について(英語)

目次

リファレンス · キューブのエンジンと表示

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

引数

名前型説明
stepsreadonly (readonly CubeMove[])[]

The ordered steps of the solve.

fromnumber

The starting step position.

tonumber

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] ] ] }

出力(このページを作ったときに実行した結果)

ソースを見るGitHub で編集@johnmorrisdotca/kyuubu 1.14.1 のソースから作成しました。

この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。