EzAnimation.sequence constructor
EzAnimation.sequence(
- List<
SequenceItem> sequence, - Duration duration, {
- Curve curve = Curves.linear,
- Curve reverseCurve = Curves.linear,
- BuildContext? context,
- TickerProvider? vsync,
Creates an Animation from the given sequence.
Implementation
EzAnimation.sequence(
List<SequenceItem> sequence,
this.duration, {
this.curve = Curves.linear,
this.reverseCurve = Curves.linear,
this.context,
this.onNavigate = OnNavigate.resetAnimation,
this.vsync,
}) {
_tickerProvider = _CustomProvider();
_tweenSequence = TweenSequence(sequence
.map((e) => TweenSequenceItem(
tween: Tween(begin: e.begin, end: e.end), weight: e.weight))
.toList());
_controller = AnimationController(
vsync: vsync == null ? _tickerProvider : vsync!, duration: duration);
_resultAnimation = _tweenSequence.animate(CurvedAnimation(
parent: _controller, curve: curve, reverseCurve: reverseCurve));
/// If a context is given, we listen to navigation changes
/// If vsync is provided, this is automatically done by the ticker on the page
if (context != null && vsync == null) {
/// Listen for page changes, mute ticker when current context is no longer visible
_resultAnimation.addListener(_animationObserver);
/// Adds internal listener
_listeners.add(_animationObserver);
}
}