Particle constructor

Particle({
  1. required Color color,
  2. required Offset velocity,
  3. double rotationSpeed = 0,
  4. double? lifetime,
  5. Color? endColor,
  6. List<Color>? colorGradient,
  7. Curve colorCurve = const Cubic(0, 0, 1, 1),
  8. double startScale = 1.0,
  9. double? endScale,
  10. Curve scaleCurve = const Cubic(0, 0, 1, 1),
  11. double startOpacity = 1.0,
  12. double? endOpacity,
  13. Curve opacityCurve = const Cubic(0, 0, 1, 1),
  14. bool trailEnabled = false,
  15. int trailLength = 10,
  16. bool trailFade = true,
})

Implementation

Particle({
  required this.color,
  required this.velocity,
  this.rotationSpeed = 0,
  // Lifetime
  this.lifetime,
  // Color over lifetime
  this.endColor,
  this.colorGradient,
  this.colorCurve = const Cubic(0, 0, 1, 1),
  // Scale over lifetime
  this.startScale = 1.0,
  this.endScale,
  this.scaleCurve = const Cubic(0, 0, 1, 1),
  // Opacity over lifetime
  this.startOpacity = 1.0,
  this.endOpacity,
  this.opacityCurve = const Cubic(0, 0, 1, 1),
  // Trails
  this.trailEnabled = false,
  this.trailLength = 10,
  this.trailFade = true,
})  : _currentColor = color,
      _currentScale = startScale,
      _currentOpacity = startOpacity,
      _trail = trailEnabled ? _TrailBuffer(trailLength) : null;