moveWithAngle method
Move the particle
This method is used to move the particle to given angle.
Implementation
Particle moveWithAngle(double angle) {
final next = this + Offset.fromDirection(angle, speed);
final lifetime = life - 0.01;
final color = lifetime > .1 ? this.color.withOpacity(lifetime.clamp(0, 1)) : this.color;
return copyWith(
dx: next.dx,
dy: next.dy,
life: lifetime,
color: color,
// Given angle
angle: angle,
);
}