KyuubuHandle型
リファレンスの説明と例は英語です。見出しと目次は日本語です。
What a parent can ask of the cube on the screen.
インポート
import type { KyuubuHandle } from "@johnmorrisdotca/kyuubu/react";
定義
type KyuubuHandle = {
turn: (move: CubeMove, options?: {
report?: boolean;
animate?: boolean;
}) => void;
setState: (state: string) => void;
resetLook: () => void;
setTheme: (theme: CubeTheme) => void;
state: () => string;
scramble: (moves: readonly CubeMove[], options?: {
animate?: boolean;
}) => void;
showHint: (moves: CubeMove | readonly CubeMove[] | null) => void;
};
メンバー
| 名前 | 型 | 説明 |
|---|---|---|
turn | (move: CubeMove, options?: { report?: boolean; animate?: boolean; }) => void | Turn a layer, animated; told to |
setState | (state: string) => void | Put the stickers as given, at once. |
resetLook | () => void | Back to the way it was first seen. |
setTheme | (theme: CubeTheme) => void | Change its colours, its plastic or the shape of its stickers, without redrawing it. |
state | () => string | The stickers once every turn asked for is done. |
scramble | (moves: readonly CubeMove[], options?: { animate?: boolean; }) => void | Scramble the cube with these turns: the last few turn quickly and the rest are made at once, unless |
showHint | (moves: CubeMove | readonly CubeMove[] | null) => void | Show on the cube how to make these moves (the layer lit, an arrow the way to drag), or nothing with null. The |
例
import type { KyuubuHandle } from "@johnmorrisdotca/kyuubu/react";
import { createRef } from "react";
const handle = createRef<KyuubuHandle>();
handle.current?.resetLook();
console.log(handle.current?.state());この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。