Inheritance: EasingFunctionBase, IQuadraticEase
        private void NotificationTimer_Tick(object sender, object e)
        {
            DoubleAnimation animation = new DoubleAnimation();
            animation.From = NotificationContainer.Opacity;
            animation.To = 0;
            animation.Duration = TimeSpan.FromMilliseconds(300);
            QuadraticEase ease = new QuadraticEase();
            ease.EasingMode = EasingMode.EaseIn;
            animation.EasingFunction = ease;

            DoubleAnimation translate = new DoubleAnimation();
            translate.From = NotificationTransform.X;
            translate.To = 20;
            translate.Duration = TimeSpan.FromMilliseconds(300);
            translate.EasingFunction = ease;

            Storyboard storyboard = new Storyboard();
            Storyboard.SetTarget(animation, NotificationContainer);
            Storyboard.SetTargetProperty(animation, "Opacity");

            Storyboard.SetTarget(translate, NotificationTransform);
            Storyboard.SetTargetProperty(translate, "X");
            storyboard.Children.Add(translate);

            storyboard.Children.Add(animation);
            storyboard.Completed += Storyboard_Completed;
            storyboard.Begin();

            if (sender != null)
            {
                DispatcherTimer NotificationTimer = sender as DispatcherTimer;
                if (NotificationTimer.IsEnabled)
                    NotificationTimer.Stop();

            }
            else
            {
                var timer = NotificationContainer.DataContext as DispatcherTimer;
                if (timer != null)
                {
                    if (timer.IsEnabled)
                        timer.Stop();
                    Timers.Clear();
                }
            }
            ViewModel.IsToastActivated = false;
        }
Example #2
0
        public override double Ease(double currentTime, double startValue, double finalValue, double duration)
        {
            var    changeInValue = finalValue - startValue;
            double timePower     = 1;

            //Use linear if Power of 1
            if (Power == 1)
            {
                return(changeInValue * currentTime / duration + startValue);
            }

            //Use Quadratic if Power of 2
            if (Power == 2)
            {
                var quad = new QuadraticEase();
                return(quad.Ease(currentTime, startValue, finalValue, duration));
            }

            //Depending on the mode we have different functions for the return value.
            switch (this.EasingMode)
            {
            case EasingMode.EaseIn:
                currentTime /= duration;

                for (int i = 0; i < Power; i++)
                {
                    timePower *= currentTime;
                }
                return(changeInValue * timePower + startValue);

            case EasingMode.EaseOut:
                currentTime /= duration;

                for (int i = 0; i < Power; i++)
                {
                    timePower *= currentTime;
                }

                if (Power % 2 == 0)
                {
                    return(-changeInValue * (timePower - 1) + startValue);
                }
                return(changeInValue * (timePower + 1) + startValue);

            case EasingMode.EaseInOut:

                currentTime /= duration / 2;

                for (int i = 0; i <= Power; i++)
                {
                    timePower *= currentTime;
                }

                if (currentTime < 1)
                {
                    return(changeInValue / 2 * timePower + startValue);
                }
                currentTime -= 2;

                if (Power % 2 == 0)
                {
                    return(changeInValue / 2 * (timePower + 2) + startValue);
                }

                return(-changeInValue / 2 * (timePower - 2) + startValue);

            default:
                return(finalValue * currentTime / duration + startValue);
            }
        }
