internal static void ButtonMouseOverAnim(Brush brush, bool transparent = false, bool alpha = false) { if (transparent) { AnimationHelper.MouseOverColorEvent(0, 0, 0, 0, brush, alpha); } else { AnimationHelper.MouseOverColorEvent( mainColor.A, mainColor.R, mainColor.G, mainColor.B, brush, alpha ); } }
internal static void AltInterfaceMouseLeave(Brush foreground, Brush background, Brush border) { ccAnim.From = AnimationHelper.GetPrefferedColorOver(); ccAnim.To = (Color)Application.Current.Resources["IconColor"]; foreground.BeginAnimation(SolidColorBrush.ColorProperty, ccAnim); ccAnim2.From = (Color)Application.Current.Resources["AltInterfaceW"]; ccAnim2.To = (Color)Application.Current.Resources["AltInterface"]; background.BeginAnimation(SolidColorBrush.ColorProperty, ccAnim2); AnimationHelper.MouseLeaveColorEvent( borderBrush.Color.A, borderBrush.Color.R, borderBrush.Color.G, borderBrush.Color.B, border, true); }
/// <summary> /// Hides/shows interface elements with a fade animation /// </summary> /// <param name="show"></param> internal static async void FadeControlsAsync(bool show, double time = .5) { if (Properties.Settings.Default.ShowInterface && !Properties.Settings.Default.Fullscreen || GetClickArrowRight == null || GetClickArrowLeft == null || Getx2 == null || GetGalleryShortcut == null || Scroll.IsAutoScrolling || Properties.Settings.Default.FullscreenGallery == false && GalleryFunctions.IsOpen) { return; } if (GetCropppingTool != null) { if (GetCropppingTool.IsVisible) { return; } } await ConfigureWindows.GetMainWindow.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Background, (Action)(() => { if (!Properties.Settings.Default.ShowAltInterfaceButtons) { HideInterfaceLogic.ShowNavigation(false); HideInterfaceLogic.ShowShortcuts(false); return; } else if (!GetClickArrowLeft.IsVisible) { HideInterfaceLogic.ShowNavigation(true); HideInterfaceLogic.ShowShortcuts(true); } if (Properties.Settings.Default.ScrollEnabled && ConfigureWindows.GetMainWindow.Scroller.ScrollableHeight > 0) { ScrollbarFade(show); } // Don't run, if already being animated || prevent lag if (Getx2.Opacity > 0 && Getx2.Opacity < 1) { return; } TimeSpan timespan = TimeSpan.FromSeconds(time); if (!show) { AnimationHelper.Fade(GetClickArrowLeft, 0, timespan); AnimationHelper.Fade(GetClickArrowRight, 0, timespan); AnimationHelper.Fade(GetGalleryShortcut, 0, timespan); AnimationHelper.Fade(Getx2, 0, timespan); AnimationHelper.Fade(GetMinus, 0, timespan); AnimationHelper.Fade(GetRestorebutton, 0, timespan); return; } else if (Scroll.IsAutoScrolling) { GetClickArrowLeft.Opacity = GetClickArrowRight.Opacity = GetGalleryShortcut.Opacity = Getx2.Opacity = GetMinus.Opacity = 0; return; } AnimationHelper.Fade(GetClickArrowLeft, 1, timespan); AnimationHelper.Fade(GetClickArrowRight, 1, timespan); AnimationHelper.Fade(GetGalleryShortcut, 1, timespan); AnimationHelper.Fade(Getx2, 1, timespan); AnimationHelper.Fade(GetMinus, 1, timespan); AnimationHelper.Fade(GetRestorebutton, 1, timespan); })); }
internal static void PreviewMouseButtonDownAnim(Brush brush, bool alpha = false) { AnimationHelper.PreviewMouseLeftButtonDownColorEvent(brush, alpha); }
/// <summary> /// Hides/shows interface elements with a fade animation /// </summary> /// <param name="show"></param> internal static async void FadeControlsAsync(bool show, double time = .5) { if (Properties.Settings.Default.ShowInterface || Properties.Settings.Default.Fullscreen || GetClickArrowRight == null || GetClickArrowLeft == null || Getx2 == null || GetGalleryShortcut == null || Scroll.IsAutoScrolling) { return; } if (GetCropppingTool != null) { if (GetCropppingTool.IsVisible) { return; } } await LoadWindows.GetMainWindow.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Input, (Action)(() => { if (Properties.Settings.Default.ScrollEnabled && LoadWindows.GetMainWindow.Scroller.ScrollableHeight > 0) { ScrollbarFade(show); } // Don't run, if already being animated || prevent lag if (Getx2.Opacity > 0 && Getx2.Opacity < 1) { return; } if (GetClickArrowRight.IsMouseOver || GetClickArrowLeft.IsMouseOver || GetMinus.IsMouseOver || GetRestorebutton.IsMouseOver || Getx2.IsMouseOver) { return; } TimeSpan timespan = TimeSpan.FromSeconds(time); if (!show) { AnimationHelper.Fade(GetClickArrowLeft, 0, timespan); AnimationHelper.Fade(GetClickArrowRight, 0, timespan); AnimationHelper.Fade(GetGalleryShortcut, 0, timespan); AnimationHelper.Fade(Getx2, 0, timespan); AnimationHelper.Fade(GetMinus, 0, timespan); AnimationHelper.Fade(GetRestorebutton, 0, timespan); return; } else if (Scroll.IsAutoScrolling) { GetClickArrowLeft.Opacity = GetClickArrowRight.Opacity = GetGalleryShortcut.Opacity = Getx2.Opacity = GetMinus.Opacity = 0; return; } AnimationHelper.Fade(GetClickArrowLeft, 1, timespan); AnimationHelper.Fade(GetClickArrowRight, 1, timespan); AnimationHelper.Fade(GetGalleryShortcut, 1, timespan); AnimationHelper.Fade(Getx2, 1, timespan); AnimationHelper.Fade(GetMinus, 1, timespan); AnimationHelper.Fade(GetRestorebutton, 1, timespan); })); }