2424using ModernWpf . Controls ;
2525using Key = System . Windows . Input . Key ;
2626using System . Media ;
27+ using static Flow . Launcher . ViewModel . SettingWindowViewModel ;
2728
2829namespace Flow . Launcher
2930{
@@ -379,27 +380,35 @@ public void WindowAnimator()
379380 CircleEase easing = new CircleEase ( ) ;
380381 easing . EasingMode = EasingMode . EaseInOut ;
381382
383+ var animationLength = _settings . AnimationSpeed switch
384+ {
385+ AnimationSpeeds . Slow => 560 ,
386+ AnimationSpeeds . Medium => 360 ,
387+ AnimationSpeeds . Fast => 160 ,
388+ _ => _settings . CustomAnimationLength
389+ } ;
390+
382391 var WindowOpacity = new DoubleAnimation
383392 {
384393 From = 0 ,
385394 To = 1 ,
386- Duration = TimeSpan . FromSeconds ( 0.25 ) ,
395+ Duration = TimeSpan . FromMilliseconds ( animationLength * 2 / 3 ) ,
387396 FillBehavior = FillBehavior . Stop
388397 } ;
389398
390399 var WindowMotion = new DoubleAnimation
391400 {
392401 From = Top + 10 ,
393402 To = Top ,
394- Duration = TimeSpan . FromSeconds ( 0.25 ) ,
403+ Duration = TimeSpan . FromMilliseconds ( animationLength * 2 / 3 ) ,
395404 FillBehavior = FillBehavior . Stop
396405 } ;
397406 var IconMotion = new DoubleAnimation
398407 {
399408 From = 12 ,
400409 To = 0 ,
401410 EasingFunction = easing ,
402- Duration = TimeSpan . FromSeconds ( 0.36 ) ,
411+ Duration = TimeSpan . FromMilliseconds ( animationLength ) ,
403412 FillBehavior = FillBehavior . Stop
404413 } ;
405414
@@ -408,7 +417,7 @@ public void WindowAnimator()
408417 From = 0 ,
409418 To = 1 ,
410419 EasingFunction = easing ,
411- Duration = TimeSpan . FromSeconds ( 0.36 ) ,
420+ Duration = TimeSpan . FromMilliseconds ( animationLength ) ,
412421 FillBehavior = FillBehavior . Stop
413422 } ;
414423 double TargetIconOpacity = SearchIcon . Opacity ; // Animation Target Opacity from Style
@@ -417,7 +426,7 @@ public void WindowAnimator()
417426 From = 0 ,
418427 To = TargetIconOpacity ,
419428 EasingFunction = easing ,
420- Duration = TimeSpan . FromSeconds ( 0.36 ) ,
429+ Duration = TimeSpan . FromMilliseconds ( animationLength ) ,
421430 FillBehavior = FillBehavior . Stop
422431 } ;
423432
@@ -427,7 +436,7 @@ public void WindowAnimator()
427436 From = new Thickness ( 0 , 12 , right , 0 ) ,
428437 To = new Thickness ( 0 , 0 , right , 0 ) ,
429438 EasingFunction = easing ,
430- Duration = TimeSpan . FromSeconds ( 0.36 ) ,
439+ Duration = TimeSpan . FromMilliseconds ( animationLength ) ,
431440 FillBehavior = FillBehavior . Stop
432441 } ;
433442
0 commit comments