Example #3
0
        private Storyboard GetStoryboard(Image target)
        {
            Storyboard storyboard = new Storyboard();

            if (target.Source != null)
            {
                Storyboard.SetTarget(storyboard, target.RenderTransform);

                var bitmapSource = (Windows.UI.Xaml.Media.Imaging.BitmapSource)(target.Source);

                DoubleAnimationUsingKeyFrames anim;
                QuadraticEase easingFunction = new QuadraticEase() { EasingMode = EasingMode.EaseInOut };
                //if (bitmapSource.PixelHeight > bitmapSource.PixelWidth)
                {

                    anim = new DoubleAnimationUsingKeyFrames();
                    //ANIM on Y
                    var minYValue = 0;
                    var maxYValue = Math.Abs(this.ActualHeight - bitmapSource.PixelHeight);
                    var offset = (this.ActualHeight > maxYValue) ? maxYValue / 2 : 0.0;

                    Storyboard.SetTargetProperty(anim, "TranslateY");
                    anim.AutoReverse = true;
                    anim.RepeatBehavior = RepeatBehavior.Forever;
                    var durationOnY = rnd.Next(9, 19) * Math.Max(maxYValue / 150, 1);

                    anim.KeyFrames.Add(new EasingDoubleKeyFrame() { KeyTime = TimeSpan.FromSeconds(0), Value = minYValue + offset, EasingFunction = easingFunction });
                    anim.KeyFrames.Add(new EasingDoubleKeyFrame() { KeyTime = TimeSpan.FromSeconds(durationOnY), Value = -maxYValue + offset, EasingFunction = easingFunction });
                    anim.KeyFrames.Add(new EasingDoubleKeyFrame() { KeyTime = TimeSpan.FromSeconds(durationOnY * 2), Value = minYValue + offset, EasingFunction = easingFunction });

                    storyboard.Children.Add(anim);

                }

                //if (bitmapSource.PixelWidth > bitmapSource.PixelHeight)
                {

                    var minXValue = 0;

                    var maxXValue = Math.Abs(this.ActualWidth - bitmapSource.PixelWidth);
                    var offsetX = (this.ActualWidth > bitmapSource.PixelWidth) ? maxXValue / 2 : 0.0;

                    anim = new DoubleAnimationUsingKeyFrames();
                    Storyboard.SetTargetProperty(anim, "TranslateX");
                    anim.AutoReverse = true;
                    anim.RepeatBehavior = RepeatBehavior.Forever;
                    var durationOnX = rnd.Next(9, 19) * Math.Max(1, maxXValue / 150);
                    easingFunction = new QuadraticEase() { EasingMode = EasingMode.EaseInOut };
                    anim.KeyFrames.Add(new EasingDoubleKeyFrame() { KeyTime = TimeSpan.FromSeconds(0), Value = minXValue + offsetX, EasingFunction = easingFunction });
                    anim.KeyFrames.Add(new EasingDoubleKeyFrame() { KeyTime = TimeSpan.FromSeconds(durationOnX), Value = -maxXValue + offsetX, EasingFunction = easingFunction });
                    anim.KeyFrames.Add(new EasingDoubleKeyFrame() { KeyTime = TimeSpan.FromSeconds(durationOnX * 2), Value = minXValue, EasingFunction = easingFunction });
                    storyboard.Children.Add(anim);
                }
            }

            return storyboard;
        }
        private void App_OnToastActivated(string text, double milisecs)
        {
            pmilisecs = milisecs;
            //TODO: Make toast independent
            NotificationContainer.Visibility = Visibility.Visible;
            NotificationText.Text = text;
            DoubleAnimation animation = new DoubleAnimation();
            animation.From = NotificationContainer.Opacity;
            animation.To = 1;
            animation.Duration = TimeSpan.FromMilliseconds(300);
            QuadraticEase ease = new QuadraticEase();
            ease.EasingMode = EasingMode.EaseOut;
            animation.EasingFunction = ease;

            Storyboard storyboard = new Storyboard();
            Storyboard.SetTarget(animation, NotificationContainer);
            Storyboard.SetTargetProperty(animation, "Opacity");

            DoubleAnimation translate = new DoubleAnimation();
            translate.From = NotificationTransform.X;
            translate.To = -20;
            translate.Duration = TimeSpan.FromMilliseconds(300);
            translate.EasingFunction = ease;

            Storyboard.SetTarget(translate, NotificationTransform);
            Storyboard.SetTargetProperty(translate, "X");
            storyboard.Children.Add(translate);

            storyboard.Children.Add(animation);
            storyboard.Completed += StartTimer;
            storyboard.Begin();

            ViewModel.IsToastActivated = true;
        }
