本文へ移動

Kyuubuキューブ

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

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

目次

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

mountGuide関数

リファレンスの説明と例は英語です。見出しと目次は日本語です。

A guide drawn in an element, for the cube in view: the view shows the hint, and a person makes each movement on it. The view must let a person turn it (interactive).

インポート

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

定義

function mountGuide(host: HTMLElement, view: CubeView, options: GuidePanelOptions): GuideHandle

引数

名前型説明
hostHTMLElement

The DOM element that receives the view and controls.

viewCubeView

The view matrix, or mounted CubeView for a guide.

optionsGuidePanelOptions

Options for this call; omitted fields retain their documented defaults.

戻り値

GuideHandle

A guide drawn in an element, for the cube in view: the view shows the hint, and a person makes each movement on it. The view must let a person turn it (interactive).

例

import { CubeView, mountGuide } from "@johnmorrisdotca/kyuubu";

const host = document.createElement("div");
const panel = document.createElement("div");
host.style.cssText = "width:300px;height:300px;position:relative";
document.body.append(host, panel);
const cube = new CubeView(host, { size: 3, interactive: true });
const guide = mountGuide(panel, cube, { moves: "R U R' U'" });
console.log(guide.guide.next?.text);
// Call guide.destroy() and cube.destroy() when removing them.

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

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