private async void TogglePaneButton_Click(object sender, RoutedEventArgs e)
        {
            panelIsOpen = !panelIsOpen;
            //var window = (Style)Application.Current.Resources["MyNavigationViewStyle"];
            //var template = (ControlTemplate)window.Setters[3].GetValue(); // "MyNavigationViewControlTemplate"
            //var a = this.Resources[""]; // MyNavigationViewControlTemplate.GetValue(ContentProperty);
            //MyNavigationViewControlTemplate.GetValue(ContentControl)
            //MyNavigationViewControlTemplate.
            //MyNavigationViewControlTemplate
            //Button button = sender as Button;
            //Grid grid = (Grid)button.Parent;
            //grid.
            //AnimatedVisualPlayer animatedVisualPlayer = button.Content as AnimatedVisualPlayer;
            //animatedVisualPlayer.AutoPlay = true;

            if (player == null)
            {
                Button button = sender as Button;
                Grid   grid   = (Grid)button.Parent;

                player = grid.Children[2] as AnimatedVisualPlayer;
            }

            if (player.IsPlaying)
            {
                if (panelIsOpen)
                {
                    player.PlaybackRate = -3.5;


                    // await player.PlayAsync(player.currentState, 0.8, false);
                    await player.PlayAsync(0, 0.8, false);
                }
                else
                {
                    player.PlaybackRate = 2;
                    await player.PlayAsync(0, 1, false);
                }
            }
            else
            {
                if (panelIsOpen)
                {
                    player.PlaybackRate = -3.5;
                    await player.PlayAsync(0, 0.8, false);
                }
                else
                {
                    player.PlaybackRate = 2;
                    await player.PlayAsync(0, 1, false);
                }
            }
        }
Exemplo n.º 2
0
        async Task RunAnimatedSplashScreenAsync()
        {
            // Insert splashBorder above the current window content.
            var originalWindowContent = Window.Current.Content;

            var splashBorder = new Border();

            splashBorder.Background = (SolidColorBrush)Current.Resources["SystemControlHighlightAccentBrush"];

            // Use modified LottieLogo1 animation based on user's accent color.
            var lottieSource = new LottieLogo1_Modified();

            lottieSource.BackgroundColor = (Color)Resources["SystemAccentColor"];
            lottieSource.HighlightColor  = (Color)Resources["SystemAccentColorDark2"];

            // Instantiate Player with modified Source
            var player = new AnimatedVisualPlayer
            {
                Stretch  = Stretch.Uniform,
                AutoPlay = false,
                Source   = lottieSource,
            };

            splashBorder.Child     = player;
            Window.Current.Content = splashBorder;

            // Start playing the splashscreen animation.
            await player.PlayAsync(fromProgress : 0, toProgress : 0.599, looped : false);

            // Reset window content after the splashscreen animation has completed.
            Window.Current.Content = originalWindowContent;
        }
Exemplo n.º 3
0
        // Runs the animated splash screen as content for the current window. The
        // returned Task completes when the animation finishes.
        async Task RunAnimatedSplashScreenAsync()
        {
            // Insert splashBorder above the current window content.
            var originalWindowContent = Window.Current.Content;
            var splashBorder          = new Border();

            splashBorder.Background = (SolidColorBrush)Current.Resources["LottieBasicBrush"];

            var player = new AnimatedVisualPlayer
            {
                Stretch  = Stretch.Uniform,
                AutoPlay = false,
                Source   = new LottieLogo(),
            };

            splashBorder.Child = player;

            Window.Current.Content = splashBorder;

            // Start playing.
            await player.PlayAsync(fromProgress : 0, toProgress : 0.599, looped : false);

            // Reset window content after the splashscreen animation has completed.
            Window.Current.Content = originalWindowContent;
        }
Exemplo n.º 4
0
        private void UpdateStates()
        {
            AnimatedVisualPlayer player = (AnimatedVisualPlayer)Children[0];

            if (this.IsActive)
            {
                player.Opacity = 1;

                if (this.ShowPaused)
                {
                    player.Pause();
                }
                else if (this.IsIndeterminate)
                {
                    _ = player.PlayAsync(0, 1, IsLooping);
                }
                else if (!this.IsIndeterminate)
                {
                    player.SetProgress(ProgressPosition);
                }
            }
            else
            {
                player.Stop();
                player.Opacity = 0;
            }
        }
        private void UpdateStates()
        {
            AnimatedVisualPlayer player = (AnimatedVisualPlayer)Children[0];

            if (this.IsAnimating)
            {
                _ = player.PlayAsync(0, 1, IsLooping);
            }
            else
            {
                player.Stop();
            }
        }
Exemplo n.º 6
0
 // Plays the segment on the given player.
 public async Task PlayAsync(AnimatedVisualPlayer player)
 => await player.PlayAsync(FromProgress, ToProgress, Looping);
        public void RunAnimation(double start, double end, bool loop)
        {
            AnimatedVisualPlayer player = (AnimatedVisualPlayer)Children[0];

            _ = player.PlayAsync(start, end, loop);
        }