onAnimationUpdate method
Called when the animation updates to apply transformations and positioning to the particle.
The progress
parameter represents the animation progress in a range from 0.0 to 1.0.
Based on the progress, the particle's opacity, size, and position will be updated
according to the specified animation properties.
Implementation
onAnimationUpdate(double progress) {
_currentProgress = progress;
particle.updateColor(progress);
if (progress <= fadeInLimit && fadeInLimit != 0) {
final fadeInProgress = progress / fadeInLimit;
final opacity = fadeInCurve.transform(fadeInProgress);
particle.updateOpacity(opacity);
}
if (progress >= fadeOutThreshold && fadeOutThreshold != 1) {
var fadeOutProgress =
(progress - fadeOutThreshold) / (1 - fadeOutThreshold);
final opacity = 1 - fadeOutCurve.transform(fadeOutProgress);
particle.updateOpacity(opacity);
}
final currentScale = scaleRange.transform(scaleCurve.transform(progress));
particle.size = Size(
particle.initialSize.width * currentScale,
particle.initialSize.height * currentScale,
);
var distanceProgress = distanceCurve.transform(progress);
particle.position = pathTransformation.transform(
particle.initialPosition,
distanceProgress,
);
}