Example #1
0
        private void StartAnimateBGImages()
        {
            DoubleAnimation animation;

            animation             = new DoubleAnimation();
            animation.To          = 0.9;
            animation.From        = 1;
            animation.Duration    = new Duration(TimeSpan.FromSeconds(5));
            animation.AutoReverse = false;
            animation.Completed  += Animation_Completed;
            MainMenuBGImage.BeginAnimation(ImageBrush.OpacityProperty, animation);
        }
Example #2
0
        private void Animation_Completed(object sender, EventArgs e)
        {
            // fade out the image and fade in the new one
            DoubleAnimation animation;

            animation             = new DoubleAnimation();
            animation.To          = 0;
            animation.From        = 0.9;
            animation.Duration    = new Duration(TimeSpan.FromSeconds(1));
            animation.AutoReverse = false;
            animation.Completed  += ShowNextBGImage;
            MainMenuBGImage.BeginAnimation(ImageBrush.OpacityProperty, animation);
        }
Example #3
0
        private void ShowNextBGImage(object sender, EventArgs e)
        {
            if (_swapImage)
            {
                MainMenuBGImage.ImageSource = new BitmapImage(new Uri(Path.Combine("file:///", Directory.GetCurrentDirectory(), @"Assets\mainmenu_bg.png")));
                _swapImage = false;
            }
            else
            {
                _swapImage = true;
                MainMenuBGImage.ImageSource = new BitmapImage(new Uri(Path.Combine("file:///", Directory.GetCurrentDirectory(), @"Assets\mainmenu_bg2.png")));
            }

            // fade out the image and fade in the new one
            DoubleAnimation animation;

            animation             = new DoubleAnimation();
            animation.To          = 1;
            animation.From        = 0;
            animation.Duration    = new Duration(TimeSpan.FromSeconds(1));
            animation.AutoReverse = false;
            animation.Completed  += ResetAnimation;
            MainMenuBGImage.BeginAnimation(ImageBrush.OpacityProperty, animation);
        }