CascadeFallPhase
pixi-reels / index / CascadeFallPhase
Class: CascadeFallPhase
Defined in: spin/phases/CascadeFallPhase.ts:42
Fall-out half of the tumble cascade. Replaces StartPhase when the
builder was configured with .tumble(...).
Runs at the moment the player presses spin: every currently-visible
symbol falls off the bottom of the viewport. The reel then sits at speed
zero while SpinPhase waits for the server result.
Animation parameters (duration, ease, cell stagger) are baked into the phase at builder time via the factory closure; the run-time config carries only per-spin context (delay, event bus).
Extends#
Constructors#
Constructor#
new CascadeFallPhase(
reel: Reel,
speed: SpeedProfile,
fall: Required<TumbleFallConfig>,
gravity?: Direction | "auto"
): CascadeFallPhase;
Defined in: spin/phases/CascadeFallPhase.ts:75
Parameters#
| Parameter | Type | Default value |
|---|---|---|
reel | Reel | undefined |
speed | SpeedProfile | undefined |
fall | Required<TumbleFallConfig> | undefined |
gravity | Direction | "auto" | 'auto' |
Returns#
CascadeFallPhase
Overrides#
Properties#
| Property | Modifier | Type | Default value | Description | Overrides | Inherited from | Defined in |
|---|---|---|---|---|---|---|---|
_baseFall | readonly | Required<TumbleFallConfig> | undefined | - | - | - | spin/phases/CascadeFallPhase.ts:47 |
_config | protected | | CascadeFallPhaseConfig | null | null | The config run() was given, for ctx.config. | - | ReelPhase._config | spin/phases/ReelPhase.ts:132 |
_delayedCall | protected | Tween | null | null | - | - | - | spin/phases/CascadeFallPhase.ts:54 |
_events | protected | | EventEmitter<ReelSetEvents> | null | null | Captured on enter so onSkip can emit the paired cascade:fall:end without needing the config closure (which lives only inside _beginFall). | - | - | spin/phases/CascadeFallPhase.ts:60 |
_fall | protected | Required<TumbleFallConfig> | undefined | Resolved at onEnter time by merging the active speed profile’s tumble.fall override (if any) over _baseFall. Lives only for the duration of a single run so a setSpeed between phases is honoured on the next entry. | - | - | spin/phases/CascadeFallPhase.ts:52 |
_fallingViews | protected | Container<ContainerChild>[] | [] | Views actively being faded out. Tracked so onSkip can hide them rather than leaving them at mid-fall position. | - | - | spin/phases/CascadeFallPhase.ts:57 |
_gravity | readonly | Direction | "auto" | undefined | Build-time gravity setting; 'auto' resolves per reel at onEnter. | - | - | spin/phases/CascadeFallPhase.ts:73 |
_isActive | protected | boolean | false | - | - | ReelPhase._isActive | spin/phases/ReelPhase.ts:130 |
_reel | protected | Reel | undefined | - | - | ReelPhase._reel | spin/phases/ReelPhase.ts:127 |
_resolve | protected | (() => void) | null | null | - | - | ReelPhase._resolve | spin/phases/ReelPhase.ts:129 |
_skipAbort | protected | AbortController | null | null | Per-run abort controller exposed to listeners on cascade:fall:symbol as signal. Aborts on onSkip so listener-scheduled tweens (squish, badge fade, etc.) can clean themselves up alongside the library’s own timeline. Stays un-aborted on natural completion. only explicit skips trigger it. | - | - | spin/phases/CascadeFallPhase.ts:70 |
_speed | protected | SpeedProfile | undefined | - | - | ReelPhase._speed | spin/phases/ReelPhase.ts:128 |
_startEmitted | protected | boolean | false | Whether cascade:fall:start was emitted yet. onSkip emits the matching :end ONLY when :start already fired. a skip during the pre-fall delay window must not produce an unpaired :end. | - | - | spin/phases/CascadeFallPhase.ts:64 |
_timeline | protected | Timeline | null | null | - | - | - | spin/phases/CascadeFallPhase.ts:53 |
name | readonly | "cascade:fall" | 'cascade:fall' | - | ReelPhase.name | - | spin/phases/CascadeFallPhase.ts:43 |
quickenable | readonly | true | true | Whether a 'quicken' press may reach onSkip(ctx). A phase that declares it branches on ctx.mode there and completes itself when the natural end is reached. One that does not is left alone by a quicken (its cut steps are still skipped), so a phase written for slams only keeps working. The built-ins declare it. | ReelPhase.quickenable | - | spin/phases/CascadeFallPhase.ts:45 |
skippable | readonly | true | true | - | ReelPhase.skippable | - | spin/phases/CascadeFallPhase.ts:44 |
Accessors#
isActive#
Get Signature#
get isActive(): boolean;
Defined in: spin/phases/ReelPhase.ts:149
Returns
boolean
Inherited from#
quickened#
Get Signature#
get quickened(): boolean;
Defined in: spin/phases/ReelPhase.ts:154
true once a 'quicken' press has reached this phase.
Returns
boolean
Inherited from#
reel#
Get Signature#
get reel(): Reel;
Defined in: spin/phases/ReelPhase.ts:140
Returns
Inherited from#
speed#
Get Signature#
get speed(): TProfile;
Defined in: spin/phases/ReelPhase.ts:145
The profile this phase runs on. A 'quicken' press that names one swaps it.
Returns
TProfile
Inherited from#
Methods#
_beginFall()#
protected _beginFall(events: EventEmitter<ReelSetEvents>): void;
Defined in: spin/phases/CascadeFallPhase.ts:109
Parameters#
| Parameter | Type |
|---|---|
events | EventEmitter<ReelSetEvents> |
Returns#
void
_complete()#
protected _complete(): void;
Defined in: spin/phases/ReelPhase.ts:254
Call when the phase naturally completes.
Returns#
void
Inherited from#
_kill()#
protected _kill(): void;
Defined in: spin/phases/CascadeFallPhase.ts:257
Returns#
void
bounce()#
bounce(options?: BounceOptions): ReelBounce;
Defined in: spin/phases/ReelPhase.ts:467
Overshoot the reel in its direction of travel and settle it back, the classic landing bounce. Call it after land: the overshoot is measured from wherever the reel container rests right now.
Moving the container after a landing is not a plain tween. land() has
just lifted every at-rest unmask symbol into a layer that does NOT
inherit the reel’s offset, so for as long as the bounce runs the base
carries those views along on every frame, and the settle lands them on
the exact resting position rather than the tween’s last epsilon. That
bookkeeping is why the bounce is a helper and not two lines of GSAP, and
why a different bounce shape goes through options.animation rather
than a raw tween of the container.
Defaults come from the phase’s profile; pass BounceOptions to
bounce differently (a pressed reel that lands on a shorter bounce, say).
A non-positive distance returns an already-settled bounce, so the
caller’s done handling is the same either way.
Parameters#
| Parameter | Type |
|---|---|
options | BounceOptions |
Returns#
Inherited from#
defaultBounce()#
static defaultBounce(ctx: BounceContext): Animation;
Defined in: spin/phases/ReelPhase.ts:441
The built-in bounce: out by distance, back to base, half the time each.
Parameters#
| Parameter | Type |
|---|---|
ctx | BounceContext |
Returns#
Animation
Inherited from#
forceComplete()#
forceComplete(ctx?: SkipContext<SpeedProfile>): void;
Defined in: spin/phases/ReelPhase.ts:225
Slam this phase regardless of skippable: cancel the step in flight,
onSkip(ctx), complete. What the controller’s slam path calls;
ctx.mode is 'slam' there.
Parameters#
| Parameter | Type |
|---|---|
ctx | SkipContext<SpeedProfile> |
Returns#
void
Inherited from#
land()#
land(cells?: readonly number[]): void;
Defined in: spin/phases/ReelPhase.ts:429
Bring the reel to rest on the frame it is showing and announce the
landing: the drive halts, the strip snaps to the cell grid, symbols are
told the spin is over and then that they landed (which lifts unmask
symbols above the mask and plays the landing animation), and the reel’s
landing event fires, bridged to the set’s spin:reelLanding.
Place the frame first (this.reel.placeStrip(frame)), or let the spin-out
carry it in as StopPhase does; this call does not choose the symbols.
It is the whole of what StopPhase does between its spin-out and its
bounce, and the only way a phase lands a reel.
Parameters#
| Parameter | Type | Description |
|---|---|---|
cells? | readonly number[] | Visible cells (0-indexed) whose symbols receive onReelLanded(). Omit for a strip landing, where every visible symbol landed; pass the cells that moved when only some did. |
Returns#
void
Inherited from#
onEnter()#
protected onEnter(config: CascadeFallPhaseConfig): void;
Defined in: spin/phases/CascadeFallPhase.ts:87
Subclass: set up the phase (start tweens, set speed, etc).
Parameters#
| Parameter | Type |
|---|---|
config | CascadeFallPhaseConfig |
Returns#
void
Overrides#
onSkip()#
protected onSkip(ctx?: SkipContext): void;
Defined in: spin/phases/CascadeFallPhase.ts:232
Subclass: a skip press reached the phase. Branch on ctx.mode.
Under 'slam' this is the slam pose: the base has cancelled the step in
flight; kill anything else and leave the reel where a natural finish
would have; the base completes the phase after.
Under 'quicken' (only reached when quickenable) cut a wait,
never the landing, and call _complete() yourself once the natural end
is reached, right away if the slam pose already is that end. A phase on
runSteps usually needs nothing here: its cut steps are skipped
for it. ctx.payload is whatever the game attached to the press.
Parameters#
| Parameter | Type |
|---|---|
ctx | SkipContext |
Returns#
void
Overrides#
run()#
run(config: CascadeFallPhaseConfig): Promise<void>;
Defined in: spin/phases/ReelPhase.ts:173
Enter the phase. Returns a promise that resolves when the phase is complete.
Parameters#
| Parameter | Type |
|---|---|
config | CascadeFallPhaseConfig |
Returns#
Promise<void>
Inherited from#
runSteps()#
protected runSteps(steps: readonly PhaseStep<StepContext<any, any>>[]): void;
Defined in: spin/phases/ReelPhase.ts:272
Run steps in order and complete the phase after the last one. Each
step’s result is waited on (a tween or timeline, a promise, a
cancellable such as bounce’s, or nothing). A slam cancels the step
in flight; a quicken skips the steps marked cut, in flight or upcoming.
Call tickSteps from update() so ctx.until() can watch the reel.
Parameters#
| Parameter | Type |
|---|---|
steps | readonly PhaseStep<StepContext<any, any>>[] |
Returns#
void
Inherited from#
skip()#
skip(ctx?: SkipContext<SpeedProfile>): void;
Defined in: spin/phases/ReelPhase.ts:205
A skip press reached this phase.
'slam' (the default): if the phase is skippable, the step in flight is
cancelled, onSkip(ctx) runs and the phase completes at once; the
controller then places the reel.
'quicken': the phase is asked to reach its natural end sooner without
changing what it looks like. A profile named on the press replaces
speed first. Then, if the phase is quickenable, onSkip(ctx)
runs; then every cut step is skipped, the one in flight included. A
phase that is neither quickenable nor running steps is left to run its
course, and still lands. skippable is not consulted, since nothing is
forced.
Parameters#
| Parameter | Type |
|---|---|
ctx | SkipContext<SpeedProfile> |
Returns#
void
Inherited from#
tickSteps()#
protected tickSteps(): void;
Defined in: spin/phases/ReelPhase.ts:290
Feed ctx.until() from the phase’s update(): every pending predicate
is checked and the steps waiting on a true one resume.
Returns#
void
Inherited from#
update()#
update(_deltaMs: number): void;
Defined in: spin/phases/CascadeFallPhase.ts:230
Called each frame while the phase is active.
Parameters#
| Parameter | Type |
|---|---|
_deltaMs | number |
Returns#
void