EzAnimation constructor
EzAnimation(
- dynamic begin,
- dynamic end,
- Duration duration, {
- Curve curve = Curves.linear,
- Curve reverseCurve = Curves.linear,
- BuildContext? context,
- TickerProvider? vsync,
Implementation
EzAnimation(
this.begin,
this.end,
this.duration, {
this.curve = Curves.linear,
this.reverseCurve = Curves.linear,
this.context,
this.onNavigate = OnNavigate.resetAnimation,
this.vsync,
}) {
_tickerProvider = _CustomProvider();
_tween = Tween(begin: begin, end: end);
_controller = AnimationController(
vsync: vsync == null ? _tickerProvider : vsync!, duration: duration);
_resultAnimation = _tween.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);
}
}