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

dragAnglefunction

The angle, in degrees, a picked layer has been dragged to: forwards is positive, and it stops at a half turn either way. quarterPx is the pixels that make a quarter turn.

Import it

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

Definition

function dragAngle(pick: DragPick, dx: number, dy: number, quarterPx: number): number

Parameters

NameTypeDescription
pickDragPick

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. quarterPx is the pixels that make a quarter turn.

Examples

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

const pick = { axis: 0 as const, layer: 2, along: [1, 0] as [number, number] };
console.log(dragAngle(pick, 40, 0, 100));
36

What it prints (run when this page was built)

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