fix: restore lyrics sync in ExpandedPlayer and improve performance
- Add startActiveLineUpdates() trigger to ExpandedPlayer - Reduce transition times (200ms instead of 400ms) to fix lag - Simplify karaoke gradient for clearer visual effect
This commit is contained in:
1 parent
8cbb65aaee
commit
68d5704083
2 files changed
+16
-13
No files matched your search
@@ -2,6 +2,7 @@
|
|||||||
import { X, Shuffle, SkipBack, Play, Pause, SkipForward, Repeat, Heart, List, Maximize2, MoreHorizontal, Cast } from 'lucide-svelte';
|
import { X, Shuffle, SkipBack, Play, Pause, SkipForward, Repeat, Heart, List, Maximize2, MoreHorizontal, Cast } from 'lucide-svelte';
|
||||||
import QualityBadge from './QualityBadge.svelte';
|
import QualityBadge from './QualityBadge.svelte';
|
||||||
import LyricsLines from './lyrics/LyricsLines.svelte';
|
import LyricsLines from './lyrics/LyricsLines.svelte';
|
||||||
|
import { startActiveLineUpdates } from '$lib/stores/lyricsStore';
|
||||||
|
|
||||||
interface LyricsLine {
|
interface LyricsLine {
|
||||||
text: string;
|
text: string;
|
||||||
@@ -90,6 +91,13 @@
|
|||||||
const progress = $derived((currentTime / duration) * 100 || 0);
|
const progress = $derived((currentTime / duration) * 100 || 0);
|
||||||
const hasLyrics = $derived(lyricsLines.length > 0);
|
const hasLyrics = $derived(lyricsLines.length > 0);
|
||||||
|
|
||||||
|
// Ensure lyrics updates run when ExpandedPlayer is open with synced lyrics
|
||||||
|
$effect(() => {
|
||||||
|
if (isOpen && isPlaying && lyricsSynced) {
|
||||||
|
startActiveLineUpdates();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
function formatTime(seconds: number): string {
|
function formatTime(seconds: number): string {
|
||||||
if (!seconds || !isFinite(seconds)) return '0:00';
|
if (!seconds || !isFinite(seconds)) return '0:00';
|
||||||
const mins = Math.floor(seconds / 60);
|
const mins = Math.floor(seconds / 60);
|
||||||
|
|||||||
@@ -215,11 +215,11 @@
|
|||||||
letter-spacing: 0.01em;
|
letter-spacing: 0.01em;
|
||||||
opacity: var(--line-opacity, 1);
|
opacity: var(--line-opacity, 1);
|
||||||
transition:
|
transition:
|
||||||
opacity 400ms cubic-bezier(0.4, 0, 0.2, 1),
|
opacity 200ms ease-out,
|
||||||
transform 400ms cubic-bezier(0.4, 0, 0.2, 1),
|
transform 200ms ease-out,
|
||||||
font-size 300ms cubic-bezier(0.4, 0, 0.2, 1),
|
font-size 150ms ease-out,
|
||||||
font-weight 300ms cubic-bezier(0.4, 0, 0.2, 1),
|
font-weight 150ms ease-out,
|
||||||
color 500ms cubic-bezier(0.4, 0, 0.2, 1);
|
color 250ms ease-out;
|
||||||
transform-origin: left center;
|
transform-origin: left center;
|
||||||
will-change: opacity, transform;
|
will-change: opacity, transform;
|
||||||
}
|
}
|
||||||
@@ -249,22 +249,17 @@
|
|||||||
|
|
||||||
/* Shimmer karaoke effect on active line */
|
/* Shimmer karaoke effect on active line */
|
||||||
.lyrics-line.active .line-text {
|
.lyrics-line.active .line-text {
|
||||||
--shimmer-width: 8%;
|
|
||||||
--progress-pos: calc(var(--line-progress, 0) * 100%);
|
--progress-pos: calc(var(--line-progress, 0) * 100%);
|
||||||
background: linear-gradient(
|
background: linear-gradient(
|
||||||
90deg,
|
90deg,
|
||||||
var(--accent-primary) 0%,
|
#a78bfa 0%,
|
||||||
var(--accent-primary) calc(var(--progress-pos) - var(--shimmer-width)),
|
#a78bfa var(--progress-pos),
|
||||||
rgba(255, 255, 255, 0.95) calc(var(--progress-pos) - 2%),
|
var(--text-primary) var(--progress-pos),
|
||||||
rgba(255, 255, 255, 0.95) var(--progress-pos),
|
|
||||||
var(--text-primary) calc(var(--progress-pos) + 2%),
|
|
||||||
var(--text-primary) 100%
|
var(--text-primary) 100%
|
||||||
);
|
);
|
||||||
background-size: 100% 100%;
|
|
||||||
-webkit-background-clip: text;
|
-webkit-background-clip: text;
|
||||||
background-clip: text;
|
background-clip: text;
|
||||||
color: transparent;
|
color: transparent;
|
||||||
transition: background 50ms linear;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.lyrics-empty {
|
.lyrics-empty {
|
||||||
|
|||||||
Reference in new issue
Block a user