Exemplo n.º 1
0
        private void SetAnimationsForAppTiles()
        {
            int Counter = 1;

            foreach (AppTile Tile in AppGrid.Children.OfType <AppTile>())
            {
                int Duration = Counter * 80;

                AnimationCollection Col = new AnimationCollection();
                OpacityAnimation    O   = new OpacityAnimation
                {
                    Duration = new TimeSpan(0, 0, 0, 0, Duration),
                    From     = 0,
                    To       = 1.0
                };

                TranslationAnimation T = new TranslationAnimation
                {
                    Duration = new TimeSpan(0, 0, 0, 0, Duration),
                    From     = "0, 80, 0",
                    To       = "0"
                };

                Col.Add(O);
                Col.Add(T);
                Implicit.SetShowAnimations(Tile, Col);
                Counter++;
            }
        }
Exemplo n.º 2
0
        private async void ItemContainer_PointerExited(object sender, PointerRoutedEventArgs e)
        {
            var rootElement = sender as FrameworkElement;
            var shadow      = rootElement.FindDescendant <DropShadowPanel>();

            if (shadow != null)
            {
                var animation = new OpacityAnimation()
                {
                    To = 0, Duration = TimeSpan.FromMilliseconds(200)
                };
                animation.StartAnimation(shadow);
            }

            var spotlight = rootElement.FindDescendant <ShadowSpotLightControl>();

            if (spotlight != null)
            {
                var animation = new OpacityAnimation()
                {
                    To = 0, Duration = TimeSpan.FromMilliseconds(200)
                };
                animation.StartAnimation(spotlight);
            }

            var border = rootElement.FindDescendantByName("border");

            if (border != null)
            {
                var animation = new OpacityAnimation()
                {
                    To = 0, Duration = TimeSpan.FromMilliseconds(200)
                };
                animation.StartAnimation(border);
            }

            var buttons = rootElement.FindDescendantByName("Buttons");

            if (buttons != null)
            {
                var animation = new OpacityAnimation()
                {
                    To = 0, Duration = TimeSpan.FromMilliseconds(200)
                };
                animation.StartAnimation(buttons);
            }
            await Task.Delay(200);

            shadow.Visibility    = Visibility.Collapsed;
            spotlight.Visibility = Visibility.Collapsed;
            border.Visibility    = Visibility.Collapsed;
            buttons.Visibility   = Visibility.Collapsed;
        }
 private void AddOpacityAnimation(OpacityAnimation animation)
 {
     OpacityTimeline.KeyFrames.Add(
         new LinearDoubleKeyFrame(
             animation.StartTransparency,
             KeyTime.FromTimeSpan(TimeSpan.FromSeconds(animation.StartTime)))
         );
     OpacityTimeline.KeyFrames.Add(
         new LinearDoubleKeyFrame(
             animation.EndTransparency,
             KeyTime.FromTimeSpan(TimeSpan.FromSeconds(animation.EndTime)))
         );
 }
Exemplo n.º 4
0
        private void ItemContainer_PointerEntered(object sender, PointerRoutedEventArgs e)
        {
            var rootElement = sender as FrameworkElement;

            if (e.Pointer.PointerDeviceType == Windows.Devices.Input.PointerDeviceType.Mouse || e.Pointer.PointerDeviceType == Windows.Devices.Input.PointerDeviceType.Pen)
            {
                var shadow = rootElement.FindDescendant <DropShadowPanel>();
                if (shadow != null)
                {
                    shadow.Visibility = Visibility.Visible;
                    var animation = new OpacityAnimation()
                    {
                        To = 1, Duration = TimeSpan.FromMilliseconds(200)
                    };
                    animation.StartAnimation(shadow);
                }

                var spotlight = rootElement.FindDescendant <ShadowSpotLightControl>();
                if (spotlight != null)
                {
                    spotlight.Visibility = Visibility.Visible;
                    var animation = new OpacityAnimation()
                    {
                        To = 1, Duration = TimeSpan.FromMilliseconds(200)
                    };
                    animation.StartAnimation(spotlight);
                }

                var border = rootElement.FindDescendantByName("border");
                if (border != null)
                {
                    border.Visibility = Visibility.Visible;
                    var animation = new OpacityAnimation()
                    {
                        To = 1, Duration = TimeSpan.FromMilliseconds(200)
                    };
                    animation.StartAnimation(border);
                }

                var buttons = rootElement.FindDescendantByName("Buttons");
                if (buttons != null)
                {
                    buttons.Visibility = Visibility.Visible;
                    var animation = new OpacityAnimation()
                    {
                        To = 1, Duration = TimeSpan.FromMilliseconds(200), Delay = TimeSpan.FromMilliseconds(300)
                    };
                    animation.StartAnimation(buttons);
                }
            }
        }
