StaticSpinSymbol
pixi-reels / index / StaticSpinSymbol
Class: StaticSpinSymbol
Defined in: snapshot/StaticSpinSymbol.ts:74
Wraps any ReelSymbol and swaps it for a cached snapshot texture while
the reel spins. “spin static, not Spine.”
At rest the inner symbol is live (idle loops, win animations, cascade destruction all delegate to it). When the reel starts, the wrapper snapshots the inner symbol through the shared SpinTextureCache (or reuses a cached / user-provided texture), deactivates the inner symbol so it costs nothing, and spins a plain Sprite instead. Symbols that wrap in mid-spin only retarget that sprite’s texture. no inner symbol is ever created or ticked for them. On land the inner symbol is reactivated on the final symbolId.
With spinTexture: 'blurred' the sprite crossfades from the crisp
snapshot to a pre-baked motion-blur variant over blurRampMs, then
spins the blurred texture. The smear follows the reel’s travel axis
(blur.axis — vertical by default, 'x' for a HorizontalReel). No
filter runs during the spin; the blur is baked once per symbolId and
cached.
Register it like any other symbol:
const cache = new SpinTextureCache({ renderer: app.renderer });
builder.symbols((r) => {
for (const id of ids) {
r.register(id, StaticSpinSymbol, {
createInner: () => new SpineReelSymbol(spineOpts),
cache,
});
}
});
Prefer calling prewarmSpinTextures at load time so the first spin doesn’t pay the one-time capture cost.
Extends
Constructors
Constructor
new StaticSpinSymbol(options: StaticSpinSymbolOptions): StaticSpinSymbol;
Defined in: snapshot/StaticSpinSymbol.ts:89
Parameters
| Parameter | Type |
|---|---|
options | StaticSpinSymbolOptions |
Returns
StaticSpinSymbol
Overrides
Properties
| Property | Modifier | Type | Description | Inherited from | Defined in |
|---|---|---|---|---|---|
view | readonly | Container | The PixiJS container that holds this symbol’s visual. | ReelSymbol.view | symbols/ReelSymbol.ts:37 |
Accessors
inner
Get Signature
get inner(): ReelSymbol;
Defined in: snapshot/StaticSpinSymbol.ts:108
The wrapped live symbol. for type-specific access (inner as SpineReelSymbol).
Returns
isDestroyed
Get Signature
get isDestroyed(): boolean;
Defined in: symbols/ReelSymbol.ts:50
Returns
boolean
Inherited from
isShowingSnapshot
Get Signature
get isShowingSnapshot(): boolean;
Defined in: snapshot/StaticSpinSymbol.ts:113
True while the wrapper is showing a snapshot instead of the live symbol.
Returns
boolean
symbolId
Get Signature
get symbolId(): string;
Defined in: symbols/ReelSymbol.ts:46
Returns
string
Inherited from
Methods
activate()
activate(symbolId: string): void;
Defined in: symbols/ReelSymbol.ts:59
Activate the symbol with a new identity. Called when the symbol enters the visible reel or is recycled from the pool. Resets container transform / filter state for parity with deactivate().
Parameters
| Parameter | Type |
|---|---|
symbolId | string |
Returns
void
Inherited from
deactivate()
deactivate(): void;
Defined in: symbols/ReelSymbol.ts:75
Deactivate the symbol before returning it to the pool. Stops animations, hides the view, and resets container transform / filter state so subclass decorations don’t leak across recycles.
Returns
void
Inherited from
destroy()
destroy(): void;
Defined in: symbols/ReelSymbol.ts:92
Returns
void
Inherited from
onActivate()
protected onActivate(symbolId: string): void;
Defined in: snapshot/StaticSpinSymbol.ts:117
Subclass hook: set up visuals for the given symbolId.
Parameters
| Parameter | Type |
|---|---|
symbolId | string |
Returns
void
Overrides
onDeactivate()
protected onDeactivate(): void;
Defined in: snapshot/StaticSpinSymbol.ts:129
Subclass hook: clean up visuals.
Returns
void
Overrides
onDestroy()
protected onDestroy(): void;
Defined in: snapshot/StaticSpinSymbol.ts:225
Subclass hook: additional cleanup on destroy.
Returns
void
Overrides
onReelAnticipationStart()
onReelAnticipationStart(): void;
Defined in: snapshot/StaticSpinSymbol.ts:160
The reel entered its anticipation tease: it is slow enough to read, so
crossfade the baked blur back out and ride the crisp snapshot until
the land. Mid-tease installs arrive blurred (_showSnapshot instant)
and immediately relax through this same hook.
Returns
void
Overrides
ReelSymbol.onReelAnticipationStart
onReelLanded()
onReelLanded(): void;
Defined in: snapshot/StaticSpinSymbol.ts:196
Lifecycle hook: the owning reel has landed on its final symbols. Default: no-op. Override (e.g. SpineReelSymbol.autoPlayLanding) to fire a landing animation concurrently with the bounce.
Returns
void
Overrides
onReelSpinEnd()
onReelSpinEnd(): void;
Defined in: snapshot/StaticSpinSymbol.ts:183
Lifecycle hook: the owning reel is about to stop (just before bounce). Default: no-op.
Returns
void
Overrides
onReelSpinStart()
onReelSpinStart(joinedMidSpin?: boolean): void;
Defined in: snapshot/StaticSpinSymbol.ts:138
Lifecycle hook: the owning reel is spinning. Default: no-op. Override (e.g. SpineReelSymbol.autoPlayBlur, StaticSpinSymbol) to swap to a spin presentation automatically.
Fired on every strip symbol (visible AND buffer rows) when the reel
enters the spin phase, and again with joinedMidSpin: true on each
symbol freshly installed while the reel is already spinning (pool
recycling wipes symbol state, so a wrapped-in symbol can’t know the
reel is moving without this). Implementations MUST be idempotent.
the same instance can be notified more than once per spin.
Parameters
| Parameter | Type | Default value | Description |
|---|---|---|---|
joinedMidSpin | boolean | false | true when this symbol was installed into a reel already at speed (skip start-of-spin transitions like blur ramps). |
Returns
void
Overrides
playDestroy()
playDestroy(opts?: {
delay?: number;
signal?: AbortSignal;
}): Promise<void>;
Defined in: snapshot/StaticSpinSymbol.ts:208
Play the cascade-destruction animation for this symbol. Called by
consumers (typically via reelSet.destroySymbols(...)) to disintegrate
a winning cell before the next cascade refill drops fresh symbols in.
Default implementation: brief scale-up “charge” then implode (scale 0
- spin + fade), squishing around the symbol’s bounding-box CENTER
regardless of the view’s anchor. Total ~320 ms. The view is left at
alpha: 0(destroyed); position / pivot are restored so pool reuse via_replaceSymbol’s same-id fast path doesn’t inherit a stale pivot offset.
Override in subclasses for art-appropriate destruction. e.g. a
Spine symbol can play its disintegration track here, or a sprite
symbol can swap to a shatter atlas. The promise must resolve when
the symbol is no longer visible.
Default animation: a snappy “poof”. tiny anticipation pop (~60 ms)
then a fast implode to scale: 0 + alpha: 0 (~140 ms), centered on
the symbol’s bounds. ~200 ms total. No rotation. designed to read
cleanly under win-cluster pacing without competing with the win
presenter.
opts.delay. seconds to wait before the animation starts. Use to
stagger a cluster of winners (e.g. i * 0.015).
opts.signal. abort signal. If aborted (now or mid-animation), the
tween is killed and the view is snapped to its destroyed pose
(alpha: 0, transform restored). The promise resolves normally. abort
means “skip to the end,” not “fail”. Subclasses that override this
method MUST honor the signal or document why they can’t (e.g. a Spine
disintegration track is uninterruptible).
Parameters
| Parameter | Type |
|---|---|
opts? | { delay?: number; signal?: AbortSignal; } |
opts.delay? | number |
opts.signal? | AbortSignal |
Returns
Promise<void>
Overrides
playWin()
playWin(): Promise<void>;
Defined in: snapshot/StaticSpinSymbol.ts:200
Play the win/highlight animation for this symbol. Resolves when complete.
Returns
Promise<void>
Overrides
reset()
reset(): void;
Defined in: symbols/ReelSymbol.ts:88
Pool reset. aliases deactivate.
Returns
void
Inherited from
resize()
resize(width: number, height: number): void;
Defined in: snapshot/StaticSpinSymbol.ts:216
Resize the symbol’s visual to fit the given dimensions.
Parameters
| Parameter | Type |
|---|---|
width | number |
height | number |
Returns
void
Overrides
stopAnimation()
stopAnimation(): void;
Defined in: snapshot/StaticSpinSymbol.ts:204
Immediately stop any running animation and return to idle.
Returns
void