PR pixi-reels
API

Phases

A phase is one slice of a reel’s spin lifecycle. Phases extend ReelPhase<TConfig> and implement three hooks.

ReelPhase<TConfig>
├─ onEnter(config)   // set up tweens, set reel.speed
├─ update(deltaMs)   // called every frame while active
└─ onSkip()          // clean up when forced

Built-ins

PhaseRoleSkippable
StartPhaseAccelerate from rest, optional step-backyes
SpinPhaseFull speed until stop requestedyes
AnticipationPhaseSlow-down hold for tensionyes
StopPhaseDecelerate to target frame, bounceno

Register a custom phase

import { ReelPhase } from 'pixi-reels';

class FlashPhase extends ReelPhase<{ duration: number }> {
  readonly name = 'flash';
  readonly skippable = true;
  private _elapsed = 0;

  protected onEnter(cfg: { duration: number }): void {
    this._elapsed = 0;
    this._duration = cfg.duration;
  }

  update(deltaMs: number): void {
    this._elapsed += deltaMs;
    // ... toggle reel alpha or something
    if (this._elapsed >= this._duration) this._complete();
  }

  protected onSkip(): void { /* cleanup */ }
}

builder.phases((f) => f.register('flash', FlashPhase));

Replacing built-ins works the same way — register with the same name ('start', 'spin', 'anticipation', 'stop') to override.