Esempio n. 1
0
 /// <summary>
 /// Wird aufgerufen wenn sich der Inhalt des Controls ändert.
 /// </summary>
 /// <param name="oldContent"></param>
 /// <param name="newContent"></param>
 protected override void OnContentChanged(object oldContent, object newContent)
 {
     if (_paintArea != null && _mainContent != null)
     {
         _paintArea.Fill = AnimateLib.CreateBrushFromVisual(_mainContent, (int)this.ActualWidth, (int)this.ActualHeight);
         _BeginAnimateContentReplacement();
     }
     base.OnContentChanged(oldContent, newContent);
 }
Esempio n. 2
0
 protected override void OnContentChanged(object oldContent, object newContent)
 {
     if (_displayTop != null && _displayBottom != null && _rectangleTop != null && _rectangleBottom != null)
     {
         _rectangleTop.Fill          = AnimateLib.CreateBrushFromVisual(_displayTop, (int)_rectangleTop.ActualWidth, (int)_rectangleTop.ActualHeight);
         _rectangleBottomStatic.Fill = AnimateLib.CreateBrushFromVisual(_displayBottom, (int)_rectangleBottomStatic.ActualWidth, (int)_rectangleBottomStatic.ActualHeight);
         _BeginAnimateContentReplacement();
     }
     base.OnContentChanged(oldContent, newContent);
 }
Esempio n. 3
0
        /// <summary>
        /// Führt die Animation für beide Contents aus
        /// </summary>
        private void _BeginAnimateContentReplacement()
        {
            OldContentTransform = new TranslateTransform();
            NewContentTransform = new TranslateTransform();

            _paintArea.Visibility        = Visibility.Visible;
            _paintArea.RenderTransform   = OldContentTransform;
            _mainContent.RenderTransform = NewContentTransform;

            IEasingFunction ease = new BackEase {
                Amplitude  = 0.5,
                EasingMode = EasingMode.EaseInOut
            };

            NewContentTransform.BeginAnimation(TranslateTransform.XProperty, AnimateLib.CreateAnimation(this.ActualWidth, 0, 0, 1, ease));
            OldContentTransform.BeginAnimation(TranslateTransform.XProperty, AnimateLib.CreateAnimation(0, -this.ActualWidth, 0, 1, ease, (s, e) => {
                _paintArea.Visibility = Visibility.Hidden;
            }));
        }
Esempio n. 4
0
        private void _BeginAnimateContentReplacement()
        {
            var flapTransformTop = new ScaleTransform {
                CenterY = _rectangleTop.ActualHeight / 2
            };

            _rectangleTop.RenderTransform = flapTransformTop;

            var flapTransformBottom = new ScaleTransform {
                CenterY = _rectangleBottom.ActualHeight / 2
            };

            _rectangleBottom.RenderTransform = flapTransformBottom;

            _rectangleTop.Visibility          = Visibility.Visible;
            _rectangleBottom.Visibility       = Visibility.Visible;
            _rectangleBottomStatic.Visibility = Visibility.Visible;

            IEasingFunction ease = null;//new BackEase() { EasingMode = EasingMode.EaseOut };

            AnimationTimeline animationTop = AnimateLib.CreateAnimation(1, 0, 0, 0.1, null, (object s, EventArgs e) =>
            {
                _rectangleTop.Visibility    = Visibility.Hidden;
                _rectangleBottom.Visibility = Visibility.Visible;
                _rectangleBottom.Fill       = AnimateLib.CreateBrushFromVisual(_displayBottom, (int)_rectangleBottom.ActualWidth, (int)_rectangleBottom.ActualHeight);
            });

            AnimationTimeline animationBottom = AnimateLib.CreateAnimation(0, 1, 0.1, 0.1, ease, (object s, EventArgs e) =>
            {
                _rectangleBottom.Visibility       = Visibility.Hidden;
                _rectangleBottomStatic.Visibility = Visibility.Hidden;
            });

            flapTransformTop.BeginAnimation(ScaleTransform.ScaleYProperty, animationTop, HandoffBehavior.SnapshotAndReplace);
            flapTransformBottom.BeginAnimation(ScaleTransform.ScaleYProperty, animationBottom, HandoffBehavior.SnapshotAndReplace);
        }