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

quartersForReleasefunction

What letting go makes of a dragged layer: the quarter turns it snaps to, from −2 to 2, where 0 is back where it was and no move at all.

Short of the point of no return (commitAngle) it goes back; from there up to the same distance past a quarter turn it is one quarter turn; further is a half turn. A flick, still moving fast the way it was dragged, makes the quarter turn from short of the point. speed is in degrees a millisecond, signed like the angle.

Import it

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

Definition

function quartersForRelease(angle: number, speed?: number, commitAngle?: number): -2 | -1 | 0 | 1 | 2

Parameters

NameTypeDescription
anglenumber

The signed drag angle in degrees.

speed (optional)number

The signed drag speed in degrees per millisecond.

commitAngle (optional)number

The drag angle in degrees at which a resting release commits a turn.

Returns

0 | 1 | -1 | 2 | -2

What letting go makes of a dragged layer: the quarter turns it snaps to, from −2 to 2, where 0 is back where it was and no move at all. Short of the point of no return (commitAngle) it goes back; from there up to the same distance past a quarter turn it is one quarter turn; further is a half turn. A flick, still moving fast the way it was dragged, makes the quarter turn from short of the point. speed is in degrees a millisecond, signed like the angle.

Examples

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

console.log(quartersForRelease(60, 0));
1

What it prints (run when this page was built)

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