Exemplo n.º 5
0
        private void KanjiItem_Grid_PointerCaptureLost(object sender, PointerRoutedEventArgs e)
        {
            ScaleAnimation animation = new ScaleAnimation()
            {
                To = "1", Duration = TimeSpan.FromMilliseconds(600)
            };

            animation.StartAnimation(sender as UIElement);
            var shadowPanel = (sender as UIElement).GetFirstDescendantOfType <DropShadowPanel>();
            OpacityAnimation opacityAnimation = new OpacityAnimation()
            {
                To = 0, Duration = TimeSpan.FromMilliseconds(600)
            };

            opacityAnimation.StartAnimation(shadowPanel);
        }
Exemplo n.º 6
0
        private void FlashcardItem_Grid_PointerCanceled(object sender, Windows.UI.Xaml.Input.PointerRoutedEventArgs e)
        {
            ScaleAnimation animation = new ScaleAnimation()
            {
                To = "1", Duration = TimeSpan.FromMilliseconds(600)
            };

            animation.StartAnimation(sender as UIElement);
            var shadowPanel = (sender as UIElement).GetFirstDescendantOfType <DropShadowPanel>();
            OpacityAnimation opacityAnimation = new OpacityAnimation()
            {
                To = 0, Duration = TimeSpan.FromMilliseconds(600)
            };

            opacityAnimation.StartAnimation(shadowPanel);
        }
Exemplo n.º 7
0
        private void ItemContainer_PointerExited(object sender, Windows.UI.Xaml.Input.PointerRoutedEventArgs e)
        {
            var panel = (sender as FrameworkElement).FindDescendant <DropShadowPanel>();

            if (panel != null)
            {
                var animation = new OpacityAnimation()
                {
                    To = 0, Duration = TimeSpan.FromMilliseconds(1200)
                };
                animation.StartAnimation(panel);

                var parentAnimation = new ScaleAnimation()
                {
                    To = "1", Duration = TimeSpan.FromMilliseconds(1200)
                };
                parentAnimation.StartAnimation(panel.Parent as UIElement);
            }
        }
Exemplo n.º 8
0
        private void PlayerFloating_PointerExited(object sender, PointerRoutedEventArgs e)
        {
            var panel = (sender as FrameworkElement).FindDescendant <DropShadowPanel>();

            if (panel != null)
            {
                var animation = new OpacityAnimation()
                {
                    To = 0, Duration = TimeSpan.FromMilliseconds(900)
                };
                animation.StartAnimation(panel);

                var parentAnimation = new ScaleAnimation()
                {
                    To = "1", Duration = TimeSpan.FromMilliseconds(900)
                };
                parentAnimation.StartAnimation(panel.Parent as UIElement);
            }
            GC.Collect();
        }
Exemplo n.º 9
0
        private void ItemContainer_PointerEntered(object sender, Windows.UI.Xaml.Input.PointerRoutedEventArgs e)
        {
            if (e.Pointer.PointerDeviceType == Windows.Devices.Input.PointerDeviceType.Mouse)
            {
                var panel = (sender as FrameworkElement).FindDescendant <DropShadowPanel>();
                if (panel != null)
                {
                    panel.Visibility = Visibility.Visible;
                    var animation = new OpacityAnimation()
                    {
                        To = 1, Duration = TimeSpan.FromMilliseconds(600)
                    };
                    animation.StartAnimation(panel);

                    var parentAnimation = new ScaleAnimation()
                    {
                        To = "1.1", Duration = TimeSpan.FromMilliseconds(600)
                    };
                    parentAnimation.StartAnimation(panel.Parent as UIElement);
                }
            }
        }
Exemplo n.º 10
0
        private void NoteItem_Grid_PointerCanceled(object sender, PointerRoutedEventArgs e)
        {
            ScaleAnimation animation = new ScaleAnimation()
            {
                To = "1", Duration = TimeSpan.FromMilliseconds(600)
            };

            animation.StartAnimation(sender as UIElement);
            DropShadowPanel  shadowPanel      = (sender as UIElement).GetFirstDescendantOfType <DropShadowPanel>();
            Button           delBtn           = (sender as UIElement).GetFirstDescendantOfType <Button>();
            OpacityAnimation opacityAnimation = new OpacityAnimation()
            {
                To = 0, Duration = TimeSpan.FromMilliseconds(600)
            };
            OpacityAnimation buttonOpacityAnimation = new OpacityAnimation()
            {
                To = 0, Duration = TimeSpan.FromMilliseconds(200)
            };

            opacityAnimation.StartAnimation(shadowPanel);
            buttonOpacityAnimation.StartAnimation(delBtn);
        }