Example #5
0
        internal void AnimateContainerDropDown()
        {
            if (Items == null)
                return;
            for (var i = 0; i < Items.Count; i++)
            {
                var container = ContainerFromIndex(i) as FrameworkElement;
                if (container == null)
                {
                    break;
                }

                var itemDropDown = new Storyboard();
                var quadraticEase = new QuadraticEase { EasingMode = EasingMode.EaseOut };
                var initialKeyTime = InitialKeyTime + (KeyTimeStep * i);
                var finalKeyTime = FinalKeyTime + (KeyTimeStep * i);

                var translation = new TranslateTransform();
                container.RenderTransform = translation;

                var transAnimation = new DoubleAnimationUsingKeyFrames();

                var transKeyFrame1 = new EasingDoubleKeyFrame
                {
                    EasingFunction = quadraticEase,
                    KeyTime = TimeSpan.FromMilliseconds(0.0),
                    Value = -150.0
                };

                var transKeyFrame2 = new EasingDoubleKeyFrame
                {
                    EasingFunction = quadraticEase,
                    KeyTime = TimeSpan.FromMilliseconds(initialKeyTime),
                    Value = 0.0
                };

                var transKeyFrame3 = new EasingDoubleKeyFrame
                {
                    EasingFunction = quadraticEase,
                    KeyTime = TimeSpan.FromMilliseconds(finalKeyTime),
                    Value = 0.0
                };

                transAnimation.KeyFrames.Add(transKeyFrame1);
                transAnimation.KeyFrames.Add(transKeyFrame2);
                transAnimation.KeyFrames.Add(transKeyFrame3);

                Storyboard.SetTarget(transAnimation, container);
                Storyboard.SetTargetProperty(transAnimation, "(UIElement.RenderTransform).(TranslateTransform.Y)");
                itemDropDown.Children.Add(transAnimation);

                var opacityAnimation = new DoubleAnimationUsingKeyFrames();
                var opacityKeyFrame1 = new EasingDoubleKeyFrame
                {
                    EasingFunction = quadraticEase,
                    KeyTime = TimeSpan.FromMilliseconds(0.0),
                    Value = 0.0
                };

                var opacityKeyFrame2 = new EasingDoubleKeyFrame
                {
                    EasingFunction = quadraticEase,
                    KeyTime = TimeSpan.FromMilliseconds(initialKeyTime - 150),
                    Value = 0.0
                };

                var opacityKeyFrame3 = new EasingDoubleKeyFrame
                {
                    EasingFunction = quadraticEase,
                    KeyTime = TimeSpan.FromMilliseconds(finalKeyTime),
                    Value = 1.0
                };

                opacityAnimation.KeyFrames.Add(opacityKeyFrame1);
                opacityAnimation.KeyFrames.Add(opacityKeyFrame2);
                opacityAnimation.KeyFrames.Add(opacityKeyFrame3);

                Storyboard.SetTarget(opacityAnimation, container);
                Storyboard.SetTargetProperty(opacityAnimation, "(UIElement.Opacity)");
                itemDropDown.Children.Add(opacityAnimation);

                itemDropDown.Begin();
            }
        }
