Particle constructor

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

Implementation

Particle({
  required this.color,
  required this.velocity,
  this.rotationSpeed = 0,
  Offset? startPosition,
  // 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,
      _position = startPosition ?? Offset.zero;