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
| Name | Type | Description |
|---|---|---|
angle | number | 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));1What it prints (run when this page was built)