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

layerOffunction

The layer, 0 to n − 1 from the axis's negative side, that a cubie centre sits in.

Import it

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

Definition

function layerOf(centre: Vec3, axis: CubeAxis, n: number): number

Parameters

NameTypeDescription
centreVec3

The cubie centre in doubled model coordinates.

axisCubeAxis

The model axis: 0 for x, 1 for y, or 2 for z.

nnumber

The cube’s side length.

Returns

number

The layer, 0 to n − 1 from the axis's negative side, that a cubie centre sits in.

Examples

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

console.log(layerOf([2, 2, 2], 0, 3));
2

What it prints (run when this page was built)

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