Beispiel #1
0
            protected override void didUpdateTweens()
            {
                List <TweenSequenceItem <float> > list = new List <TweenSequenceItem <float> >();

                Debug.Assert(widget.fadeOutDuration?.Milliseconds != null,
                             "widget.fadeOutDuration?.Milliseconds != null");
                list.Add(new TweenSequenceItem <float>(
                             tween: _placeholderOpacity.chain(new CurveTween(curve: widget.fadeOutCurve)),
                             weight: (float)widget.fadeOutDuration?.Milliseconds
                             ));

                Debug.Assert(widget.fadeInDuration?.Milliseconds != null,
                             "widget.fadeInDuration?.Milliseconds != null");
                list.Add(new TweenSequenceItem <float>(
                             tween: new ConstantTween <float>(0),
                             weight: (float)widget.fadeInDuration?.Milliseconds
                             ));


                _placeholderOpacityAnimation = animation.drive(new TweenSequence <float>(list));
                _placeholderOpacityAnimation.addStatusListener((AnimationStatus status) => {
                    if (_placeholderOpacityAnimation.isCompleted)
                    {
                        setState(() => {});
                    }
                });

                List <TweenSequenceItem <float> > list2 = new List <TweenSequenceItem <float> >();

                list2.Add(new TweenSequenceItem <float>(
                              tween: new ConstantTween <float>(0),
                              weight: (float)widget.fadeOutDuration?.Milliseconds
                              ));
                list2.Add(new TweenSequenceItem <float>(
                              tween: _targetOpacity.chain(new CurveTween(curve: widget.fadeInCurve)),
                              weight: (float)widget.fadeInDuration?.Milliseconds
                              ));
                _targetOpacityAnimation = animation.drive(new TweenSequence <float>(list2));
                if (!widget.isTargetLoaded && _isValid(_placeholderOpacity) && _isValid(_targetOpacity))
                {
                    controller.setValue(controller.upperBound);
                }
            }