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
Filterthey push ontotarget.filters, - the
getIntensity/setIntensityaccessors used byfadeIn/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.
Type Parameters
Section titled “Type Parameters”H extends EffectHandle = EffectHandle
Properties
Section titled “Properties”filter
Section titled “filter”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.
Methods
Section titled “Methods”buildExtras()?
Section titled “buildExtras()?”
optionalbuildExtras(base):Omit<H, keyofEffectHandle>
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.
Parameters
Section titled “Parameters”Returns
Section titled “Returns”Omit<H, keyof EffectHandle>
getIntensity()
Section titled “getIntensity()”getIntensity():
number
Defined in: renderer/src/effects/Effect.ts:44
Read the current primary intensity.
Returns
Section titled “Returns”number
onActivate()?
Section titled “onActivate()?”
optionalonActivate(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).
Parameters
Section titled “Parameters”Returns
Section titled “Returns”void
onAttach()?
Section titled “onAttach()?”
optionalonAttach(target):void
Defined in: renderer/src/effects/Effect.ts:48
Optional setup callback fired after the filter is attached.
Parameters
Section titled “Parameters”target
Section titled “target”Returns
Section titled “Returns”void
onDetach()?
Section titled “onDetach()?”
optionalonDetach():void
Defined in: renderer/src/effects/Effect.ts:50
Optional teardown callback fired before the filter is detached.
Returns
Section titled “Returns”void
setIntensity()
Section titled “setIntensity()”setIntensity(
value):void
Defined in: renderer/src/effects/Effect.ts:46
Set the primary intensity.
Parameters
Section titled “Parameters”number
Returns
Section titled “Returns”void