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
| Name | Type | Description |
|---|---|---|
pick | CuboidDragPick | The layer and screen direction selected by a drag. |
dx | number | The horizontal pointer displacement in pixels. |
dy | number | The vertical pointer displacement in pixels. |
quarterPx | number | 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));72What it prints (run when this page was built)