pixi-wheels

Ring

pixi-wheels


pixi-wheels / index / Ring

Class: Ring

Defined in: core/Ring.ts:55

One spinning disc with its sections, pointers and skin.

A single-ring wheel is one of these under a Wheel; a wheel with an inner and an outer ring is two, sharing the centre and the event stream. Built by WheelBuilder; consumers reach it through wheel.main or wheel.ring(id).

Extends#

  • Container

Implements#

Constructors#

Constructor#

new Ring(params: RingParams): Ring;

Defined in: core/Ring.ts:93

Parameters#

ParameterType
paramsRingParams

Returns#

Ring

Overrides#

Container.constructor

Properties#

PropertyModifierTypeDescriptionDefined in
discreadonlyContainer<ContainerChild>Rotates with the wheel.core/Ring.ts:62
eventsreadonlyEventEmitter<WheelEvents>-core/Ring.ts:60
geometryreadonlyRingGeometry-core/Ring.ts:59
idreadonlystring-core/Ring.ts:56
idlereadonly{ get isActive(): boolean; start: (config?: IdleConfig) => void; stop: () => void; }-core/Ring.ts:296
idle.isActivepublicboolean-core/Ring.ts:305
idle.startpublic(config?: IdleConfig) => void-core/Ring.ts:297
idle.stoppublic() => void-core/Ring.ts:304
innerRadiusreadonlynumber-core/Ring.ts:58
outerRadiusreadonlynumber-core/Ring.ts:57
overlayreadonlyContainer<ContainerChild>Fixed. Pointers and static decoration.core/Ring.ts:64
pointersreadonlyreadonly Pointer[]-core/Ring.ts:65
skinreadonlyRingSkin-core/Ring.ts:66

Accessors#

activeSpeed#

Get Signature#

get activeSpeed(): string;

Defined in: core/Ring.ts:271

Returns

string


controller#

Get Signature#

get controller(): SpinController;

Defined in: core/Ring.ts:203

The controller, for the debug snapshot.

Returns

SpinController


direction#

Get Signature#

get direction(): SpinDirection;

Defined in: core/Ring.ts:185

Returns

SpinDirection


isDestroyed#

Get Signature#

get isDestroyed(): boolean;

Defined in: core/Ring.ts:456

Returns

boolean

Implementation of#

Disposable.isDestroyed


isSpinning#

Get Signature#

get isSpinning(): boolean;

Defined in: core/Ring.ts:193

Returns

boolean


pegs#

Get Signature#

get pegs(): ResolvedPegs | null;

Defined in: core/Ring.ts:212

The pegs the tongues touch, resolved against the current geometry. Null when the ring has none.

Returns

ResolvedPegs | null


profile#

Get Signature#

get profile(): SpinProfile;

Defined in: core/Ring.ts:275

Returns

SpinProfile


rotationDeg#

Get Signature#

get rotationDeg(): number;

Defined in: core/Ring.ts:173

Disc rotation in degrees (clockwise positive), unbounded.

Returns

number

Set Signature#

set rotationDeg(deg: number): void;

Defined in: core/Ring.ts:177

Parameters
ParameterType
degnumber
Returns

void


rotationNormalized#

Get Signature#

get rotationNormalized(): number;

Defined in: core/Ring.ts:450

Normalised rotation, 0..360.

Returns

number


sections#

Get Signature#

get sections(): readonly ResolvedSection[];

Defined in: core/Ring.ts:207

Returns

readonly ResolvedSection[]


speed#

Get Signature#

get speed(): number;

Defined in: core/Ring.ts:198

Signed angular speed of the last frame, deg/s.

Returns

number


speedNames#

Get Signature#

get speedNames(): string[];

Defined in: core/Ring.ts:267

Returns

string[]


state#

Get Signature#

get state(): SpinState;

Defined in: core/Ring.ts:189

Returns

SpinState


step#

Get Signature#

get step(): number | null;

Defined in: core/Ring.ts:313

The step the ring is on, when built with .dynamic({ steps }).

Returns

number | null


stepCount#

Get Signature#

get stepCount(): number;

Defined in: core/Ring.ts:317

Returns

number

Methods#

addSpeed()#

addSpeed(name: string, profile: SpinProfile): void;

Defined in: core/Ring.ts:290

Parameters#

ParameterType
namestring
profileSpinProfile

Returns#

void


destroy()#

destroy(): void;

Defined in: core/Ring.ts:460

Removes all internal references and listeners as well as removes children from the display list. Do not use a Container after calling destroy.

Returns#

void

Example#

container.destroy();
container.destroy(true);
container.destroy({ children: true });
container.destroy({ children: true, texture: true, textureSource: true });

Implementation of#

Disposable.destroy

Overrides#

Container.destroy

localAngleUnderPointer()#

localAngleUnderPointer(pointerId?: string): number;

Defined in: core/Ring.ts:237

The wheel-local angle under a pointer right now.

Parameters#

ParameterType
pointerId?string

Returns#

number


nextStep()#

nextStep(options?: WeightTransitionOptions): Promise<void>;

Defined in: core/Ring.ts:337

Move to the next step, wrapping around.

Parameters#

ParameterType
options?WeightTransitionOptions

Returns#

Promise<void>


requestSkip()#

requestSkip(): void;

Defined in: core/Ring.ts:257

Returns#

void


sectionUnderPointer()#

sectionUnderPointer(pointerId?: string): ResolvedSection;

Defined in: core/Ring.ts:230

The section under a pointer right now (the first pointer by default).

Parameters#

ParameterType
pointerId?string

Returns#

ResolvedSection


setResult()#

setResult(target: WheelTarget, landing?: LandingOptions): void;

Defined in: core/Ring.ts:249

Parameters#

ParameterType
targetWheelTarget
landing?LandingOptions

Returns#

void


setSpeed()#

setSpeed(name: string): void;

Defined in: core/Ring.ts:279

Parameters#

ParameterType
namestring

Returns#

void


setStep()#

setStep(index: number, options?: WeightTransitionOptions): Promise<void>;

Defined in: core/Ring.ts:325

Move to a dynamic step: apply its weights, animated by default. The promise resolves when the boundaries have finished moving.

Parameters#

ParameterType
indexnumber
optionsWeightTransitionOptions

Returns#

Promise<void>


setWeights()#

setWeights(weights: Record<string, number>, options?: WeightTransitionOptions): Promise<void>;

Defined in: core/Ring.ts:347

Change section weights directly. Animated unless durationMs is 0. Purely cosmetic: a spin already in flight keeps its planned landing.

Parameters#

ParameterType
weightsRecord<string, number>
optionsWeightTransitionOptions

Returns#

Promise<void>


skip()#

skip(): boolean;

Defined in: core/Ring.ts:253

Returns#

boolean


slamStop()#

slamStop(): void;

Defined in: core/Ring.ts:261

Returns#

void


spin()#

spin(options?: SpinOptions): Promise<WheelSpinResult>;

Defined in: core/Ring.ts:245

Parameters#

ParameterType
options?SpinOptions

Returns#

Promise<WheelSpinResult>


update()#

update(deltaMS: number): void;

Defined in: core/Ring.ts:412

Advance one frame. Called from the ticker; call directly with a fake ticker in tests.

Parameters#

ParameterType
deltaMSnumber

Returns#

void