diff --git a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs index 43a68a2a627..ca167431564 100644 --- a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs +++ b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs @@ -254,6 +254,10 @@ public bool HideNotifyIcon [JsonConverter(typeof(JsonStringEnumConverter))] public LastQueryMode LastQueryMode { get; set; } = LastQueryMode.Selected; + [JsonConverter(typeof(JsonStringEnumConverter))] + public AnimationSpeeds AnimationSpeed { get; set; } = AnimationSpeeds.Medium; + public int CustomAnimationLength { get; set; } = 360; + // This needs to be loaded last by staying at the bottom public PluginsSettings PluginSettings { get; set; } = new PluginsSettings(); @@ -290,4 +294,12 @@ public enum SearchWindowAligns RightTop, Custom } + + public enum AnimationSpeeds + { + Slow, + Medium, + Fast, + Custom + } } diff --git a/Flow.Launcher/Languages/en.xaml b/Flow.Launcher/Languages/en.xaml index 30c1173780c..bee595772c8 100644 --- a/Flow.Launcher/Languages/en.xaml +++ b/Flow.Launcher/Languages/en.xaml @@ -157,6 +157,12 @@ Play a small sound when the search window opens Animation Use Animation in UI + Animation Speed + The speed of the UI animation + Slow + Medium + Fast + Custom Clock Date diff --git a/Flow.Launcher/MainWindow.xaml.cs b/Flow.Launcher/MainWindow.xaml.cs index 4adfccff482..3a914d4888f 100644 --- a/Flow.Launcher/MainWindow.xaml.cs +++ b/Flow.Launcher/MainWindow.xaml.cs @@ -24,6 +24,7 @@ using ModernWpf.Controls; using Key = System.Windows.Input.Key; using System.Media; +using static Flow.Launcher.ViewModel.SettingWindowViewModel; namespace Flow.Launcher { @@ -379,11 +380,19 @@ public void WindowAnimator() CircleEase easing = new CircleEase(); easing.EasingMode = EasingMode.EaseInOut; + var animationLength = _settings.AnimationSpeed switch + { + AnimationSpeeds.Slow => 560, + AnimationSpeeds.Medium => 360, + AnimationSpeeds.Fast => 160, + _ => _settings.CustomAnimationLength + }; + var WindowOpacity = new DoubleAnimation { From = 0, To = 1, - Duration = TimeSpan.FromSeconds(0.25), + Duration = TimeSpan.FromMilliseconds(animationLength * 2 / 3), FillBehavior = FillBehavior.Stop }; @@ -391,7 +400,7 @@ public void WindowAnimator() { From = Top + 10, To = Top, - Duration = TimeSpan.FromSeconds(0.25), + Duration = TimeSpan.FromMilliseconds(animationLength * 2 / 3), FillBehavior = FillBehavior.Stop }; var IconMotion = new DoubleAnimation @@ -399,7 +408,7 @@ public void WindowAnimator() From = 12, To = 0, EasingFunction = easing, - Duration = TimeSpan.FromSeconds(0.36), + Duration = TimeSpan.FromMilliseconds(animationLength), FillBehavior = FillBehavior.Stop }; @@ -408,7 +417,7 @@ public void WindowAnimator() From = 0, To = 1, EasingFunction = easing, - Duration = TimeSpan.FromSeconds(0.36), + Duration = TimeSpan.FromMilliseconds(animationLength), FillBehavior = FillBehavior.Stop }; double TargetIconOpacity = SearchIcon.Opacity; // Animation Target Opacity from Style @@ -417,7 +426,7 @@ public void WindowAnimator() From = 0, To = TargetIconOpacity, EasingFunction = easing, - Duration = TimeSpan.FromSeconds(0.36), + Duration = TimeSpan.FromMilliseconds(animationLength), FillBehavior = FillBehavior.Stop }; @@ -427,7 +436,7 @@ public void WindowAnimator() From = new Thickness(0, 12, right, 0), To = new Thickness(0, 0, right, 0), EasingFunction = easing, - Duration = TimeSpan.FromSeconds(0.36), + Duration = TimeSpan.FromMilliseconds(animationLength), FillBehavior = FillBehavior.Stop }; diff --git a/Flow.Launcher/SettingWindow.xaml b/Flow.Launcher/SettingWindow.xaml index 665d16b8f8e..1e886c022b2 100644 --- a/Flow.Launcher/SettingWindow.xaml +++ b/Flow.Launcher/SettingWindow.xaml @@ -2403,6 +2403,7 @@ - + + + + + - - + + - + + + + + + + + + + +  + + + + + + + + + + + + + + - +  - - - - + + diff --git a/Flow.Launcher/ViewModel/SettingWindowViewModel.cs b/Flow.Launcher/ViewModel/SettingWindowViewModel.cs index 47a5cd67235..231e65539ef 100644 --- a/Flow.Launcher/ViewModel/SettingWindowViewModel.cs +++ b/Flow.Launcher/ViewModel/SettingWindowViewModel.cs @@ -598,6 +598,33 @@ public bool UseAnimation set => Settings.UseAnimation = value; } + public class AnimationSpeed + { + public string Display { get; set; } + public AnimationSpeeds Value { get; set; } + } + + public List AnimationSpeeds + { + get + { + List speeds = new List(); + var enums = (AnimationSpeeds[])Enum.GetValues(typeof(AnimationSpeeds)); + foreach (var e in enums) + { + var key = $"AnimationSpeed{e}"; + var display = _translater.GetTranslation(key); + var m = new AnimationSpeed + { + Display = display, + Value = e, + }; + speeds.Add(m); + } + return speeds; + } + } + public bool UseSound { get => Settings.UseSound;