Skip to content

defineEffect

defineEffect<H, O>(spec): EffectDefinition<H, O>

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

Register an effect preset under a stable string name so its EffectStack entries survive save/load. The returned callable accepts the preset’s options and yields an EffectFactory whose built Effect is tagged with { name, options } for serialization.

Names are conventionally prefixed (yage:hitFlash, yage:bloom, …); the @yagejs/effects package uses yage: for its hero presets.

Re-registering an existing name overwrites the previous entry and emits a dev warning — typically only happens during HMR.

H extends EffectHandle

O

(options) => Effect<H>

string

EffectDefinition<H, O>