mirror of
https://github.com/meowarex/TidaLuna-Plugins.git
synced 2026-06-18 03:43:10 +10:00
Merge pull request #18 from meowarex/dev
Increase Cover Everywhere Performance
This commit is contained in:
@@ -20,9 +20,10 @@
|
|||||||
height: 150vh;
|
height: 150vh;
|
||||||
object-fit: cover;
|
object-fit: cover;
|
||||||
z-index: -1;
|
z-index: -1;
|
||||||
filter: blur(100px) brightness(0.4) contrast(1.2) saturate(1);
|
filter: blur(80px) brightness(0.4) contrast(1.2) saturate(1);
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
animation: spinGlobal 45s linear infinite;
|
animation: spinGlobal 45s linear infinite;
|
||||||
|
will-change: transform, filter;
|
||||||
}
|
}
|
||||||
|
|
||||||
@keyframes spinGlobal {
|
@keyframes spinGlobal {
|
||||||
|
|||||||
@@ -21,8 +21,7 @@ const baseStyleTag = new StyleTag("RadiantLyrics-base", unloads);
|
|||||||
const playerBarStyleTag = new StyleTag("RadiantLyrics-player-bar", unloads);
|
const playerBarStyleTag = new StyleTag("RadiantLyrics-player-bar", unloads);
|
||||||
const lyricsGlowStyleTag = new StyleTag("RadiantLyrics-lyrics-glow", unloads);
|
const lyricsGlowStyleTag = new StyleTag("RadiantLyrics-lyrics-glow", unloads);
|
||||||
|
|
||||||
// StyleTag for global spinning background CSS
|
let globalSpinningBgStyleTag: StyleTag | null = null;
|
||||||
const globalSpinningBgStyleTag = new StyleTag("RadiantLyrics-global-spinning-bg", unloads, coverEverywhereCss);
|
|
||||||
|
|
||||||
// Apply lyrics glow styles if enabled
|
// Apply lyrics glow styles if enabled
|
||||||
if (settings.lyricsGlowEnabled) {
|
if (settings.lyricsGlowEnabled) {
|
||||||
@@ -75,9 +74,24 @@ const updateRadiantLyricsStyles = function(): void {
|
|||||||
|
|
||||||
// Function to apply spinning background to the entire app
|
// Function to apply spinning background to the entire app
|
||||||
const applyGlobalSpinningBackground = (albumImageSrc: string): void => {
|
const applyGlobalSpinningBackground = (albumImageSrc: string): void => {
|
||||||
if (!settings.spinningCoverEverywhere) return;
|
|
||||||
|
|
||||||
const appContainer = document.querySelector('[data-test="main"]') as HTMLElement;
|
const appContainer = document.querySelector('[data-test="main"]') as HTMLElement;
|
||||||
|
if (!settings.spinningCoverEverywhere) {
|
||||||
|
// Remove StyleTag and all background elements
|
||||||
|
if (globalSpinningBgStyleTag) {
|
||||||
|
globalSpinningBgStyleTag.remove();
|
||||||
|
globalSpinningBgStyleTag = null;
|
||||||
|
}
|
||||||
|
if (appContainer) {
|
||||||
|
appContainer.querySelectorAll('.global-spinning-image, .global-spinning-black-bg').forEach(el => el.remove());
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add StyleTag if not present
|
||||||
|
if (!globalSpinningBgStyleTag) {
|
||||||
|
globalSpinningBgStyleTag = new StyleTag("RadiantLyrics-global-spinning-bg", unloads, coverEverywhereCss);
|
||||||
|
}
|
||||||
|
|
||||||
if (!appContainer) return;
|
if (!appContainer) return;
|
||||||
|
|
||||||
// Remove any existing background elements
|
// Remove any existing background elements
|
||||||
@@ -88,14 +102,12 @@ const applyGlobalSpinningBackground = (albumImageSrc: string): void => {
|
|||||||
blackBg.className = 'global-spinning-black-bg';
|
blackBg.className = 'global-spinning-black-bg';
|
||||||
appContainer.appendChild(blackBg);
|
appContainer.appendChild(blackBg);
|
||||||
|
|
||||||
// Add two spinning images
|
// Add one spinning image for performance
|
||||||
for (let i = 0; i < 2; i++) {
|
|
||||||
const img = document.createElement('img');
|
const img = document.createElement('img');
|
||||||
img.src = albumImageSrc;
|
img.src = albumImageSrc;
|
||||||
img.className = 'global-spinning-image';
|
img.className = 'global-spinning-image';
|
||||||
img.style.animationDelay = '0s';
|
img.style.animationDelay = '0s';
|
||||||
appContainer.appendChild(img);
|
appContainer.appendChild(img);
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Function to clean up global spinning background
|
// Function to clean up global spinning background
|
||||||
|
|||||||
Reference in New Issue
Block a user