24
24
using ModernWpf . Controls ;
25
25
using Key = System . Windows . Input . Key ;
26
26
using System . Media ;
27
+ using static Flow . Launcher . ViewModel . SettingWindowViewModel ;
27
28
28
29
namespace Flow . Launcher
29
30
{
@@ -379,27 +380,35 @@ public void WindowAnimator()
379
380
CircleEase easing = new CircleEase ( ) ;
380
381
easing . EasingMode = EasingMode . EaseInOut ;
381
382
383
+ var animationLength = _settings . AnimationSpeed switch
384
+ {
385
+ AnimationSpeeds . Slow => 560 ,
386
+ AnimationSpeeds . Medium => 360 ,
387
+ AnimationSpeeds . Fast => 160 ,
388
+ _ => _settings . CustomAnimationLength
389
+ } ;
390
+
382
391
var WindowOpacity = new DoubleAnimation
383
392
{
384
393
From = 0 ,
385
394
To = 1 ,
386
- Duration = TimeSpan . FromSeconds ( 0.25 ) ,
395
+ Duration = TimeSpan . FromMilliseconds ( animationLength * 2 / 3 ) ,
387
396
FillBehavior = FillBehavior . Stop
388
397
} ;
389
398
390
399
var WindowMotion = new DoubleAnimation
391
400
{
392
401
From = Top + 10 ,
393
402
To = Top ,
394
- Duration = TimeSpan . FromSeconds ( 0.25 ) ,
403
+ Duration = TimeSpan . FromMilliseconds ( animationLength * 2 / 3 ) ,
395
404
FillBehavior = FillBehavior . Stop
396
405
} ;
397
406
var IconMotion = new DoubleAnimation
398
407
{
399
408
From = 12 ,
400
409
To = 0 ,
401
410
EasingFunction = easing ,
402
- Duration = TimeSpan . FromSeconds ( 0.36 ) ,
411
+ Duration = TimeSpan . FromMilliseconds ( animationLength ) ,
403
412
FillBehavior = FillBehavior . Stop
404
413
} ;
405
414
@@ -408,7 +417,7 @@ public void WindowAnimator()
408
417
From = 0 ,
409
418
To = 1 ,
410
419
EasingFunction = easing ,
411
- Duration = TimeSpan . FromSeconds ( 0.36 ) ,
420
+ Duration = TimeSpan . FromMilliseconds ( animationLength ) ,
412
421
FillBehavior = FillBehavior . Stop
413
422
} ;
414
423
double TargetIconOpacity = SearchIcon . Opacity ; // Animation Target Opacity from Style
@@ -417,7 +426,7 @@ public void WindowAnimator()
417
426
From = 0 ,
418
427
To = TargetIconOpacity ,
419
428
EasingFunction = easing ,
420
- Duration = TimeSpan . FromSeconds ( 0.36 ) ,
429
+ Duration = TimeSpan . FromMilliseconds ( animationLength ) ,
421
430
FillBehavior = FillBehavior . Stop
422
431
} ;
423
432
@@ -427,7 +436,7 @@ public void WindowAnimator()
427
436
From = new Thickness ( 0 , 12 , right , 0 ) ,
428
437
To = new Thickness ( 0 , 0 , right , 0 ) ,
429
438
EasingFunction = easing ,
430
- Duration = TimeSpan . FromSeconds ( 0.36 ) ,
439
+ Duration = TimeSpan . FromMilliseconds ( animationLength ) ,
431
440
FillBehavior = FillBehavior . Stop
432
441
} ;
433
442
0 commit comments