TrainHoppingAnimation(Animation<double> _currentTrain, Animation<double> _nextTrain, { VoidCallback onSwitchedTrain })

Creates a train-hopping animation.

The current train argument must not be null but the next train argument can be null.

Source

TrainHoppingAnimation(this._currentTrain, this._nextTrain, { this.onSwitchedTrain }) {
  assert(_currentTrain != null);
  if (_nextTrain != null) {
    if (_currentTrain.value > _nextTrain.value) {
      _mode = _TrainHoppingMode.maximize;
    } else {
      _mode = _TrainHoppingMode.minimize;
      if (_currentTrain.value == _nextTrain.value) {
        _currentTrain = _nextTrain;
        _nextTrain = null;
      }
    }
  }
  _currentTrain.addStatusListener(_statusChangeHandler);
  _currentTrain.addListener(_valueChangeHandler);
  _nextTrain?.addListener(_valueChangeHandler);
  assert(_mode != null);
}