Example #6
0
        /// <summary>
        /// Provides the feathered animation for items
        /// when the Expander View goes from collapsed to expanded.
        /// </summary>
        internal void AnimateContainerDropDown()
        {
            for (int i = 0; i < Items.Count; i++)
            {
                FrameworkElement container = ContainerFromIndex(i) as FrameworkElement;

                if (container == null)
                {
                    break;
                }

                Storyboard itemDropDown = new Storyboard();
                EasingFunctionBase quadraticEase = new QuadraticEase { EasingMode = EasingMode.EaseOut };
                int initialKeyTime = InitialKeyTime + (KeyTimeStep * i);
                int finalKeyTime = FinalKeyTime + (KeyTimeStep * i);

                TranslateTransform translation = new TranslateTransform();
                container.RenderTransform = translation;

                DoubleAnimationUsingKeyFrames transAnimation = new DoubleAnimationUsingKeyFrames();

                EasingDoubleKeyFrame transKeyFrame1 = new EasingDoubleKeyFrame();
                transKeyFrame1.EasingFunction = quadraticEase;
                transKeyFrame1.KeyTime = TimeSpan.FromMilliseconds(0.0);
                transKeyFrame1.Value = -150.0;

                EasingDoubleKeyFrame transKeyFrame2 = new EasingDoubleKeyFrame();
                transKeyFrame2.EasingFunction = quadraticEase;
                transKeyFrame2.KeyTime = TimeSpan.FromMilliseconds(initialKeyTime);
                transKeyFrame2.Value = 0.0;

                EasingDoubleKeyFrame transKeyFrame3 = new EasingDoubleKeyFrame();
                transKeyFrame3.EasingFunction = quadraticEase;
                transKeyFrame3.KeyTime = TimeSpan.FromMilliseconds(finalKeyTime);
                transKeyFrame3.Value = 0.0;

                transAnimation.KeyFrames.Add(transKeyFrame1);
                transAnimation.KeyFrames.Add(transKeyFrame2);
                transAnimation.KeyFrames.Add(transKeyFrame3);

                Storyboard.SetTarget(transAnimation, translation);
                Storyboard.SetTargetProperty(transAnimation, "Y");
                itemDropDown.Children.Add(transAnimation);

                DoubleAnimationUsingKeyFrames opacityAnimation = new DoubleAnimationUsingKeyFrames();

                EasingDoubleKeyFrame opacityKeyFrame1 = new EasingDoubleKeyFrame();
                opacityKeyFrame1.EasingFunction = quadraticEase;
                opacityKeyFrame1.KeyTime = TimeSpan.FromMilliseconds(0.0);
                opacityKeyFrame1.Value = 0.0;

                EasingDoubleKeyFrame opacityKeyFrame2 = new EasingDoubleKeyFrame();
                opacityKeyFrame2.EasingFunction = quadraticEase;
                opacityKeyFrame2.KeyTime = TimeSpan.FromMilliseconds(initialKeyTime - 150);
                opacityKeyFrame2.Value = 0.0;

                EasingDoubleKeyFrame opacityKeyFrame3 = new EasingDoubleKeyFrame();
                opacityKeyFrame3.EasingFunction = quadraticEase;
                opacityKeyFrame3.KeyTime = TimeSpan.FromMilliseconds(finalKeyTime);
                opacityKeyFrame3.Value = 1.0;

                opacityAnimation.KeyFrames.Add(opacityKeyFrame1);
                opacityAnimation.KeyFrames.Add(opacityKeyFrame2);
                opacityAnimation.KeyFrames.Add(opacityKeyFrame3);

                Storyboard.SetTarget(opacityAnimation, container);
                Storyboard.SetTargetProperty(opacityAnimation, "Opacity");
                itemDropDown.Children.Add(opacityAnimation);

                itemDropDown.Begin();
            }
        }
Example #7
0
        private void Swipe(CompositeTransform transform, double Milisecs, bool IsRight = true)
        {
            DoubleAnimation animation = new DoubleAnimation();
            animation.From = transform.Rotation;
            animation.To = IsRight ? 30 : -30;
            animation.Duration = TimeSpan.FromMilliseconds(Milisecs);
            QuadraticEase ease = new QuadraticEase();
            ease.EasingMode = EasingMode.EaseOut;
            animation.EasingFunction = ease;

            Storyboard storyboard = new Storyboard();
            Storyboard.SetTarget(animation, transform);
            Storyboard.SetTargetProperty(animation, "Rotation");
            storyboard.Children.Add(animation);
            storyboard.Completed += Storyboard_Completed;
            storyboard.Begin();

            var Wallet = (new ViewModelLocator()).Wallet;
            var current_res = ListCard.LastOrDefault().DataContext as Restaurant;
            var res = Wallet.Restaurants.Where(r => r.Name == current_res.Name).FirstOrDefault();
            if (res == null)
            {

                if (IsRight)
                {
                    //Move to quán ruột
                    Wallet.Restaurants.Add(current_res);
            }
                else
                {

                }
            }
        }
Example #8
0
        private void TimerMove(TimerTile timerTile, double Start, double End)
        {
            try
            {
                Storyboard MoveTile = new Storyboard();
                QuadraticEase ease = new QuadraticEase();
                ease.EasingMode = EasingMode.EaseIn;

                DoubleAnimation MoveAnimation = new DoubleAnimation();
                MoveAnimation.Duration = new Duration(TimeSpan.FromMilliseconds(250));
                MoveAnimation.From = Start;
                MoveAnimation.To = End;
                MoveAnimation.EasingFunction = ease;

                Storyboard.SetTarget(MoveAnimation, timerTile);
                Storyboard.SetTargetProperty(MoveAnimation, "(Canvas.Top)");

                MoveTile.Children.Add(MoveAnimation);
                MoveTile.Begin();
            }
            catch (Exception ex)
            {
                logException(ex);
            }
        }
