ParticleEmitterComponent constructor

ParticleEmitterComponent({
  1. required ParticleEmitter emitter,
  2. required ParticleRenderer renderer,
  3. bool removeOnFinish = true,
  4. bool worldSpace = false,
  5. bool emitting = true,
  6. Random? random,
  7. Vector2? position,
  8. Vector2? size,
  9. Vector2? scale,
  10. double? angle,
  11. Anchor? anchor,
  12. Iterable<Component>? children,
  13. int? priority,
  14. ComponentKey? key,
})

Creates a particle emitter component.

emitter describes what to spawn and how it behaves; renderer describes how it is drawn. When removeOnFinish is true (the default), the component removes itself once emission has naturally finished and the last particle has died; endless emitters are never removed automatically. Pass a seeded random for deterministic behavior.

Implementation

ParticleEmitterComponent({
  required this.emitter,
  required this.renderer,
  this.removeOnFinish = true,
  this.worldSpace = false,
  bool emitting = true,
  Random? random,
  super.position,
  super.size,
  super.scale,
  super.angle,
  super.anchor,
  super.children,
  super.priority,
  super.key,
}) : // `this._emitting` requires Dart 3.12, but the minimum SDK is 3.11.
     // ignore: prefer_initializing_formals
     _emitting = emitting,
     random = random ?? Random(),
     _buffer = ParticleBuffer(emitter.maxParticles),
     _burstFired = List.filled(emitter.bursts.length, false);