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

seamsAtfunction

The seams a touch at this place on a sticker is taking hold of, nearest first: where it lands within SEAM_BAND of a sticker's width of the line that parts the sticker's layer from the one beside it, along either of the two directions the sticker can be turned across. Each is a turn about an axis that takes both layers, and is made only if the drag that follows goes that way: a drag across the line, or begun anywhere else on the sticker, turns the one layer as ever. pointer is in pixels from the cube's middle, y down, as the cube is drawn; none on a 2×2, where both layers are the whole cube.

Import it

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

Definition

function seamsAt(slot: StickerSlot, n: number, view: Mat3, pointer: readonly [number, number], k: number, lens: number, band?: number): Seam[]

Parameters

NameTypeDescription
slotStickerSlot

The sticker’s centre and outward normal.

nnumber

The cube’s side length.

viewMat3

The view matrix, or mounted CubeView for a guide.

pointerreadonly [number, number]

The pointer position relative to the cube’s middle, in pixels with y down.

knumber

The model-to-screen drawing scale.

lensnumber

The perspective distance used to draw the cube.

band (optional)number

The fraction of a sticker’s width treated as a seam.

Returns

Seam[]

The seams a touch at this place on a sticker is taking hold of, nearest first: where it lands within SEAM_BAND of a sticker's width of the line that parts the sticker's layer from the one beside it, along either of the two directions the sticker can be turned across. Each is a turn about an axis that takes both layers, and is made only if the drag that follows goes that way: a drag across the line, or begun anywhere else on the sticker, turns the one layer as ever. pointer is in pixels from the cube's middle, y down, as the cube is drawn; none on a 2×2, where both layers are the whole cube.

Examples

import { cubeSlots, seamsAt, viewMatrix } from "@johnmorrisdotca/kyuubu";

const view = viewMatrix(-30, -20);
const slot = cubeSlots(3).slots[0]!;
console.log(seamsAt(slot, 3, view, [0, 0], 100, 600));
[]

What it prints (run when this page was built)

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