SwiftTween<T> constructor

SwiftTween<T>(
  1. Tween<T> _tween, {
  2. double initialProgress = 0.0,
  3. TickerProvider? vsync,
})

Implementation

SwiftTween(
  this._tween, {
  double initialProgress = 0.0,
  TickerProvider? vsync,
})  : _progress = Rx(initialProgress.clamp(0.0, 1.0)) {
  _tickerProvider = vsync;
  _progress.addListener(_updateValue);
  _updateValue();

  if (_tickerProvider != null) {
    _controller = AnimationController(
      vsync: _tickerProvider!,
      duration: const Duration(milliseconds: 300),
    );
    _animation = CurvedAnimation(
      parent: _controller!,
      curve: Curves.easeInOut,
    );
    _animation!.addListener(_onAnimationUpdate);
  }
}