From bb7023ab25d7c8161a3093452c363f41b9f19e72 Mon Sep 17 00:00:00 2001 From: Alex Davies Date: Fri, 23 Jun 2023 03:15:30 +0100 Subject: [PATCH] Added Animation Length slider Added a slider in Appearance to adjust the length of the open animation for the launcher. By default the animation should be the same as it was previously (the first part of the animation is about 10ms shorter so that the ratio is simpler - 2/3 instead of 25/36) Currently only has language support for English and the length is adjustable from 100ms to 2000ms in steps of 10. --- .../UserSettings/Settings.cs | 1 + Flow.Launcher/Languages/en.xaml | 2 ++ Flow.Launcher/MainWindow.xaml.cs | 12 +++---- Flow.Launcher/SettingWindow.xaml | 34 +++++++++++++++++++ .../ViewModel/SettingWindowViewModel.cs | 6 ++++ 5 files changed, 49 insertions(+), 6 deletions(-) diff --git a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs index 43a68a2a6..10a1e46d1 100644 --- a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs +++ b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs @@ -53,6 +53,7 @@ namespace Flow.Launcher.Infrastructure.UserSettings public string ResultFontStretch { get; set; } public bool UseGlyphIcons { get; set; } = true; public bool UseAnimation { get; set; } = true; + public int AnimationLength { get; set; } = 360; public bool UseSound { get; set; } = true; public bool UseClock { get; set; } = true; public bool UseDate { get; set; } = false; diff --git a/Flow.Launcher/Languages/en.xaml b/Flow.Launcher/Languages/en.xaml index 30c117378..e69d9dcd8 100644 --- a/Flow.Launcher/Languages/en.xaml +++ b/Flow.Launcher/Languages/en.xaml @@ -157,6 +157,8 @@ Play a small sound when the search window opens Animation Use Animation in UI + Animation Length (ms) + The length of the UI animation in milliseconds Clock Date diff --git a/Flow.Launcher/MainWindow.xaml.cs b/Flow.Launcher/MainWindow.xaml.cs index 4adfccff4..e080c55b3 100644 --- a/Flow.Launcher/MainWindow.xaml.cs +++ b/Flow.Launcher/MainWindow.xaml.cs @@ -383,7 +383,7 @@ namespace Flow.Launcher { From = 0, To = 1, - Duration = TimeSpan.FromSeconds(0.25), + Duration = TimeSpan.FromMilliseconds(_settings.AnimationLength * 2 / 3), FillBehavior = FillBehavior.Stop }; @@ -391,7 +391,7 @@ namespace Flow.Launcher { From = Top + 10, To = Top, - Duration = TimeSpan.FromSeconds(0.25), + Duration = TimeSpan.FromMilliseconds(_settings.AnimationLength * 2 / 3), FillBehavior = FillBehavior.Stop }; var IconMotion = new DoubleAnimation @@ -399,7 +399,7 @@ namespace Flow.Launcher From = 12, To = 0, EasingFunction = easing, - Duration = TimeSpan.FromSeconds(0.36), + Duration = TimeSpan.FromMilliseconds(_settings.AnimationLength), FillBehavior = FillBehavior.Stop }; @@ -408,7 +408,7 @@ namespace Flow.Launcher From = 0, To = 1, EasingFunction = easing, - Duration = TimeSpan.FromSeconds(0.36), + Duration = TimeSpan.FromMilliseconds(_settings.AnimationLength), FillBehavior = FillBehavior.Stop }; double TargetIconOpacity = SearchIcon.Opacity; // Animation Target Opacity from Style @@ -417,7 +417,7 @@ namespace Flow.Launcher From = 0, To = TargetIconOpacity, EasingFunction = easing, - Duration = TimeSpan.FromSeconds(0.36), + Duration = TimeSpan.FromMilliseconds(_settings.AnimationLength), FillBehavior = FillBehavior.Stop }; @@ -427,7 +427,7 @@ namespace Flow.Launcher From = new Thickness(0, 12, right, 0), To = new Thickness(0, 0, right, 0), EasingFunction = easing, - Duration = TimeSpan.FromSeconds(0.36), + Duration = TimeSpan.FromMilliseconds(_settings.AnimationLength), FillBehavior = FillBehavior.Stop }; diff --git a/Flow.Launcher/SettingWindow.xaml b/Flow.Launcher/SettingWindow.xaml index 665d16b8f..ce0b55de7 100644 --- a/Flow.Launcher/SettingWindow.xaml +++ b/Flow.Launcher/SettingWindow.xaml @@ -2414,6 +2414,40 @@ + + + + + + + + + + + +  + + + Settings.UseAnimation = value; } + public int AnimationLength + { + get => Settings.AnimationLength; + set => Settings.AnimationLength = value; + } + public bool UseSound { get => Settings.UseSound;