Fix Song Change Issue

This commit is contained in:
2025-06-11 22:33:28 +10:00
parent 813c9246a1
commit 8ae144bc65
2 changed files with 18 additions and 14 deletions
+7 -7
View File
@@ -8,7 +8,7 @@ export const settings = await ReactiveStore.getPluginStorage("RadiantLyrics", {
lyricsGlowEnabled: true,
spinningCoverEverywhere: false,
performanceMode: false,
noSpinningArt: false,
spinningArtEnabled: true,
backgroundContrast: 120,
backgroundBlur: 80,
backgroundBrightness: 40,
@@ -22,7 +22,7 @@ export const Settings = () => {
const [lyricsGlowEnabled, setLyricsGlowEnabled] = React.useState(settings.lyricsGlowEnabled);
const [spinningCoverEverywhere, setSpinningCoverEverywhere] = React.useState(settings.spinningCoverEverywhere);
const [performanceMode, setPerformanceMode] = React.useState(settings.performanceMode);
const [noSpinningArt, setNoSpinningArt] = React.useState(settings.noSpinningArt);
const [spinningArtEnabled, setSpinningArtEnabled] = React.useState(settings.spinningArtEnabled);
const [backgroundContrast, setBackgroundContrast] = React.useState(settings.backgroundContrast);
const [backgroundBlur, setBackgroundBlur] = React.useState(settings.backgroundBlur);
const [backgroundBrightness, setBackgroundBrightness] = React.useState(settings.backgroundBrightness);
@@ -79,7 +79,7 @@ export const Settings = () => {
/>
<LunaSwitchSetting
title="Performance Mode"
desc="Performance mode: Reduces blur effects (max 20px), uses smaller image sizes, and optimizes GPU usage while keeping spinning animations"
desc="Performance mode: Reduces blur effects (20px), uses smaller image sizes, to optimize GPU usage"
checked={performanceMode}
onChange={(_, checked: boolean) => {
console.log("Performance Mode:", checked ? "enabled" : "disabled");
@@ -94,12 +94,12 @@ export const Settings = () => {
}}
/>
<LunaSwitchSetting
title="Disable Spinning Art"
title="Disable Cover Spin" // Cheers @Max/n0201 for the idea <3
desc="Disable the spinning cover art background animation"
checked={noSpinningArt}
checked={!spinningArtEnabled}
onChange={(_, checked: boolean) => {
console.log("No Spinning Art:", checked ? "enabled" : "disabled");
setNoSpinningArt((settings.noSpinningArt = checked));
console.log("Disable Cover Spin:", checked ? "enabled" : "disabled");
setSpinningArtEnabled((settings.spinningArtEnabled = !checked));
if ((window as any).updateRadiantLyricsGlobalBackground) {
(window as any).updateRadiantLyricsGlobalBackground();
}
+11 -7
View File
@@ -128,7 +128,7 @@ const updateRadiantLyricsStyles = function(): void {
}
};
// Function to apply spinning background to the entire app (cover everywhere) - PERFORMANCE OPTIMIZED
// Function to apply spinning background to the entire app (cover everywhere)
const applyGlobalSpinningBackground = (coverArtImageSrc: string): void => {
const appContainer = document.querySelector('[data-test="main"]') as HTMLElement;
@@ -202,7 +202,7 @@ const applyGlobalSpinningBackground = (coverArtImageSrc: string): void => {
globalBackgroundImage.style.width = '120vw';
globalBackgroundImage.style.height = '120vh';
globalBackgroundImage.style.filter = `blur(${Math.min(settings.backgroundBlur, 20)}px) brightness(${settings.backgroundBrightness / 100}) contrast(${Math.min(settings.backgroundContrast, 150)}%)`;
if (!settings.noSpinningArt) {
if (settings.spinningArtEnabled) {
globalBackgroundImage.style.animation = `spinGlobal ${settings.spinSpeed}s linear infinite`;
}
else {
@@ -215,7 +215,7 @@ const applyGlobalSpinningBackground = (coverArtImageSrc: string): void => {
globalBackgroundImage.style.width = '150vw';
globalBackgroundImage.style.height = '150vh';
globalBackgroundImage.style.filter = `blur(${settings.backgroundBlur}px) brightness(${settings.backgroundBrightness / 100}) contrast(${settings.backgroundContrast}%)`;
if (!settings.noSpinningArt) {
if (settings.spinningArtEnabled) {
globalBackgroundImage.style.animation = `spinGlobal ${settings.spinSpeed}s linear infinite`;
}
else {
@@ -291,7 +291,7 @@ const updateRadiantLyricsNowPlayingBackground = function(): void {
// Reduce blur and effects for better performance, but keep spinning
blur = Math.min(blur, 20);
contrast = Math.min(contrast, 150);
if (!settings.noSpinningArt) {
if (settings.spinningArtEnabled) {
imgElement.style.animation = `spin ${spinSpeed}s linear infinite`;
}
else {
@@ -300,7 +300,7 @@ const updateRadiantLyricsNowPlayingBackground = function(): void {
imgElement.classList.remove('performance-mode-static');
imgElement.style.willChange = 'transform';
} else {
if (!settings.noSpinningArt) {
if (settings.spinningArtEnabled) {
imgElement.style.animation = `spin ${spinSpeed}s linear infinite`;
}
else {
@@ -751,7 +751,9 @@ const updateCoverArtBackground = function (method: number = 0): void {
const blur = Math.min(settings.backgroundBlur, 20);
const contrast = Math.min(settings.backgroundContrast, 150);
nowPlayingBackgroundImage.style.filter = `blur(${blur}px) brightness(${settings.backgroundBrightness / 100}) contrast(${contrast}%)`;
nowPlayingBackgroundImage.style.animation = `spin ${settings.spinSpeed}s linear infinite`;
nowPlayingBackgroundImage.style.animation = settings.spinningArtEnabled
? `spin ${settings.spinSpeed}s linear infinite`
: 'none';
nowPlayingBackgroundImage.classList.remove('performance-mode-static');
nowPlayingBackgroundImage.style.willChange = 'transform';
} else {
@@ -759,7 +761,9 @@ const updateCoverArtBackground = function (method: number = 0): void {
nowPlayingBackgroundImage.style.width = '90vw';
nowPlayingBackgroundImage.style.height = '90vh';
nowPlayingBackgroundImage.style.filter = `blur(${settings.backgroundBlur}px) brightness(${settings.backgroundBrightness / 100}) contrast(${settings.backgroundContrast}%)`;
nowPlayingBackgroundImage.style.animation = `spin ${settings.spinSpeed}s linear infinite`;
nowPlayingBackgroundImage.style.animation = settings.spinningArtEnabled
? `spin ${settings.spinSpeed}s linear infinite`
: 'none';
nowPlayingBackgroundImage.classList.remove('performance-mode-static');
nowPlayingBackgroundImage.style.willChange = 'transform';
}