diff --git a/BetterLyrics.WinUI3/BetterLyrics.WinUI3 (Package)/Package.appxmanifest b/BetterLyrics.WinUI3/BetterLyrics.WinUI3 (Package)/Package.appxmanifest index 72131ee..4a7565a 100644 --- a/BetterLyrics.WinUI3/BetterLyrics.WinUI3 (Package)/Package.appxmanifest +++ b/BetterLyrics.WinUI3/BetterLyrics.WinUI3 (Package)/Package.appxmanifest @@ -12,7 +12,7 @@ + Version="1.1.195.0" /> diff --git a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Controls/DemoWindowGrid.xaml b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Controls/DemoWindowGrid.xaml index c1b3247..f448623 100644 --- a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Controls/DemoWindowGrid.xaml +++ b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Controls/DemoWindowGrid.xaml @@ -7,6 +7,8 @@ xmlns:interactivity="using:Microsoft.Xaml.Interactivity" xmlns:local="using:BetterLyrics.WinUI3.Controls" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + xmlns:media="using:CommunityToolkit.WinUI.Media" + xmlns:ui="using:CommunityToolkit.WinUI" mc:Ignorable="d"> + + + + + + + + + + + + + + + + + + + + + + + diff --git a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Controls/DemoWindowGrid.xaml.cs b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Controls/DemoWindowGrid.xaml.cs index 1eb5f99..4915fbe 100644 --- a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Controls/DemoWindowGrid.xaml.cs +++ b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Controls/DemoWindowGrid.xaml.cs @@ -1,6 +1,12 @@ +using BetterLyrics.WinUI3.Hooks; using BetterLyrics.WinUI3.Models; +using BetterLyrics.WinUI3.Services.SettingsService; +using BetterLyrics.WinUI3.Views; +using CommunityToolkit.Mvvm.DependencyInjection; using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Controls; +using System.Linq; +using static Vanara.PInvoke.User32.RAWINPUT; // To learn more about WinUI, the WinUI project structure, // and more about our project templates, see: http://aka.ms/winui-project-info. @@ -9,6 +15,8 @@ namespace BetterLyrics.WinUI3.Controls; public sealed partial class DemoWindowGrid : UserControl { + private readonly ISettingsService _settingsService = Ioc.Default.GetRequiredService(); + public DemoWindowGrid() { InitializeComponent(); @@ -22,4 +30,32 @@ public sealed partial class DemoWindowGrid : UserControl get => (LyricsWindowStatus)GetValue(LyricsWindowStatusProperty); set => SetValue(LyricsWindowStatusProperty, value); } + + private void CloseButton_Click(object sender, RoutedEventArgs e) + { + var data = (LyricsWindowStatus)(((FrameworkElement)sender).DataContext); + var window = WindowHook.GetWindows().FirstOrDefault(x => x.LyricsWindowStatus == data); + window?.CloseWindow(); + } + + private void OpenButton_Click(object sender, RoutedEventArgs e) + { + var status = (LyricsWindowStatus)(((FrameworkElement)sender).DataContext); + // 多开模式 + if (_settingsService.AppSettings.GeneralSettings.MultiNowPlayingWindowMode) + { + WindowHook.OpenOrShowWindow(status); + } + // 单例模式 + else + { + var openedWindows = WindowHook.GetWindows(); + foreach (var item in openedWindows.Where(x => x.LyricsWindowStatus != status)) + { + item.CloseWindow(); + } + WindowHook.OpenOrShowWindow(status); + } + } + } diff --git a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Controls/LyricsCanvas.xaml.cs b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Controls/LyricsCanvas.xaml.cs index cce47dc..9486a04 100644 --- a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Controls/LyricsCanvas.xaml.cs +++ b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Controls/LyricsCanvas.xaml.cs @@ -857,6 +857,14 @@ namespace BetterLyrics.WinUI3.Controls { _isLayoutChanged = true; } + else if (message.PropertyName == nameof(LyricsEffectSettings.IsLyricsFadeOutEffectEnabled)) + { + _isLayoutChanged = true; + } + else if (message.PropertyName == nameof(LyricsEffectSettings.IsLyricsOutOfSightEffectEnabled)) + { + _isLayoutChanged = true; + } } else if (message.Sender == LyricsWindowStatus?.LyricsStyleSettings) { diff --git a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Controls/LyricsEffectSettingsControl.xaml b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Controls/LyricsEffectSettingsControl.xaml index 556cb44..934af03 100644 --- a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Controls/LyricsEffectSettingsControl.xaml +++ b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Controls/LyricsEffectSettingsControl.xaml @@ -28,6 +28,16 @@ + + + + + + + + + + diff --git a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Controls/LyricsWindowSettingsControl.xaml b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Controls/LyricsWindowSettingsControl.xaml index a242fc8..03d5063 100644 --- a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Controls/LyricsWindowSettingsControl.xaml +++ b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Controls/LyricsWindowSettingsControl.xaml @@ -100,10 +100,7 @@ BorderThickness="4" CornerRadius="4" Visibility="{Binding IsOpened, Mode=OneWay, Converter={StaticResource BoolToVisibilityConverter}}" /> - + - - diff --git a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Controls/LyricsWindowSettingsControl.xaml.cs b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Controls/LyricsWindowSettingsControl.xaml.cs index 53b8efb..dd6e0fd 100644 --- a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Controls/LyricsWindowSettingsControl.xaml.cs +++ b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Controls/LyricsWindowSettingsControl.xaml.cs @@ -167,38 +167,6 @@ namespace BetterLyrics.WinUI3.Controls ViewModel.OpenConfigPanel(); } - private void DemoWindowGrid_Tapped(object sender, TappedRoutedEventArgs e) - { - var status = (LyricsWindowStatus)(((FrameworkElement)sender).DataContext); - // 多开模式 - if (_settingsService.AppSettings.GeneralSettings.MultiNowPlayingWindowMode) - { - WindowHook.OpenOrShowWindow(status); - } - // 单例模式 - else - { - var openedWindows = WindowHook.GetWindows(); - foreach (var item in openedWindows.Where(x => x.LyricsWindowStatus != status)) - { - item.CloseWindow(); - } - WindowHook.OpenOrShowWindow(status); - } - } - - private void CloseStatusButton_Click(object sender, RoutedEventArgs e) - { - if (sender is FrameworkElement element) - { - if (element.DataContext is LyricsWindowStatus data) - { - var window = WindowHook.GetWindows().FirstOrDefault(x => x.LyricsWindowStatus == data); - window?.CloseWindow(); - } - } - } - private void ConfigSegmented_SelectionChanged(object sender, SelectionChangedEventArgs e) { ViewModel.SelectorBarSelectedItemTag = (string)((SegmentedItem)((Segmented)sender).SelectedItem).Tag; diff --git a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Controls/LyricsWindowSwitchControl.xaml.cs b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Controls/LyricsWindowSwitchControl.xaml.cs index 5af0730..dd21bea 100644 --- a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Controls/LyricsWindowSwitchControl.xaml.cs +++ b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Controls/LyricsWindowSwitchControl.xaml.cs @@ -29,22 +29,6 @@ namespace BetterLyrics.WinUI3.Controls private async void Grid_Tapped(object sender, TappedRoutedEventArgs e) { - var status = (LyricsWindowStatus)(((FrameworkElement)sender).DataContext); - // 多开模式 - if (_settingsService.AppSettings.GeneralSettings.MultiNowPlayingWindowMode) - { - WindowHook.OpenOrShowWindow(status); - } - // 单例模式 - else - { - var openedWindows = WindowHook.GetWindows(); - foreach (var item in openedWindows.Where(x => x.LyricsWindowStatus != status)) - { - item.CloseWindow(); - } - WindowHook.OpenOrShowWindow(status); - } await HideAsync(); } diff --git a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Logic/LyricsAnimator.cs b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Logic/LyricsAnimator.cs index f1d6f89..4b69e4a 100644 --- a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Logic/LyricsAnimator.cs +++ b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Logic/LyricsAnimator.cs @@ -92,27 +92,30 @@ namespace BetterLyrics.WinUI3.Logic line.ScaleTransition.SetDuration(yScrollDuration); line.ScaleTransition.SetDelay(yScrollDelay); - line.ScaleTransition.StartTransition(_highlightedScale - distanceFactor * (_highlightedScale - _defaultScale)); + line.ScaleTransition.StartTransition( + lyricsEffect.IsLyricsOutOfSightEffectEnabled ? + (_highlightedScale - distanceFactor * (_highlightedScale - _defaultScale)) : + _highlightedScale); line.PhoneticOpacityTransition.SetDuration(yScrollDuration); line.PhoneticOpacityTransition.SetDelay(yScrollDelay); line.PhoneticOpacityTransition.StartTransition( - absLineCountDelta == 0 ? phoneticOpacity : (isMouseScrolling ? phoneticOpacity : (1 - distanceFactor) * phoneticOpacity)); + CalculateTargetOpacity(phoneticOpacity, phoneticOpacity, distanceFactor, isMouseScrolling, lyricsEffect)); line.PlayedOriginalOpacityTransition.SetDuration(yScrollDuration); line.PlayedOriginalOpacityTransition.SetDelay(yScrollDelay); line.PlayedOriginalOpacityTransition.StartTransition( - absLineCountDelta == 0 ? 1 : (isMouseScrolling ? 1.0 : (1 - distanceFactor) * originalOpacity)); + CalculateTargetOpacity(originalOpacity, 1.0, distanceFactor, isMouseScrolling, lyricsEffect)); line.UnplayedOriginalOpacityTransition.SetDuration(yScrollDuration); line.UnplayedOriginalOpacityTransition.SetDelay(yScrollDelay); line.UnplayedOriginalOpacityTransition.StartTransition( - absLineCountDelta == 0 ? originalOpacity : (isMouseScrolling ? originalOpacity : (1 - distanceFactor) * originalOpacity)); + CalculateTargetOpacity(originalOpacity, originalOpacity, distanceFactor, isMouseScrolling, lyricsEffect)); line.TranslatedOpacityTransition.SetDuration(yScrollDuration); line.TranslatedOpacityTransition.SetDelay(yScrollDelay); line.TranslatedOpacityTransition.StartTransition( - absLineCountDelta == 0 ? translatedOpacity : (isMouseScrolling ? translatedOpacity : (1 - distanceFactor) * translatedOpacity)); + CalculateTargetOpacity(translatedOpacity, translatedOpacity, distanceFactor, isMouseScrolling, lyricsEffect)); line.ColorTransition.SetDuration(yScrollDuration); line.ColorTransition.SetDelay(yScrollDelay); @@ -143,5 +146,33 @@ namespace BetterLyrics.WinUI3.Logic line.ColorTransition.Update(elapsedTime); } } + + private static double CalculateTargetOpacity(double baseOpacity, double baseOpacityWhenZeroDistanceFactor, double distanceFactor, bool isMouseScrolling, LyricsEffectSettings lyricsEffect) + { + double targetOpacity; + if (distanceFactor == 0) + { + targetOpacity = baseOpacityWhenZeroDistanceFactor; + } + else + { + if (isMouseScrolling) + { + targetOpacity = baseOpacity; + } + else + { + if (lyricsEffect.IsLyricsFadeOutEffectEnabled) + { + targetOpacity = (1 - distanceFactor) * baseOpacity; + } + else + { + targetOpacity = baseOpacity; + } + } + } + return targetOpacity; + } } } diff --git a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Models/Settings/LyricsEffectSettings.cs b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Models/Settings/LyricsEffectSettings.cs index e4cd948..fbaceee 100644 --- a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Models/Settings/LyricsEffectSettings.cs +++ b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Models/Settings/LyricsEffectSettings.cs @@ -7,6 +7,8 @@ namespace BetterLyrics.WinUI3.Models.Settings public partial class LyricsEffectSettings : ObservableRecipient, ICloneable { [ObservableProperty][NotifyPropertyChangedRecipients] public partial bool IsLyricsBlurEffectEnabled { get; set; } = true; + [ObservableProperty][NotifyPropertyChangedRecipients] public partial bool IsLyricsFadeOutEffectEnabled { get; set; } = true; + [ObservableProperty][NotifyPropertyChangedRecipients] public partial bool IsLyricsOutOfSightEffectEnabled { get; set; } = true; [ObservableProperty][NotifyPropertyChangedRecipients] public partial bool IsLyricsGlowEffectEnabled { get; set; } = true; [ObservableProperty][NotifyPropertyChangedRecipients] public partial LyricsEffectScope LyricsGlowEffectScope { get; set; } = LyricsEffectScope.LongDurationSyllable; @@ -52,6 +54,8 @@ namespace BetterLyrics.WinUI3.Models.Settings return new LyricsEffectSettings(this.LyricsScrollTopDuration, this.LyricsScrollDuration, this.LyricsScrollBottomDuration, this.LyricsScrollEasingType) { IsLyricsBlurEffectEnabled = this.IsLyricsBlurEffectEnabled, + IsLyricsFadeOutEffectEnabled = this.IsLyricsFadeOutEffectEnabled, + IsLyricsOutOfSightEffectEnabled = this.IsLyricsOutOfSightEffectEnabled, IsLyricsGlowEffectEnabled = this.IsLyricsGlowEffectEnabled, LyricsGlowEffectLongSyllableDuration = this.LyricsGlowEffectLongSyllableDuration, diff --git a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Strings/en-US/Resources.resw b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Strings/en-US/Resources.resw index 140633c..76f179e 100644 --- a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Strings/en-US/Resources.resw +++ b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Strings/en-US/Resources.resw @@ -1092,6 +1092,12 @@ Extra Light + + Enable fade effect for non-current rows + + + Fadeout effect + Current Play Row @@ -1161,6 +1167,12 @@ Font opacity + + Gradually move non-current rows out of view + + + Stay out of sight + Lyrics area height factor diff --git a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Strings/ja-JP/Resources.resw b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Strings/ja-JP/Resources.resw index 25a8c55..ba009fb 100644 --- a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Strings/ja-JP/Resources.resw +++ b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Strings/ja-JP/Resources.resw @@ -1092,6 +1092,12 @@ 浣欏垎銇厜 + + 闈炵従鍦ㄣ伄琛屻伀銉曘偋銉笺儔鍔规灉銈掓湁鍔广伀銇椼伨銇 + + + 銉曘偋銉笺儔鍔规灉 + 鐝惧湪銇儣銉偆琛 @@ -1161,6 +1167,12 @@ 銉曘偐銉炽儓銇笉閫忔槑搴 + + 鐝惧湪銇с伅銇亜琛屻倰寰愩呫伀澶栥伀绉诲嫊銇椼仸銇忋仩銇曘亜 + + + 鐩伀銇ゃ亱銇亜銈堛亞銇 + 姝岃銈ㄣ儶銈€伄楂樸仌淇傛暟 diff --git a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Strings/ko-KR/Resources.resw b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Strings/ko-KR/Resources.resw index f2759f7..05557b7 100644 --- a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Strings/ko-KR/Resources.resw +++ b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Strings/ko-KR/Resources.resw @@ -1092,6 +1092,12 @@ 鞐秳鞚 牍 + + 牍勳爠毳 頄夓棎 韼橃澊霌 須臣 頇滌劚頇 + + + 韼橃澊霌 須臣 + 順勳灛 頂岆爤鞚 頄 @@ -1161,6 +1167,12 @@ 旮昙 攵堩埇氇呺弰 + + 順勳灛 頄夓澊 鞎勲媽 頄夓潉 鞝愳鞝侅溂搿 氤挫澊歆 鞎婈矊 鞚措彊頃╇媹雼 + + + 雸堨棎 霛勳 毵堨劯鞖 + 臧靷 鞓侅棴 雴掛澊 瓿勳垬 diff --git a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Strings/zh-CN/Resources.resw b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Strings/zh-CN/Resources.resw index b120326..63ac452 100644 --- a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Strings/zh-CN/Resources.resw +++ b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Strings/zh-CN/Resources.resw @@ -1092,6 +1092,12 @@ 瓒呯粏 + + 涓洪潪褰撳墠琛屽惎鐢ㄦ贰鍑烘晥鏋 + + + 娣″嚭鏁堟灉 + 褰撳墠鎾斁琛 @@ -1161,6 +1167,12 @@ 瀛椾綋涓嶉忔槑搴 + + 浣块潪褰撳墠琛岄愭笎杩滅瑙嗛噹 + + + 杩滅瑙嗛噹 + 姝岃瘝鍖哄煙楂樺害鍥犲瓙 diff --git a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Strings/zh-TW/Resources.resw b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Strings/zh-TW/Resources.resw index b371173..79fbcc9 100644 --- a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Strings/zh-TW/Resources.resw +++ b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Strings/zh-TW/Resources.resw @@ -1092,6 +1092,12 @@ 瓒呯窗 + + 鐐洪潪鐩墠琛屽暉鐢ㄦ贰鍑烘晥鏋 + + + 娣″嚭鏁堟灉 + 鐩墠鎾斁琛 @@ -1161,6 +1167,12 @@ 瀛楅珨涓嶉忔槑搴 + + 浣块潪鐣跺墠琛岄愭几閬犻洟瑕栭噹 + + + 閬犻洟瑕栭噹 + 姝岃鍗鍩熼珮搴﹀洜瀛