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 · Cuboid engine

cuboidDragAnglefunction

The angle, in degrees, a picked layer has been dragged to: forwards is positive, and it stops at a half turn either way. A layer that only half turns follows twice as fast, so that the whole half turn is as far a drag as a quarter of any other. quarterPx is the pixels that make a quarter turn.

Import it

import { cuboidDragAngle } from "@johnmorrisdotca/kyuubu/cuboid";

Definition

function cuboidDragAngle(pick: CuboidDragPick, dx: number, dy: number, quarterPx: number): number

Parameters

NameTypeDescription
pickCuboidDragPick

The layer and screen direction selected by a drag.

dxnumber

The horizontal pointer displacement in pixels.

dynumber

The vertical pointer displacement in pixels.

quarterPxnumber

The pointer distance in pixels that makes a quarter turn.

Returns

number

The angle, in degrees, a picked layer has been dragged to: forwards is positive, and it stops at a half turn either way. A layer that only half turns follows twice as fast, so that the whole half turn is as far a drag as a quarter of any other. quarterPx is the pixels that make a quarter turn.

Examples

import { cuboidDragAngle } from "@johnmorrisdotca/kyuubu/cuboid";

const cpick = { axis: 1 as const, layer: 0, along: [1, 0] as [number, number], halfOnly: true };
console.log(cuboidDragAngle(cpick, 40, 0, 100));
72

What it prints (run when this page was built)

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