Exemplo n.º 11
0
        private async void Container_Tapped(object sender, TappedRoutedEventArgs e)
        {
            var rootElement = sender as FrameworkElement;
            var shadow      = rootElement.FindDescendant <DropShadowPanel>();

            if (shadow != null)
            {
                var animation = new OpacityAnimation()
                {
                    To = 0, Duration = TimeSpan.FromMilliseconds(200)
                };
                animation.StartAnimation(shadow);
            }

            var spotlight = rootElement.FindDescendant <ShadowSpotLightControl>();

            if (spotlight != null)
            {
                var animation = new OpacityAnimation()
                {
                    To = 0, Duration = TimeSpan.FromMilliseconds(200)
                };
                animation.StartAnimation(spotlight);
            }

            var border = rootElement.FindDescendantByName("border");

            if (border != null)
            {
                var animation = new OpacityAnimation()
                {
                    To = 0, Duration = TimeSpan.FromMilliseconds(200)
                };
                animation.StartAnimation(border);
            }

            var buttons = rootElement.FindDescendantByName("Buttons");

            if (buttons != null)
            {
                var animation = new OpacityAnimation()
                {
                    To = 0, Duration = TimeSpan.FromMilliseconds(200)
                };
                animation.StartAnimation(buttons);
            }
            await Task.Delay(200);

            shadow.Visibility    = Visibility.Collapsed;
            spotlight.Visibility = Visibility.Collapsed;
            border.Visibility    = Visibility.Collapsed;
            buttons.Visibility   = Visibility.Collapsed;


            _storedItem = (sender as GridViewItem).Content;
            //clickGridViewItem = rootElement.FindDescendant<ImageEx>();
            MainVM.SetClickList((e.OriginalSource as FrameworkElement).DataContext as ILocalListModel);
            var gridView = rootElement.FindAscendant <GridView>();

            if (gridView.Name == "albums")
            {
                var ca1 = albums.PrepareConnectedAnimation("ca1", _storedItem, "Thumbnail");
            }
            else
            {
                var ca1 = playlists.PrepareConnectedAnimation("ca1", _storedItem, "Thumbnail");
            }

            Frame.Navigate(typeof(PlaylistDetailPage), MainVM, new SuppressNavigationTransitionInfo());
        }
        /// <summary>
        /// Retrieves the specified metrics and displays them in textual form.
        /// </summary>
        /// <param name="effect">The AnimationEffect whose metrics are to be displayed.</param>
        /// <param name="target">The AnimationEffecTarget whose metrics are to be displayed.</param>
        private void DisplayMetrics(AnimationEffect effect, AnimationEffectTarget target)
        {
            var s = new System.Text.StringBuilder();
            AnimationDescription animationDescription = new AnimationDescription(effect, target);

            s.AppendFormat("Stagger delay = {0}ms", animationDescription.StaggerDelay.TotalMilliseconds);
            s.AppendLine();
            s.AppendFormat("Stagger delay factor = {0}", animationDescription.StaggerDelayFactor);
            s.AppendLine();
            s.AppendFormat("Delay limit = {0}ms", animationDescription.DelayLimit.TotalMilliseconds);
            s.AppendLine();
            s.AppendFormat("ZOrder = {0}", animationDescription.ZOrder);
            s.AppendLine();
            s.AppendLine();

            int animationIndex = 0;

            foreach (var animation in animationDescription.Animations)
            {
                s.AppendFormat("Animation #{0}:", ++animationIndex);
                s.AppendLine();

                switch (animation.Type)
                {
                case PropertyAnimationType.Scale:
                {
                    ScaleAnimation scale = animation as ScaleAnimation;
                    s.AppendLine("Type = Scale");
                    if (scale.InitialScaleX.HasValue)
                    {
                        s.AppendFormat("InitialScaleX = {0}", scale.InitialScaleX.Value);
                        s.AppendLine();
                    }
                    if (scale.InitialScaleY.HasValue)
                    {
                        s.AppendFormat("InitialScaleY = {0}", scale.InitialScaleY.Value);
                        s.AppendLine();
                    }
                    s.AppendFormat("FinalScaleX = {0}", scale.FinalScaleX);
                    s.AppendLine();
                    s.AppendFormat("FinalScaleY = {0}", scale.FinalScaleY);
                    s.AppendLine();
                    s.AppendFormat("Origin = {0}, {1}", scale.NormalizedOrigin.X, scale.NormalizedOrigin.Y);
                    s.AppendLine();
                }
                break;

                case PropertyAnimationType.Translation:
                    s.AppendLine("Type = Translation");
                    break;

                case PropertyAnimationType.Opacity:
                {
                    OpacityAnimation opacity = animation as OpacityAnimation;
                    s.AppendLine("Type = Opacity");
                    if (opacity.InitialOpacity.HasValue)
                    {
                        s.AppendFormat("InitialOpacity = {0}", opacity.InitialOpacity.Value);
                        s.AppendLine();
                    }
                    s.AppendFormat("FinalOpacity = {0}", opacity.FinalOpacity);
                    s.AppendLine();
                }
                break;
                }

                s.AppendFormat("Delay = {0}ms", animation.Delay.TotalMilliseconds);
                s.AppendLine();
                s.AppendFormat("Duration = {0}ms", animation.Duration.TotalMilliseconds);
                s.AppendLine();
                s.AppendFormat("Cubic Bezier control points");
                s.AppendLine();
                s.AppendFormat("    X1 = {0}, Y1 = {1}", animation.Control1.X, animation.Control1.Y);
                s.AppendLine();
                s.AppendFormat("    X2 = {0}, Y2 = {1}", animation.Control2.X, animation.Control2.Y);
                s.AppendLine();
                s.AppendLine();
            }

            Metrics.Text = s.ToString();
        }