readCuboidKey関数
リファレンスの説明と例は英語です。見出しと目次は日本語です。
What a key means on a cuboid, given the depth a digit before it set (1 where
none did): the cube's keys (readKey) without the turns of the whole cube.
On a layer that only half turns, the key turns it a half, whichever way
Shift says, because that is the only turn it has.
インポート
import { readCuboidKey } from "@johnmorrisdotca/kyuubu/cuboid";
定義
function readCuboidKey(key: string, shift: boolean, dims: CuboidDims, depth: number): CuboidKeyReading
引数
| 名前 | 型 | 説明 |
|---|---|---|
key | string | The pressed key, or the cuboid preset key for a lookup. |
shift | boolean | Whether Shift reverses the key’s turn. |
dims | CuboidDims | The cuboid’s x, y and z dimensions, in that order. |
depth | number | The layer depth counted from the named face, starting at 1. |
戻り値
CuboidKeyReading
What a key means on a cuboid, given the depth a digit before it set (1 where none did): the cube's keys (readKey) without the turns of the whole cube. On a layer that only half turns, the key turns it a half, whichever way Shift says, because that is the only turn it has.
例
import { readCuboidKey } from "@johnmorrisdotca/kyuubu/cuboid";
const dims = [2, 3, 3] as const;
console.log(readCuboidKey("u", false, dims, 1));{ move: { axis: 1, layer: 2, turns: 2 } }出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。