Пример #1
0
        public TickerFuture reverse(float?from = null)
        {
            D.assert(() => {
                if (duration == null && reverseDuration == null)
                {
                    throw new UIWidgetsError(
                        "AnimationController.reverse() called with no default duration or reverseDuration.\n" +
                        "The \"duration\" or \"reverseDuration\" property should be set, either in the constructor or later, before " +
                        "calling the reverse() function."
                        );
                }

                return(true);
            });
            D.assert(
                _ticker != null,
                () => "AnimationController.reverse() called after AnimationController.dispose()\n" +
                "AnimationController methods should not be used after calling dispose."
                );
            _direction = _AnimationDirection.reverse;
            if (from != null)
            {
                setValue(from.Value);
            }

            return(_animateToInternal(lowerBound));
        }
Пример #2
0
        public TickerFuture animateTo(float target, TimeSpan?duration = null, Curve curve = null)
        {
            curve = curve ?? Curves.linear;

            this._direction = _AnimationDirection.forward;
            return(this._animateToInternal(target, duration: duration, curve: curve));
        }
Пример #3
0
        public TickerFuture forward(float?from = null)
        {
            D.assert(() => {
                if (this.duration == null)
                {
                    throw new UIWidgetsError(
                        "AnimationController.forward() called with no default Duration.\n" +
                        "The \"duration\" property should be set, either in the constructor or later, before " +
                        "calling the forward() function."
                        );
                }

                return(true);
            });
            D.assert(
                this._ticker != null,
                "AnimationController.forward() called after AnimationController.dispose()\n" +
                "AnimationController methods should not be used after calling dispose."
                );
            this._direction = _AnimationDirection.forward;
            if (from != null)
            {
                this.setValue(from.Value);
            }

            return(this._animateToInternal(this.upperBound));
        }
Пример #4
0
 public TickerFuture animateWith(Simulation simulation)
 {
     D.assert(
         _ticker != null,
         () => "AnimationController.animateWith() called after AnimationController.dispose()\n" +
         "AnimationController methods should not be used after calling dispose."
         );
     stop();
     _direction = _AnimationDirection.forward;
     return(_startSimulation(simulation));
 }
Пример #5
0
 public TickerFuture animateBack(float target, TimeSpan?duration, Curve curve = null)
 {
     D.assert(
         _ticker != null,
         () => "AnimationController.animateBack() called after AnimationController.dispose()\n" +
         "AnimationController methods should not be used after calling dispose."
         );
     curve      = curve ?? Curves.linear;
     _direction = _AnimationDirection.reverse;
     return(_animateToInternal(target, duration, curve));
 }
Пример #6
0
        public TickerFuture fling(float velocity = 1.0f)
        {
            this._direction = velocity < 0.0 ? _AnimationDirection.reverse : _AnimationDirection.forward;
            float target = velocity < 0.0f
                ? this.lowerBound - _kFlingTolerance.distance
                : this.upperBound + _kFlingTolerance.distance;
            Simulation simulation = new SpringSimulation(_kFlingSpringDescription, this.value,
                                                         target, velocity);

            simulation.tolerance = _kFlingTolerance;
            return(this.animateWith(simulation));
        }
Пример #7
0
        public TickerFuture animateTo(float target, TimeSpan?duration = null, Curve curve = null)
        {
            D.assert(
                this._ticker != null,
                "AnimationController.animateTo() called after AnimationController.dispose()\n" +
                "AnimationController methods should not be used after calling dispose."
                );
            curve = curve ?? Curves.linear;

            this._direction = _AnimationDirection.forward;
            return(this._animateToInternal(target, duration: duration, curve: curve));
        }
Пример #8
0
        public TickerFuture fling(float velocity = 1.0f)
        {
            _direction = velocity < 0.0 ? _AnimationDirection.reverse : _AnimationDirection.forward;
            float target = velocity < 0.0f
                ? lowerBound - _kFlingTolerance.distance
                : upperBound + _kFlingTolerance.distance;
            Simulation simulation = new SpringSimulation(_kFlingSpringDescription, value,
                                                         target, velocity);

            simulation.tolerance = _kFlingTolerance;
            stop();
            return(_startSimulation(simulation));
        }
Пример #9
0
        public TickerFuture reverse(float?from = null)
        {
            D.assert(() => {
                if (this.duration == null)
                {
                    throw new UIWidgetsError(
                        "AnimationController.reverse() called with no default Duration.\n" +
                        "The \"duration\" property should be set, either in the constructor or later, before " +
                        "calling the reverse() function."
                        );
                }

                return(true);
            });
            this._direction = _AnimationDirection.reverse;
            if (from != null)
            {
                this.setValue(from.Value);
            }

            return(this._animateToInternal(this.lowerBound));
        }
Пример #10
0
 void _directionSetter(_AnimationDirection direction)
 {
     _direction = direction;
     _status    = (_direction == _AnimationDirection.forward) ? AnimationStatus.forward : AnimationStatus.reverse;
     _checkStatusChanged();
 }