Reference · Cube engine and views
moveForWheelfunction
The turn the wheel means over a sticker. across turns the layer that
carries it most nearly sideways, rolling the wheel down carrying it right;
upDown the layer that carries it most nearly up and down, down carrying it
down; face turns the face it is on, down turning it clockwise.
Import it
import { moveForWheel } from "@johnmorrisdotca/kyuubu";
Definition
function moveForWheel(slot: StickerSlot, n: number, view: Mat3, way: "across" | "upDown" | "face", down: boolean): CubeMove
Parameters
| Name | Type | Description |
|---|---|---|
slot | StickerSlot | The sticker’s centre and outward normal. |
n | number | The cube’s side length. |
view | Mat3 | The view matrix, or mounted CubeView for a guide. |
way | "across" | "upDown" | "face" | The wheel gesture: across, upDown or face. |
down | boolean | Whether the wheel rolls down. |
Returns
CubeMove
The turn the wheel means over a sticker. across turns the layer that carries it most nearly sideways, rolling the wheel down carrying it right; upDown the layer that carries it most nearly up and down, down carrying it down; face turns the face it is on, down turning it clockwise.
Examples
import { cubeSlots, moveForWheel, viewMatrix } from "@johnmorrisdotca/kyuubu";
const view = viewMatrix(-30, -20);
const slot = cubeSlots(3).slots[0]!;
console.log(moveForWheel(slot, 3, view, "face", true));{ axis: 1, layer: 2, turns: 3 }What it prints (run when this page was built)