generate static method

Particle generate({
  1. required ParticleGenerator generator,
  2. int count = 10,
  3. double? lifespan,
  4. bool applyLifespanToChildren = true,
})

Generates a given amount of particles and then combining them into one single ComposedParticle.

Useful for procedural particle generation.

Implementation

static Particle generate({
  required ParticleGenerator generator,
  int count = 10,
  double? lifespan,
  bool applyLifespanToChildren = true,
}) {
  return ComposedParticle(
    lifespan: lifespan,
    applyLifespanToChildren: applyLifespanToChildren,
    children: List<Particle>.generate(count, generator),
  );
}