TimelineAnimation<T> constructor
TimelineAnimation<T> ({
- PropertyLerp<
T> ? lerp, - required List<
Keyframe< keyframes,T> >
Implementation
factory TimelineAnimation({
PropertyLerp<T>? lerp,
required List<Keyframe<T>> keyframes,
}) {
lerp ??= defaultLerp;
assert(keyframes.isNotEmpty, 'No keyframes found');
Duration current = Duration.zero;
for (var i = 0; i < keyframes.length; i++) {
final keyframe = keyframes[i];
assert(keyframe.duration.inMilliseconds > 0, 'Invalid duration');
current += keyframe.duration;
}
return TimelineAnimation._(
lerp: lerp,
totalDuration: current,
keyframes: keyframes,
);
}