tick method
Implementation
@override
void tick(Duration duration) {
if (spriteSheet.image == null) {
return;
}
fillInitialData();
_hue -= 1;
int frameCount = spriteSheet.length;
const double maxD = 100.0;
for (int i = 0; i < count; i++) {
_Particle o = particles![i] as _Particle;
double dx, dy, d;
if (touchPoint != null &&
(dy = touchPoint!.dy - o.y) < maxD &&
(dx = touchPoint!.dx - o.x) < maxD &&
(d = sqrt(dx * dx + dy * dy)) < maxD) {
double a = atan2(dy, dx);
double v = (maxD - d) / maxD * -1.0;
o.vx += v * cos(a);
o.vy += v * sin(a);
}
o.vy += 0.1;
o.x += o.vx;
o.vx *= 0.99;
o.y += o.vy;
if (o.y > height) {
_activateParticle(i);
}
double r = 12.0 * o.scale;
injectVertex(i, xy, o.x - r, o.y - r, o.x + r, o.y + r);
if (o.animate) {
spriteSheet.injectTexCoords(i, uv, (++o.frame % frameCount));
}
}
super.tick(duration);
}