Skip to content

EmitterBehavior<ConfigType, DataType, ParticleType>

Abstract base for all behavior to build upon.

This class provides the foundational structure and methods that all emitter behaviors must implement, ensuring consistency and interoperability.

In addition to the core functionality, this class also defines interfaces for behaviors that initialize particles (InitBehavior) and those that update particles (UpdateBehavior) during the emitter's update cycle.

Extended by

Type Parameters

ConfigType

ConfigType

Type describing the configuration object for this behavior.

DataType

DataType extends BaseParticleData = BaseParticleData

Type describing the data object stored on particles.

ParticleType

ParticleType extends IEmitterParticle<DataType> = IEmitterParticle<DataType>

Type describing the particle used within the emitter.

Constructors

Constructor

ts
new EmitterBehavior<ConfigType, DataType, ParticleType>(emitter): EmitterBehavior<ConfigType, DataType, ParticleType>;

Creates a new instance of the behavior.

Parameters

emitter

Emitter<DataType, ParticleType>

Emitter instance this behavior belongs to.

Returns

EmitterBehavior<ConfigType, DataType, ParticleType>

Accessors

updateOrder

Get Signature

ts
get abstract updateOrder(): BehaviorOrder;

Defines at which step of the update cycle the behavior is applied.

  • initial: Earliest step, useful when other behaviors depend on this behavior.
  • normal: Default step for most behaviors.
  • late: Latest step, useful for behaviors that should override others or depend on their properties.
Returns

BehaviorOrder

Methods

applyConfig()

ts
applyConfig(config): void;

Reset the behavior and apply the provided configuration.

Parameters

config

ConfigType

Behavior configuration.

Returns

void


getConfig()

ts
abstract getConfig(): ConfigType | undefined;

Retrieve the current behavior properties as a configuration object. If the behavior is inactive, undefined is returned.

Returns

ConfigType | undefined

Behavior configuration object or undefined if inactive.


reset()

ts
abstract protected reset(): void;

Reset the behavior to its default state.

Returns

void