Example #9
0
        private void Border_ManipulationCompleted(object sender, ManipulationCompletedRoutedEventArgs e)
        {
            var transform = (sender as FrameworkElement).RenderTransform as CompositeTransform;
            if (Math.Abs(transform.Rotation) < 10)
            {
                DoubleAnimation animation = new DoubleAnimation();
                animation.From = transform.Rotation;
                animation.To = 0;
                animation.Duration = TimeSpan.FromMilliseconds(400);
                QuadraticEase ease = new QuadraticEase();
                ease.EasingMode = EasingMode.EaseOut;
                animation.EasingFunction = ease;

                Storyboard storyboard = new Storyboard();
                Storyboard.SetTarget(animation, transform);
                Storyboard.SetTargetProperty(animation, "Rotation");
                storyboard.Children.Add(animation);
                storyboard.Begin();
            }
            else
            {
                //TODO Animate the card to left or right depend on the current position, maximum 200
                if (transform.Rotation > 0)
                    Swipe(transform, 100);
                else
                    Swipe(transform, 100, false);

            }
        }
Example #10
0
        private void LargeAlbumCover_ManipulationCompleted(object sender, ManipulationCompletedRoutedEventArgs e)
        {
            if (!isManipulationCanceled)
            {
                var x = LargeAlbumCoverTranslateTransform.X;

                if (x == 0)
                    return;

                var easing = new QuadraticEase() { EasingMode = EasingMode.EaseOut };

                var movementEnd = TimeSpan.FromMilliseconds(200);
                var animation = new DoubleAnimationUsingKeyFrames();
                animation.KeyFrames.Add(new EasingDoubleKeyFrame()
                {
                    KeyTime = TimeSpan.Zero,
                    Value = x,
                    EasingFunction = easing
                });
                animation.KeyFrames.Add(new EasingDoubleKeyFrame()
                {
                    KeyTime = movementEnd,
                    Value = 0,
                    EasingFunction = easing
                });

                Storyboard.SetTarget(animation, this.LargeAlbumCoverTranslateTransform);
                Storyboard.SetTargetProperty(animation, "X");

                var storyboard = new Storyboard();

                storyboard.Children.Add(animation);
                storyboard.Begin();
                storyboard.Completed += (s, ev) => LargeAlbumCoverTranslateTransform.X = 0;
                currentStoryboard = storyboard;
            }
        }
