Particle constructor
Particle({
- required Color color,
- required Offset velocity,
- double rotationSpeed = 0,
- double? lifetime,
- Color? endColor,
- List<
Color> ? colorGradient, - Curve colorCurve = const Cubic(0, 0, 1, 1),
- double startScale = 1.0,
- double? endScale,
- Curve scaleCurve = const Cubic(0, 0, 1, 1),
- double startOpacity = 1.0,
- double? endOpacity,
- Curve opacityCurve = const Cubic(0, 0, 1, 1),
- bool trailEnabled = false,
- int trailLength = 10,
- 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;