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.
This commit is contained in:
Alex Davies 2023-06-23 03:15:30 +01:00
parent e1c63af061
commit bb7023ab25
5 changed files with 49 additions and 6 deletions

View file

@ -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;

View file

@ -157,6 +157,8 @@
<system:String x:Key="SoundEffectTip">Play a small sound when the search window opens</system:String>
<system:String x:Key="Animation">Animation</system:String>
<system:String x:Key="AnimationTip">Use Animation in UI</system:String>
<system:String x:Key="animationLength">Animation Length (ms)</system:String>
<system:String x:Key="animationLengthToolTip">The length of the UI animation in milliseconds</system:String>
<system:String x:Key="Clock">Clock</system:String>
<system:String x:Key="Date">Date</system:String>

View file

@ -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
};

View file

@ -2414,6 +2414,40 @@
</TextBlock>
</ItemsControl>
</Border>
<Border
Margin="0"
BorderThickness="0"
Style="{DynamicResource SettingGroupBox}">
<ItemsControl Style="{StaticResource SettingGrid}">
<StackPanel Style="{StaticResource TextPanel}">
<TextBlock Style="{DynamicResource SettingTitleLabel}" Text="{DynamicResource animationLength}" />
<TextBlock Style="{DynamicResource SettingSubTitleLabel}" Text="{DynamicResource animationLengthToolTip}" />
</StackPanel>
<StackPanel Grid.Column="2" Orientation="Horizontal">
<TextBlock
Width="Auto"
Margin="0,0,8,2"
VerticalAlignment="Center"
Foreground="{DynamicResource Color05B}"
Text="{Binding ElementName=AnimationLengthValue, Path=Value, UpdateSourceTrigger=PropertyChanged}"
TextAlignment="Right" />
<Slider
Name="AnimationLengthValue"
Width="250"
Margin="0,0,18,0"
VerticalAlignment="Center"
IsMoveToPointEnabled="True"
IsSnapToTickEnabled="True"
Maximum="2000"
Minimum="100"
TickFrequency="10"
Value="{Binding AnimationLength, Mode=TwoWay}" />
</StackPanel>
<TextBlock Style="{StaticResource Glyph}">
&#xe916;
</TextBlock>
</ItemsControl>
</Border>
<Separator
Width="Auto"
BorderThickness="1"

View file

@ -598,6 +598,12 @@ namespace Flow.Launcher.ViewModel
set => Settings.UseAnimation = value;
}
public int AnimationLength
{
get => Settings.AnimationLength;
set => Settings.AnimationLength = value;
}
public bool UseSound
{
get => Settings.UseSound;