Example #11
0
 //Get Easing Function
 private EasingFunctionBase GetEasingFunction(Easing type)
 {
     EasingFunctionBase func = null;
     switch (type)
     {
         case Easing.EaseSineIn:
         case Easing.EaseSineOut:
         case Easing.EaseSineInOut:
             func = new SineEase();
             break;
         case Easing.EaseCircleIn:
         case Easing.EaseCircleOut:
         case Easing.EaseCircleInOut:
             func = new CircleEase();
             break;
         case Easing.EaseQuadraticIn:
         case Easing.EaseQuadraticOut:
         case Easing.EaseQuadraticInOut:
             func = new QuadraticEase();
             break;
         case Easing.EaseCubicIn:
         case Easing.EaseCubicOut:
         case Easing.EaseCubicInOut:
             func = new CubicEase();
             break;
         case Easing.EaseQuarticIn:
         case Easing.EaseQuarticOut:
         case Easing.EaseQuarticInOut:
             func = new QuarticEase();
             break;
         case Easing.EaseQuinticIn:
         case Easing.EaseQuinticOut:
         case Easing.EaseQuinticInOut:
             func = new QuinticEase();
             break;
         case Easing.EaseBackIn:
         case Easing.EaseBackOut:
         case Easing.EaseBackInOut:
             func = new BackEase();
             break;
         case Easing.EaseBounceIn:
         case Easing.EaseBounceOut:
         case Easing.EaseBounceInOut:
             func = new BounceEase();
             break;
         case Easing.EaseElasticIn:
         case Easing.EaseElasticOut:
         case Easing.EaseElasticInOut:
             func = new ElasticEase();
             break;
         case Easing.EaseExpoIn:
         case Easing.EaseExpoOut:
         case Easing.EaseExpoInOut:
             func = new ExponentialEase();
             break;
         case Easing.EasePowerIn:
         case Easing.EasePowerOut:
         case Easing.EasePowerInOut:
             func = new PowerEase();
             break;
         default:
             break;
     }
     if (func != null)
     {
         switch ((int)type % 3)
         {
             case 0:
                 func.EasingMode = EasingMode.EaseIn;
                 break;
             case 1:
                 func.EasingMode = EasingMode.EaseOut;
                 break;
             default:
                 func.EasingMode = EasingMode.EaseInOut;
                 break;
         }
     }
     return func;
 }
        private void UpdateTextAndAnimation()
        {
            this.TextBlock.Text = LongText;
            this.TextBlock.Style = TextStyle;

            if (currentStoryboard != null)
                currentStoryboard.Stop();

            this.TextBlock.Measure(new Size(1000, 100));
            var x = this.TextBlock.DesiredSize.Width - this.ActualWidth;
            this.Height = this.TextBlock.DesiredSize.Height;

            if (x < 10 || this.ActualWidth == 0)
                return;

            if (x < 50)
                x = 50;
            else
                x += 8;

            var easing = new QuadraticEase() { EasingMode = EasingMode.EaseInOut };
            var movementBegin = TimeSpan.FromMilliseconds(3000);
            var movementEnd = movementBegin + TimeSpan.FromMilliseconds(200 + (15 * x));
            var animation = new DoubleAnimationUsingKeyFrames();
            animation.KeyFrames.Add(new EasingDoubleKeyFrame()
            {
                KeyTime = TimeSpan.Zero,
                Value = 0,
                EasingFunction = easing
            });
            animation.KeyFrames.Add(new EasingDoubleKeyFrame()
            {
                KeyTime = movementBegin,
                Value = 0,
                EasingFunction = easing
            });
            animation.KeyFrames.Add(new EasingDoubleKeyFrame()
            {
                KeyTime = movementEnd,
                Value = -x,
                EasingFunction = easing
            });
            animation.KeyFrames.Add(new EasingDoubleKeyFrame()
            {
                KeyTime = movementEnd + TimeSpan.FromMilliseconds(400),
                Value = -x,
            });
            animation.KeyFrames.Add(new EasingDoubleKeyFrame()
            {
                KeyTime = movementEnd + TimeSpan.FromMilliseconds(401),
                Value = 0,
            });

            Storyboard.SetTarget(animation, this.TextBlockTranslateTransform);
            Storyboard.SetTargetProperty(animation, "X");

            var fadeAnimation = new DoubleAnimationUsingKeyFrames();
            fadeAnimation.KeyFrames.Add(new EasingDoubleKeyFrame()
            {
                KeyTime = movementEnd,
                Value = 1
            });
            fadeAnimation.KeyFrames.Add(new EasingDoubleKeyFrame()
            {
                KeyTime = movementEnd + TimeSpan.FromMilliseconds(400),
                Value = 0
            });
            fadeAnimation.KeyFrames.Add(new EasingDoubleKeyFrame()
            {
                KeyTime = movementEnd + TimeSpan.FromMilliseconds(800),
                Value = 1
            });

            Storyboard.SetTarget(fadeAnimation, this.TextBlock);
            Storyboard.SetTargetProperty(fadeAnimation, "Opacity");

            var storyboard = new Storyboard();
           
            storyboard.RepeatBehavior = RepeatBehavior.Forever;
            storyboard.Children.Add(animation);
            storyboard.Children.Add(fadeAnimation);
            storyboard.Begin();
            currentStoryboard = storyboard;
        }
        private void AnimateSideMenu(bool isSideMenuOpen)
        {
            if (isSideMenuOpen)
            {
                DoubleAnimation animation = new DoubleAnimation();
                animation.To = 0;
                animation.Duration = TimeSpan.FromMilliseconds(300);
                QuadraticEase ease = new QuadraticEase();
                ease.EasingMode = EasingMode.EaseIn;
                animation.EasingFunction = ease;

                Storyboard storyboard = new Storyboard();
                Storyboard.SetTarget(animation, sideMenuTransform);
                Storyboard.SetTargetProperty(animation, "Y");
                storyboard.Children.Add(animation);
                storyboard.Begin();


            }
            else
            {
                DoubleAnimation animation = new DoubleAnimation();
                animation.To = sideMenuMaxY;
                animation.Duration = TimeSpan.FromMilliseconds(400);
                BounceEase ease = new BounceEase();
                ease.Bounces = 4;
                ease.Bounciness = 4;
                ease.EasingMode = EasingMode.EaseOut;
                animation.EasingFunction = ease;

                Storyboard storyboard = new Storyboard();
                Storyboard.SetTarget(animation, sideMenuTransform);
                Storyboard.SetTargetProperty(animation, "Y");
                storyboard.Children.Add(animation);
                storyboard.Begin();
            }
        }