Skip to the content

Kyuubuキューブ

Turn CSS 3D cubes by touch, keys or notation, reproduce a scramble from a seed, and follow a solve one named step at a time.

Kyuubu (キューブ) is the Japanese spelling of cube. About the name

Contents

Reference · Cube engine and views

viewMatrixfunction

The way the viewer looks at the cube: turned about the model's y (yaw), then tipped about the screen's x (pitch), in degrees.

Import it

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

Definition

function viewMatrix(yaw: number, pitch: number): Mat3

Parameters

NameTypeDescription
yawnumber

The viewing angle about model y, in degrees.

pitchnumber

The viewing angle about screen x, in degrees.

Returns

Mat3

The way the viewer looks at the cube: turned about the model's y (yaw), then tipped about the screen's x (pitch), in degrees.

Examples

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

console.log(viewMatrix(-30, -20));
[
  [ 0.8660254037844387, 0, -0.49999999999999994 ],
  [ 0.17101007166283433, 0.9396926207859084, 0.29619813272602386 ],
  [ 0.46984631039295416, -0.3420201433256687, 0.8137976813493738 ]
]

What it prints (run when this page was built)

View sourceEdit on GitHubMade from the source of @johnmorrisdotca/kyuubu 1.14.1.