pixi-reels

API reference

SpeedManager

pixi-reels


pixi-reels / index / SpeedManager

Defined in: speed/SpeedManager.ts:20

The tempo of your reels, as named presets.

A SpeedProfile is a bundle of timings. how long the wind-up takes, how fast the reel scrolls at full speed, how deep the landing bounce is, which GSAP easing drives each transition. SpeedManager holds those profiles by name and tracks which one is active.

Built-in profiles: normal (default), turbo, superTurbo. Add your own via reelSet.speed.addProfile('cinematic', {...}). Switch at runtime with reelSet.setSpeed('turbo').

Speed changes take effect on the next spin. mid-spin switching is deliberately not supported to keep animation state simple.

Constructors#

Constructor#

new SpeedManager(profiles: Map<string, SpeedProfile>, initialSpeed: string): SpeedManager;

Defined in: speed/SpeedManager.ts:29

Parameters#

ParameterType
profilesMap<string, SpeedProfile>
initialSpeedstring

Returns#

SpeedManager

Accessors#

active#

Get Signature#

get active(): Readonly<SpeedProfile>;

Defined in: speed/SpeedManager.ts:44

The currently active speed profile, with any run-time tune folded in.

Returns

Readonly<SpeedProfile>


activeName#

Get Signature#

get activeName(): string;

Defined in: speed/SpeedManager.ts:79

Name of the currently active speed profile.

Returns

string


profileNames#

Get Signature#

get profileNames(): string[];

Defined in: speed/SpeedManager.ts:109

All registered profile names.

Returns

string[]

Methods#

addProfile()#

addProfile(name: string, profile: SpeedProfile): void;

Defined in: speed/SpeedManager.ts:99

Add or replace a speed profile.

Parameters#

ParameterType
namestring
profileSpeedProfile

Returns#

void


clearTune()#

clearTune(phase?: 
  | "start"
  | "spin"
  | "anticipation"
  | "stop"
  | "adjust"
  | "cascade:fall"
  | "cascade:place"
  | "cascade:dropIn"): void;

Defined in: speed/SpeedManager.ts:72

Drop the tune for one phase, or every tune when called with no argument.

Parameters#

ParameterType
phase?| "start" | "spin" | "anticipation" | "stop" | "adjust" | "cascade:fall" | "cascade:place" | "cascade:dropIn"

Returns#

void


getProfile()#

getProfile(name: string): SpeedProfile | undefined;

Defined in: speed/SpeedManager.ts:104

Get a profile by name, or undefined if not found.

Parameters#

ParameterType
namestring

Returns#

SpeedProfile | undefined


set()#

set(name: string): {
  current: SpeedProfile;
  previous: SpeedProfile;
};

Defined in: speed/SpeedManager.ts:84

Switch to a different named speed profile.

Parameters#

ParameterType
namestring

Returns#

{
  current: SpeedProfile;
  previous: SpeedProfile;
}
NameTypeDefined in
currentSpeedProfilespeed/SpeedManager.ts:84
previousSpeedProfilespeed/SpeedManager.ts:84

tune()#

tune<K extends 
  | "start"
  | "spin"
  | "anticipation"
  | "stop"
  | "adjust"
  | "cascade:fall"
  | "cascade:place"
  | "cascade:dropIn">(phase: K, section: PhaseProfiles[K]): void;

Defined in: speed/SpeedManager.ts:66

Override part of one phase’s section at run time, without editing the registered profile.

The override is merged into whatever the active profile already says for that phase: flat fields replace, per-step config merges segment by segment, so naming one step’s ease leaves the rest of the section standing. Tunes are a layer on top of whichever profile is active, so they survive set('turbo') until clearTune.

Like a speed change, a tune takes effect on the next spin: the controller captures active once per spin and hands that instance to every phase.

Type Parameters#

Type Parameter
K extends | "start" | "spin" | "anticipation" | "stop" | "adjust" | "cascade:fall" | "cascade:place" | "cascade:dropIn"

Parameters#

ParameterType
phaseK
sectionPhaseProfiles[K]

Returns#

void

Example#

reelSet.speed.tune('stop', { steps: { bounce: { ease: 'back.out(2)' } } });