Skip to content

Effect

Defined in: renderer/src/effects/Effect.ts:34

The shape an effect factory returns. The renderer’s EffectStack consumes this to build the user-facing EffectHandle.

Factories own:

  • the Filter they push onto target.filters,
  • the getIntensity / setIntensity accessors used by fadeIn / fadeOut,
  • any factory-specific extras spread onto the handle via buildExtras.

getIntensity / setIntensity should target the effect’s most natural “strength” axis (BloomFilter strength, OutlineFilter thickness, etc). For shader-style effects with no clean scalar, route through the filter’s built-in alpha uniform — every pixi Filter carries one and it scales the filter’s whole contribution.

H extends EffectHandle = EffectHandle

filter: Filter | Filter[]

Defined in: renderer/src/effects/Effect.ts:42

The pixi filter (or chain of filters) pushed onto the target’s filters array. A single Filter is the common case; pass an array when an effect needs more than one pass — e.g. a shader filter wrapped in an AlphaFilter for fade. Order matters: pixi processes filters in array order, so each later filter sees the previous one’s output.

optional buildExtras(base): Omit<H, keyof EffectHandle>

Defined in: renderer/src/effects/Effect.ts:63

Optional factory for typed extras spread onto the final handle. Receives the base EffectHandle so extras can compose against remove / setEnabled / fadeIn / fadeOut / run if needed.

Pure at call time. Return closures freely — they’re invoked by user code later and may have side effects then (e.g. hitFlash.trigger() calls base.run(...) from inside the closure). What this hook should NOT do is invoke side effects eagerly during the buildExtras call itself — no base.run(...), no scheduling, no external-state mutation at build time. Use onActivate for attach-time side effects.

EffectHandle

Omit<H, keyof EffectHandle>


getIntensity(): number

Defined in: renderer/src/effects/Effect.ts:44

Read the current primary intensity.

number


optional onActivate(base): void

Defined in: renderer/src/effects/Effect.ts:71

Optional activation callback fired once the handle is fully built (after buildExtras has merged its keys onto the handle). Use this to schedule per-effect Processes via base.run(...) — they are auto-cancelled when the effect is removed. The right place for self-scheduled tickers (e.g. a shader-uniform animator) so callers don’t have to wire step(dt).

EffectHandle

void


optional onAttach(target): void

Defined in: renderer/src/effects/Effect.ts:48

Optional setup callback fired after the filter is attached.

EffectTarget

void


optional onDetach(): void

Defined in: renderer/src/effects/Effect.ts:50

Optional teardown callback fired before the filter is detached.

void


setIntensity(value): void

Defined in: renderer/src/effects/Effect.ts:46

Set the primary intensity.

number

void