index
pixi-wheels / index
index
Classes#
| Class | Description |
|---|---|
| DebugRingSkin | The plain skin: flat alternating fills, section index and id, the start angle of every section, degree marks on the disc and a line at every pointer. Nothing pretty, everything legible. Use it while wiring a wheel, or as the base of a headless-looking recipe. |
| EventEmitter | Typed event emitter with zero dependencies. |
| GraphicsPointerSkin | A pointer drawn with Graphics. The out-of-the-box tongue. |
| GraphicsRingSkin | The default look: painted wedges, dividers, a rim, a hub and fitted labels. Good enough to ship a prototype, and every colour comes from the section styles so a config alone changes the palette. |
| HeadlessRingSkin | A skin that draws nothing. What the headless test harness uses. |
| Pointer | A pointer: the fixed mark a ring is read against. |
| Ring | One spinning disc with its sections, pointers and skin. |
| RingBuilder | Configures one ring. Reached through WheelBuilder.ring(id, (r) => ...); the wheel builder’s own section methods are this, for the main ring. |
| RingGeometry | The sections of one ring, laid out around the circle. |
| SectionLabels | One label per section, placed at the section’s middle angle. Shared by the graphics, texture and Spine skins so labels behave the same everywhere: radial, tangential or upright, fitted to the room the section has, and re-centred every time a dynamic section moves. |
| SpinController | The spin state machine of one ring. |
| TexturePointerSkin | A pointer that is a sprite. Bring the game’s own stopper art. |
| TextureRingSkin | A skin for a pre-rendered wheel: the game’s own painted disc as one texture, an optional static frame, and optional per-section sprites that the geometry keeps centred. Sections stay logical (weights, ids, values): the engine still knows where each one is, it just does not paint them. |
| TickerRef | Safe wrapper around PixiJS Ticker subscriptions. |
| Wheel | A bonus wheel: one or more rings sharing a centre and one typed event stream. Place it like any container; everything else goes through the methods below. |
| WheelBuilder | Fluent construction of a Wheel. Validates on build() and throws a message that names the missing or conflicting call. |
Interfaces#
| Interface | Description |
|---|---|
| AnticipationOptions | - |
| AssetResolver | Resolves asset keys named in a serialised config to loaded textures. |
| DebugOverlayHandle | Contract for objects that allocate resources and need cleanup. |
| DebugOverlayOptions | - |
| DebugRingSnapshot | - |
| DebugSectionSnapshot | One section in a snapshot. Plain numbers, rounded for reading. |
| DebugSnapshot | Plain-JSON state of the whole wheel. No PixiJS objects, no cycles: it serialises, so an agent that cannot see the canvas can still read it. |
| Disposable | Contract for objects that allocate resources and need cleanup. |
| DynamicSectionsConfig | A named set of dynamic steps plus how the wheel moves between them. |
| FitOptions | - |
| FlapConfig | The pointer flap: how the tongue behaves against the pegs. |
| GraphicsPointerSkinOptions | - |
| GraphicsRingSkinOptions | - |
| IdleConfig | Slow rotation while nothing is happening, so a wheel parked beside the reels reads as live. |
| LabelContext | What a content factory receives: the section, its geometry and the room it has. |
| LabelSlot | The room a label has inside its wedge. width/height are the fit box, oriented like the label. |
| LabelSlotOptions | - |
| LandingOptions | - |
| PegConfig | The pegs a tongue touches: small circles on the disc, one per divider by default. They give the pointer flap its physics and the debug overlay draws them; a skin may draw them too (GraphicsRingSkin pegs). |
| PlanSkipInput | - |
| PlanStopInput | - |
| PointerConfig | A pointer (“tongue”, “flapper”, “stopper”): the fixed mark the wheel is read against. A ring may have several, at different angles. |
| PointerConfigEntry | A pointer in a config: its placement plus a serialised skin. |
| PointerCrossing | A divider crossing, as Pointer.update() reports it. |
| PointerSkin | The visual of a pointer. Drawn in a local space where the pin (the point it pivots around) is at (0, 0) and the tip is at (+length, 0). The ring positions and rotates the view so the tip faces the hub or the rim. |
| PointerSkinConfig | - |
| PointerSkinConfigGraphics | - |
| PointerSkinConfigTexture | The serialised form of TexturePointerSkinOptions: the texture by asset key. |
| PointerSpec | A pointer as the builder accepts it: placement plus a skin instance or config. |
| ResolvedAnticipation | A bait with its geometry resolved against the ring. Built by the ring, consumed here. |
| ResolvedPegs | The pegs with their geometry resolved against the ring. |
| ResolvedSection | A section with its geometry resolved. Angles are wheel-local degrees: they rotate with the disc. startAngle is where the section begins going clockwise; endAngle = startAngle + arc. Both are kept unnormalised and increasing across the ring so endAngle of section i equals startAngle of section i + 1. |
| ResolvedSectionStyle | Every style field resolved, as a skin receives it. |
| ResolvedTarget | A target after the ring’s geometry has been consulted. |
| ResolveTargetOptions | - |
| RingConfig | One ring, serialised. |
| RingGeometryOptions | - |
| RingParams | - |
| RingSkin | How a ring looks. The ring owns the motion (rotation, sections, pointers); a skin owns the pixels. Swap GraphicsRingSkin for TextureRingSkin or a Spine skin and nothing about the spin changes. |
| RingSkinConfig | A skin as a serialised config: the shape the studio exports and WheelBuilder.fromConfig() reads. type picks a registered factory; the rest is that factory’s options. Asset references are string keys resolved through an AssetResolver. |
| RingSkinConfigTexture | The serialised form of TextureRingSkinOptions: textures by asset key. |
| RingSkinContext | What a ring hands its skin when the skin is attached. |
| SectionStyle | Per-section look. Everything is optional: a section with no style gets the skin’s palette colour for its index and the skin’s default label style. Skins that draw from textures or Spine ignore the paint fields and only read the label ones. |
| SettleConfig | - |
| Size | - |
| SkipConfig | What a player’s skip press is allowed to do. |
| SpinHost | What the controller needs from its ring. Kept as an interface so the controller is testable without PixiJS. |
| SpinOptions | Options for a single spin() call. |
| SpinProfile | A spin’s timing. Speeds are degrees per second; times are milliseconds. SpinPresets ships a few; builder.speed(name, profile) registers your own. |
| StopLeg | One piece of a planned stop: cover distance degrees in duration ms along ease, forwards unless reverse. A plan is a list of these played back to back, so anticipation, skip and settle are all the same machinery. |
| StopPlan | - |
| TargetAdapterConfig | A serialisable description of how to read a wheel target out of a server response: which field, interpreted how. This is the shape the studio exports and createTargetAdapter compiles. |
| TexturePointerSkinOptions | - |
| TextureRingDecoration | - |
| TextureRingSkinOptions | - |
| WeightTransitionOptions | Options for an animated weight change. |
| WheelConfig | A whole wheel as JSON. What the studio exports, what WheelBuilder.fromConfig() builds from, and what builder.toConfig() gives back. Asset references (textures, Spine aliases) are string keys resolved at build time. |
| WheelEvents | Every event a wheel emits. One emitter per wheel; every payload names the ring it came from ('main' for single-ring wheels), so a two-ring wheel needs no second subscription. |
| WheelParams | - |
| WheelResultOptions | Options for wheel.setResult(): a ring plus the landing options. |
| WheelSectionConfig | One section as the consumer authors it. |
| WheelSpinOptions | Options for wheel.spin(): a ring to spin plus the per-spin options. |
| WheelSpinResult | What spin() resolves with. |
Type Aliases#
| Type Alias | Description |
|---|---|
| AnticipationStyle | The shape of a near-miss. The wheel decelerates once and comes to rest once, on the result: no style stops somewhere else and moves on. The pointer rests just inside the target, next to the divider it shares with the bait (rest), so the miss reads as “by a hair”. |
| DebugHudPlacement | Where the HUD panel goes, in screen pixels on the wheel’s root container (the stage). Corners on the right or bottom need screen; { x, y } pins it exactly; false draws no panel. |
| DebugOverlayLayer | Overlay layers. - sections divider lines on the disc, plus an upright pill just inside the rim with each section’s id and start angle. - pointers a marker at every pointer angle and a pill with the local angle under it. - pegs the pegs the tongues touch, the peg being ridden, and each tongue’s contact zone. - target the landing angle of the current result: a line on the disc and a pill naming it. - hud a panel per ring in screen space: state, rotation, speed, current leg, section under the pointer, flap. |
| DynamicStep | A step in a dynamic-section sequence: the weights every named section takes when the wheel moves to that step. Sections not named keep their current weight. |
| Ease | An ease, as the name of a built-in curve or a function. |
| EaseFn | A normalised easing function: f(0) = 0, f(1) = 1. |
| FitMode | How content meets the box it is fitted into. |
| LabelContent | Anything a section shows instead of a text label: a Text, a Sprite, a BitmapText, a Spine instance, a whole Container of them. Pass the object, or a factory that builds it once from the section’s context. The label layer positions, rotates and fits it like a text label; it is re-fitted whenever the geometry changes. Code only: toConfig() keeps label and drops content. |
| LabelOrientation | How a label sits in its wedge. |
| LandingMode | Where inside the target section the pointer ends up. |
| LogLevel | How much the library is allowed to say. Each level includes the ones before it. |
| PointerFacing | Which way a pointer’s tip faces. |
| PointerSkinFactory | - |
| RingSkinFactory | - |
| SettleMode | What the wheel does once the pointer has reached the landing angle. |
| SpinDirection | - |
| SpinState | Where a ring is in its life. |
| StopLegKind | What one leg of a stop is for. Drives events and debug output; the motion is the same. |
| TickerCallback | - |
| WheelTarget | Where a spin should land, as the server or the game decides it. |
| WheelTemplateName | - |
Variables#
| Variable | Description |
|---|---|
| DEFAULT_ANTICIPATION | Timing and rest of a near-miss when AnticipationOptions leaves them out. |
| DEFAULT_FLAP | - |
| DEFAULT_LANDING | - |
| DEFAULT_PALETTE | A palette that reads on a dark casino background and keeps neighbouring sections distinct even for eight or more wedges. Cycled by section index. |
| DEFAULT_PEGS | Pegs when a ring asks for them without details. |
| DEFAULT_POINTER | - |
| DEFAULT_SETTLE | - |
| DEFAULT_SKIP | - |
| DEFAULTS | - |
| DEG_TO_RAD | Degrees to radians. |
| EASE_NAMES | Every ease name resolveEase accepts, for error messages and pickers. |
| NO_ASSETS | An asset resolver that throws on any key: for configs that reference no assets. |
| OVERLAY_LABEL | - |
| RAD_TO_DEG | Radians to degrees. |
| SpinPresets | Ready-made spin feels. Register them by name and switch at run time. |
| WHEEL_CONFIG_VERSION | The current config schema version. Bumped when a field changes meaning. |
| WHEEL_TEMPLATE_NAMES | The template names, for pickers. |
| WheelTemplates | Ready-made wheel configs for the common shapes. Each is a plain WheelConfig: load one into WheelBuilder.fromConfig(), or copy the JSON into the studio and tune it there. |
Functions#
| Function | Description |
|---|---|
| arcDelta | The positive angular distance travelled when rotating in direction from from to to, in [0, 360). Clockwise is the direction of increasing PixiJS rotation (screen y points down). |
| assertWheelConfig | Structural check on a config object from an untrusted source (a file, a form). Throws a message that names the first problem. The builder runs the deeper validation (section ids, radii, eases) on build(). |
| chordAt | Straight-line width across an arc of arcDeg degrees at radius. |
| constantAccelEase | The position curve of a constant-acceleration leg between two speeds. Normalised so f(0) = 0, f(1) = 1; the duration that makes this leg physically consistent is 2 * distance / (v0 + v1). |
| createPointerSkin | - |
| createRingSkin | - |
| createTargetAdapter | Compile an adapter config into a function from any response to a WheelTarget. |
| debugArc | The ring unrolled into a line of text: every section as a box whose width is its arc, and a caret under the pointer. Read the wheel without seeing it. |
| debugOverlay | Draw the wheel’s invisible geometry over it: dividers with their angles, pointer markers with the local angle under them, the pegs and the tongue’s contact, the planned landing angle, and a HUD panel per ring. Everything a developer stares at the canvas to guess is written out, at a readable size whatever scale the wheel is drawn at. |
| debugRingSnapshot | - |
| debugSnapshot | - |
| directionSign | +1 for a clockwise spin (rotation increases), -1 for counter-clockwise. |
| enableDebug | Attach the debug handle to window.__PIXI_WHEELS_DEBUG. |
| fitContainer | Scale any container (a Text, a Sprite, a Spine, a group) so its local bounds fit box. Sets obj.scale uniformly and returns the factor. Measure happens on the unscaled local bounds, so calling it again is idempotent. |
| fitText | Fit a Text by lowering its font size instead of scaling its transform, so glyphs stay sharp. Leaves the scale at 1. Returns the font size it settled on. Up to four measure passes; minFontSize (default 6) is the floor. |
| getLogLevel | The active LogLevel. |
| hermiteStopEase | A stop curve that begins already moving: position goes 0 to 1 with initial slope startSlope (normalised: speed * duration / distance) and zero slope at the end. Monotonic for slopes in 0..3. Lets a leg take over from a slow crawl without a velocity step. |
| initialSlope | Numeric slope of an ease at t = 0, as a multiple of the average slope (which is 1 for a normalised curve). The stop planner divides by this to match the wheel’s cruise speed at the start of the deceleration, so the hand-off from cruise to stop has no velocity step. |
| isAngleInArc | Whether angle lies inside the arc that starts at start and sweeps clockwise (increasing) for arc degrees. The start edge is inclusive, the end edge exclusive, so every angle belongs to exactly one section. |
| labelSlot | Compute the box a section offers a label at a given radius: the chord across the wedge there, and the radial room between hub and rim around that point. SectionLabels uses it for every label; use it yourself to size custom content in a content factory or a skin. |
| localAngleUnderPointer | The wheel-local angle under a pointer, given the disc rotation. A point on the disc at local angle a appears on screen at a + rotation, so the screen angle pointer is over local pointer - rotation. |
| normalizeDeg | Wrap an angle into [0, 360). |
| pickTurns | Choose how many full turns a stop should make. |
| planSettle | The legs a settle adds after landing. center glides the shortest way to the section’s middle; bounce overshoots and springs back. |
| planSkip | The fast-forward a skip plays: the shortest forward path to the landing, padded to at least a third of a turn so a slam never reads as a snap. |
| planStop | Plan the deceleration from the current state to the landing rotation. |
| readPath | Read a dotted path (a.b.0.c) off an object. Throws when a step is missing. |
| registerBuiltinSkins | Register the built-in skin config types. Called from WheelBuilder.build() so a config-driven wheel always finds graphics, debug, texture, headless and the two pointer skins - a value import a bundler cannot drop, where a side-effect-only import could be. |
| registeredPointerSkinTypes | - |
| registeredRingSkinTypes | - |
| registerPointerSkin | - |
| registerRingSkin | Make a ring skin available to configs under type. The built-ins register themselves. |
| resolveEase | Turn an Ease into a function. Throws on an unknown name, naming the curves that exist, so a typo in a config fails at build time rather than producing a wheel that never stops. |
| resolveTarget | Turn a WheelTarget into a section and a wheel-local landing angle. |
| rotationForLocalAngle | The disc rotation (normalised) that puts local angle local under the pointer. |
| scaleToFit | The scale factor that fits size into box under options. Pure; no PixiJS objects. |
| setLogLevel | Set how much the library prints. Default 'info'. |
| signedDeg | Wrap an angle into (-180, 180]. |
| wedgePath | Trace an annular sector (or a wedge when innerRadius is 0). |