/// <summary> /// The start animation. /// </summary> /// <param name="target"> /// The target. /// </param> /// <returns> /// The <see cref="Storyboard"/>. /// </returns> public override Storyboard GenerateAnimation(FrameworkElement target) { var fadeOutTheme = new FadeOutThemeAnimation(); Storyboard.SetTarget(fadeOutTheme, target); var storyboard = new Storyboard(); storyboard.Children.Add(fadeOutTheme); return(storyboard); }
public static void FadeOut(UIElement element) { var fadeOutStoryboard = new Storyboard(); var fadeOutAnimation = new FadeOutThemeAnimation(); Storyboard.SetTarget(fadeOutAnimation, element); fadeOutStoryboard.Children.Add(fadeOutAnimation); fadeOutStoryboard.Completed += (sender, o) => element.Visibility = Visibility.Collapsed; fadeOutStoryboard.Begin(); }
internal NepAppUIManagerDialogCoordinator(NepAppUIManager parent, Grid overlayControl, Grid snackBarContainer) { parentUIManager = parent; overlayGridControl = overlayControl; snackManager = new SnackBarManager(snackBarContainer); fadeInAnimation = new FadeInThemeAnimation(); fadeOutAnimation = new FadeOutThemeAnimation(); InitializeOverlayAndOverlayedDialogs(); }
/// <summary> /// Fades the element out using the FadeOutThemeAnimation. /// </summary> /// <remarks> /// Opacity property of the element is not affected.<br/> /// The duration of the visible animation itself is not affected by the duration parameter. It merely indicates how long the Storyboard will run.<br/> /// If FadeOutThemeAnimation was already run before and FadeInThemeAnimation was not run after that - nothing will happen.<br/> /// </remarks> /// <param name="element"></param> /// <param name="duration"></param> /// <returns></returns> public static async Task FadeOut(this UIElement element, TimeSpan? duration = null) { var fadeOutStoryboard = new Storyboard(); var fadeOutAnimation = new FadeOutThemeAnimation(); if (duration != null) { fadeOutAnimation.Duration = duration.Value; } Storyboard.SetTarget(fadeOutAnimation, element); fadeOutStoryboard.Children.Add(fadeOutAnimation); await fadeOutStoryboard.BeginAsync(); }
public Scenario3() { this.InitializeComponent(); ViewChooser.ItemsSource = ((App)App.Current).SecondaryViews; var fadeOut = new FadeOutThemeAnimation(); fadeOutStoryboard.Children.Add(fadeOut); // Normally you can point directly to an object named in your XAML. Since // the sample hosts multiple pages, it's convenient for this scenario to // get the root element Storyboard.SetTarget(fadeOut, (DependencyObject)((FrameworkElement)rootPage.Content).FindName("Splitter")); }
private void AppBarOpened(object sender, object e) { ApplicationViewState currentViewState = ApplicationView.Value; if (currentViewState != ApplicationViewState.Snapped) { if (timelineContainer == null) { try { timelineContainer = (Grid)videoMediaElement.ControlPanel.GetDescendantsOfType <Grid>().ElementAt(2); } catch { } } try { ClipDataGrid.Visibility = Windows.UI.Xaml.Visibility.Collapsed; Storyboard sb = new Storyboard(); RepositionThemeAnimation repositionTimelineAnimation = new RepositionThemeAnimation(); RepositionThemeAnimation repositionBtnAnimation = new RepositionThemeAnimation(); FadeOutThemeAnimation fadeOutAnimation = new FadeOutThemeAnimation(); FadeOutThemeAnimation fadeOutBtn = new FadeOutThemeAnimation(); Storyboard.SetTarget(fadeOutAnimation, ClipDataGrid as DependencyObject); Storyboard.SetTarget(fadeOutBtn, LessBtn as DependencyObject); Storyboard.SetTarget(repositionTimelineAnimation, timelineContainer as DependencyObject); repositionTimelineAnimation.FromVerticalOffset = 204; Storyboard.SetTarget(repositionBtnAnimation, LessBtn as DependencyObject); repositionBtnAnimation.FromVerticalOffset = 204; sb.Children.Add(repositionTimelineAnimation); sb.Children.Add(repositionBtnAnimation); sb.Children.Add(fadeOutAnimation); sb.Children.Add(fadeOutBtn); timelineContainer.Margin = new Thickness(0, 0, 0, 204); sb.Begin(); } catch { } } }
public Dialog() { Height = Window.Current.Bounds.Height; Width = Window.Current.Bounds.Width; Window.Current.SizeChanged += CurrentSizeChanged; Background = new SolidColorBrush((Color)Application.Current.Resources["ContentDialogDimmingColor"]); FadeInThemeAnimation fadeInAnimation = new FadeInThemeAnimation(); Storyboard.SetTarget(fadeInAnimation, this); OpenDialog.Children.Add(fadeInAnimation); FadeOutThemeAnimation fadeOutAnimation = new FadeOutThemeAnimation(); Storyboard.SetTarget(fadeOutAnimation, this); CloseDialog.Children.Add(fadeOutAnimation); }
private static (Grid grid, Storyboard entry, Storyboard exit) GetStoryboards(this Grid grid, NotificationPosition pos = NotificationPosition.BottomCenter) { grid.RenderTransform = new TranslateTransform(); Storyboard entry = new Storyboard(); Storyboard exit = new Storyboard(); double e = 1000; DoubleAnimation d1_entry = new DoubleAnimation { Duration = new Duration(TimeSpan.FromMilliseconds(AnimationDuration)), EasingFunction = new CircleEase() { EasingMode = EasingMode.EaseOut } }.ModifyAnimationBasedOnPosition(AnimationType.Entry, pos); DoubleAnimation d2_exit = new DoubleAnimation { Duration = new Duration(TimeSpan.FromMilliseconds(AnimationDuration * 4)), EasingFunction = new CircleEase() { EasingMode = EasingMode.EaseOut, } }.ModifyAnimationBasedOnPosition(AnimationType.Exit, pos); FadeInThemeAnimation fade_in = new FadeInThemeAnimation { Duration = new Duration(TimeSpan.FromMilliseconds(AnimationDuration)) }; FadeOutThemeAnimation fade_out = new FadeOutThemeAnimation { BeginTime = TimeSpan.FromMilliseconds(e / 2), Duration = new Duration(TimeSpan.FromMilliseconds(e)) }; Storyboard.SetTarget(fade_in, grid); Storyboard.SetTarget(fade_out, grid); Storyboard.SetTarget(d1_entry, grid.RenderTransform); Storyboard.SetTarget(d2_exit, grid.RenderTransform); Storyboard.SetTargetProperty(d1_entry, pos.GetTargetPropFromPosition()); Storyboard.SetTargetProperty(d2_exit, pos.GetTargetPropFromPosition()); entry.Children.Add(d1_entry); entry.Children.Add(fade_in); exit.Children.Add(d2_exit); exit.Children.Add(fade_out); return(grid, entry, exit); }
private void LessBtn_Click(object sender, RoutedEventArgs e) { Storyboard sb = new Storyboard(); FadeOutThemeAnimation fadeOutTimeline = new FadeOutThemeAnimation(); FadeOutThemeAnimation fadeOutClipData = new FadeOutThemeAnimation(); FadeOutThemeAnimation fadeOutVideoControls = new FadeOutThemeAnimation(); Storyboard.SetTarget(fadeOutTimeline, timelineContainer as DependencyObject); Storyboard.SetTarget(fadeOutClipData, ClipDataGrid as DependencyObject); Storyboard.SetTarget(fadeOutVideoControls, VideoControls as DependencyObject); sb.Children.Add(fadeOutTimeline); sb.Children.Add(fadeOutClipData); sb.Children.Add(fadeOutVideoControls); sb.Begin(); LessBtn.Visibility = Visibility.Collapsed; MoreBtn.Visibility = Visibility.Visible; controlsFaded = true; }