setProgress method
Implementation
bool setProgress(double value) {
var frameRate = this.frameRate ?? FrameRate.composition;
var roundedProgress = composition.roundProgress(
value,
frameRate: frameRate,
);
if (roundedProgress != _progress) {
_isDirty = false;
var previousProgress = _progress;
_progress = roundedProgress;
_compositionLayer.setProgress(roundedProgress);
if (!_isDirty && frameRate != FrameRate.max && previousProgress != null) {
var alias = _progressAliases[previousProgress] ?? previousProgress;
_progressAliases[roundedProgress] = alias;
}
if (previousProgress != null &&
frameRate == FrameRate.composition &&
_delegates == null) {
// Nothing but the composition decides what this drawable reports:
// keep it for the animations that wait for the next change.
FrameChanges.of(composition)
.observe(previousProgress, roundedProgress, changed: _isDirty);
}
return _isDirty;
} else {
return false;
}
}