updateParticle method

  1. @protected
void updateParticle(
  1. Particle particle,
  2. double delta,
  3. Duration elapsed
)

Implementation

@protected
void updateParticle(Particle particle, double delta, Duration elapsed) {
  particle.cx += particle.dx * delta;
  particle.cy += particle.dy * delta;
  if (options.opacityChangeRate > 0 &&
          particle.alpha < particle.targetAlpha ||
      options.opacityChangeRate < 0 &&
          particle.alpha > particle.targetAlpha) {
    particle.alpha = particle.alpha + delta * options.opacityChangeRate;

    if (options.opacityChangeRate > 0 &&
            particle.alpha > particle.targetAlpha ||
        options.opacityChangeRate < 0 &&
            particle.alpha < particle.targetAlpha)
      particle.alpha = particle.targetAlpha;
  }
}