tick method

  1. @override
void tick(
  1. Duration duration
)
override

Implementation

@override
void tick(Duration duration) {
  if (spriteSheet.image == null) {
    return;
  }
  fillInitialData();

  _point +=
      ((touchPoint ?? center) - _point) * (touchPoint == null ? 0.05 : 0.2);

  _hue += 10;

  int frameCount = spriteSheet.length;
  double m = _updatePower();
  int addCount = (180 * m).toInt();

  for (int i = 0; i < count; i++) {
    Particle o = particles![i];
    if (o.life == 0 && --addCount > 0) {
      _activateParticle(i, _point, m);
    } else if (o.life == 0) {
      continue;
    }

    o.vy += 0.25;
    o.vy *= 0.99;
    o.x += o.vx;
    o.vx *= 0.99;
    o.y += o.vy;

    o.life -= 1.2;
    if (o.life <= 0) {
      resetParticle(i);
      continue;
    }

    double r = o.life / 100 * 24;
    injectVertex(i, xy, o.x - r, o.y - r, o.x + r, o.y + r);

    spriteSheet.injectTexCoords(i, uv, (++o.frame % frameCount));
  }

  _prevPoint = touchPoint;
  super.tick(duration);
}