Skip to content
pixi-silk
GitHub repository
Class

AngleAccumulator

import { AngleAccumulator } from 'pixi-silk/ui/arc';

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.

Constructors#

Constructor#

new AngleAccumulator(): AngleAccumulator;

Returns#

AngleAccumulator

Properties#

PropertyTypeDefault valueDescriptionDefined in
totalnumber0Angle travelled since the last reset, any size, signed (positive is clockwise on screen).ui/arc.ts:37

Methods#

push()#

push(x: number, y: number): number;

Adds the turn towards (x, y) to total and returns that step, in -PI..PI radians.

Parameters#

ParameterType
xnumber
ynumber

Returns#

number


reset()#

reset(x: number, y: number): void;

Starts counting from the direction of (x, y), relative to the centre. Sets total to 0.

Parameters#

ParameterType
xnumber
ynumber

Returns#

void