Particle constructor
Particle({
- required Color color,
- required Size parentSize,
- required AnimationController controller,
Implementation
Particle({
required this.color,
required this.parentSize,
required this.controller,
}) {
final random = Random();
_positionX = Tween(
begin: parentSize.width / 2,
end: random.nextDouble() * parentSize.width)
.animate(CurvedAnimation(parent: controller, curve: Curves.easeOut));
_positionY = Tween(
begin: parentSize.height / 2,
end: random.nextDouble() * parentSize.height)
.animate(
CurvedAnimation(parent: controller, curve: Curves.easeOutQuad));
_size = Tween(begin: 0.0, end: random.nextDouble() * 4 + 2)
.animate(CurvedAnimation(parent: controller, curve: Curves.easeIn));
_opacity = Tween(begin: 1.0, end: 0.0)
.animate(CurvedAnimation(parent: controller, curve: Curves.easeIn));
}