Angle maths for ring widgets: angleDelta, wrapAngle, snapTo, rubberBand.
import { AngleAccumulator, TAU, angleDelta, clamp } from 'pixi-silk/ui/arc';
Classes#
| Class | Description |
|---|
| AngleAccumulator | Follows a pointer around a centre and counts full turns, so dragging past the seam keeps adding up instead of jumping back by a turn. total is the angle travelled since reset. |
Variables#
| Variable | Description |
|---|
| TAU | A full turn in radians, 2 * Math.PI. |
Functions#
| Function | Description |
|---|
| angleDelta | Signed shortest turn from b to a, in -PI..PI radians. Inputs can be any size. |
| clamp | Clamps v to min..max. Expects min <= max. |
| rubberBand | Soft limit: inside min..max the value passes through, past a limit it keeps moving but slows down and never goes further than limit beyond it (the rubber band of scroll views). A limit of 0 or less is a hard clamp. |
| snapTo | Rounds value to the nearest origin + k * step. A step of 0 or less returns value unchanged. |
| wrapAngle | Wraps an angle of any size into 0..TAU radians. |