Skip to content

Commit bb7023a

Browse files
committed
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.
1 parent e1c63af commit bb7023a

File tree

5 files changed

+49
-6
lines changed

5 files changed

+49
-6
lines changed

Flow.Launcher.Infrastructure/UserSettings/Settings.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ public string Theme
5353
public string ResultFontStretch { get; set; }
5454
public bool UseGlyphIcons { get; set; } = true;
5555
public bool UseAnimation { get; set; } = true;
56+
public int AnimationLength { get; set; } = 360;
5657
public bool UseSound { get; set; } = true;
5758
public bool UseClock { get; set; } = true;
5859
public bool UseDate { get; set; } = false;

Flow.Launcher/Languages/en.xaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,8 @@
157157
<system:String x:Key="SoundEffectTip">Play a small sound when the search window opens</system:String>
158158
<system:String x:Key="Animation">Animation</system:String>
159159
<system:String x:Key="AnimationTip">Use Animation in UI</system:String>
160+
<system:String x:Key="animationLength">Animation Length (ms)</system:String>
161+
<system:String x:Key="animationLengthToolTip">The length of the UI animation in milliseconds</system:String>
160162
<system:String x:Key="Clock">Clock</system:String>
161163
<system:String x:Key="Date">Date</system:String>
162164

Flow.Launcher/MainWindow.xaml.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -383,23 +383,23 @@ public void WindowAnimator()
383383
{
384384
From = 0,
385385
To = 1,
386-
Duration = TimeSpan.FromSeconds(0.25),
386+
Duration = TimeSpan.FromMilliseconds(_settings.AnimationLength * 2 / 3),
387387
FillBehavior = FillBehavior.Stop
388388
};
389389

390390
var WindowMotion = new DoubleAnimation
391391
{
392392
From = Top + 10,
393393
To = Top,
394-
Duration = TimeSpan.FromSeconds(0.25),
394+
Duration = TimeSpan.FromMilliseconds(_settings.AnimationLength * 2 / 3),
395395
FillBehavior = FillBehavior.Stop
396396
};
397397
var IconMotion = new DoubleAnimation
398398
{
399399
From = 12,
400400
To = 0,
401401
EasingFunction = easing,
402-
Duration = TimeSpan.FromSeconds(0.36),
402+
Duration = TimeSpan.FromMilliseconds(_settings.AnimationLength),
403403
FillBehavior = FillBehavior.Stop
404404
};
405405

@@ -408,7 +408,7 @@ public void WindowAnimator()
408408
From = 0,
409409
To = 1,
410410
EasingFunction = easing,
411-
Duration = TimeSpan.FromSeconds(0.36),
411+
Duration = TimeSpan.FromMilliseconds(_settings.AnimationLength),
412412
FillBehavior = FillBehavior.Stop
413413
};
414414
double TargetIconOpacity = SearchIcon.Opacity; // Animation Target Opacity from Style
@@ -417,7 +417,7 @@ public void WindowAnimator()
417417
From = 0,
418418
To = TargetIconOpacity,
419419
EasingFunction = easing,
420-
Duration = TimeSpan.FromSeconds(0.36),
420+
Duration = TimeSpan.FromMilliseconds(_settings.AnimationLength),
421421
FillBehavior = FillBehavior.Stop
422422
};
423423

@@ -427,7 +427,7 @@ public void WindowAnimator()
427427
From = new Thickness(0, 12, right, 0),
428428
To = new Thickness(0, 0, right, 0),
429429
EasingFunction = easing,
430-
Duration = TimeSpan.FromSeconds(0.36),
430+
Duration = TimeSpan.FromMilliseconds(_settings.AnimationLength),
431431
FillBehavior = FillBehavior.Stop
432432
};
433433

Flow.Launcher/SettingWindow.xaml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2414,6 +2414,40 @@
24142414
</TextBlock>
24152415
</ItemsControl>
24162416
</Border>
2417+
<Border
2418+
Margin="0"
2419+
BorderThickness="0"
2420+
Style="{DynamicResource SettingGroupBox}">
2421+
<ItemsControl Style="{StaticResource SettingGrid}">
2422+
<StackPanel Style="{StaticResource TextPanel}">
2423+
<TextBlock Style="{DynamicResource SettingTitleLabel}" Text="{DynamicResource animationLength}" />
2424+
<TextBlock Style="{DynamicResource SettingSubTitleLabel}" Text="{DynamicResource animationLengthToolTip}" />
2425+
</StackPanel>
2426+
<StackPanel Grid.Column="2" Orientation="Horizontal">
2427+
<TextBlock
2428+
Width="Auto"
2429+
Margin="0,0,8,2"
2430+
VerticalAlignment="Center"
2431+
Foreground="{DynamicResource Color05B}"
2432+
Text="{Binding ElementName=AnimationLengthValue, Path=Value, UpdateSourceTrigger=PropertyChanged}"
2433+
TextAlignment="Right" />
2434+
<Slider
2435+
Name="AnimationLengthValue"
2436+
Width="250"
2437+
Margin="0,0,18,0"
2438+
VerticalAlignment="Center"
2439+
IsMoveToPointEnabled="True"
2440+
IsSnapToTickEnabled="True"
2441+
Maximum="2000"
2442+
Minimum="100"
2443+
TickFrequency="10"
2444+
Value="{Binding AnimationLength, Mode=TwoWay}" />
2445+
</StackPanel>
2446+
<TextBlock Style="{StaticResource Glyph}">
2447+
&#xe916;
2448+
</TextBlock>
2449+
</ItemsControl>
2450+
</Border>
24172451
<Separator
24182452
Width="Auto"
24192453
BorderThickness="1"

Flow.Launcher/ViewModel/SettingWindowViewModel.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -598,6 +598,12 @@ public bool UseAnimation
598598
set => Settings.UseAnimation = value;
599599
}
600600

601+
public int AnimationLength
602+
{
603+
get => Settings.AnimationLength;
604+
set => Settings.AnimationLength = value;
605+
}
606+
601607
public bool UseSound
602608
{
603609
get => Settings.UseSound;

0 commit comments

Comments
 (0)