Reference · Cube engine and views
readKeyfunction
What a key means on a cube of side n, given the depth a digit before it set (1 where none did).
Import it
import { readKey } from "@johnmorrisdotca/kyuubu";
Definition
function readKey(key: string, shift: boolean, n: number, depth: number): KeyReading
Parameters
| Name | Type | Description |
|---|---|---|
key | string | The pressed key, or the cuboid preset key for a lookup. |
shift | boolean | Whether Shift reverses the key’s turn. |
n | number | The cube’s side length. |
depth | number | The layer depth counted from the named face, starting at 1. |
Returns
KeyReading
What a key means on a cube of side n, given the depth a digit before it set (1 where none did).
Examples
import { readKey } from "@johnmorrisdotca/kyuubu";
console.log(readKey("r", false, 3, 1));{ move: { axis: 0, layer: 2, turns: 3 } }What it prints (run when this page was built)