perf(lyrics): GPU-accelerated underline animation
Replace expensive properties with GPU-accelerated ones: - transform: scaleX() instead of width (no layout recalc) - Solid color instead of gradient - Removed box-shadow blur (very expensive) - Added will-change: transform hint This runs entirely on GPU compositor thread.
This commit is contained in:
1 parent
06469aeaa3
commit
dbd706fc64
1 file changed
+11
-17
@@ -282,7 +282,7 @@
|
||||
}
|
||||
|
||||
/* CSS-only karaoke animation in immersive mode */
|
||||
/* Glowing underline that sweeps left to right - keeps text bright white */
|
||||
/* GPU-accelerated underline using transform instead of width */
|
||||
.lyrics-lines.immersive .lyrics-line.active .line-text {
|
||||
--duration: var(--line-duration, 3000ms);
|
||||
position: relative;
|
||||
@@ -290,36 +290,30 @@
|
||||
color: #ffffff !important;
|
||||
}
|
||||
|
||||
/* Glowing underline that sweeps left to right */
|
||||
/* Underline using scaleX transform (GPU accelerated, no layout recalc) */
|
||||
.lyrics-lines.immersive .lyrics-line.active .line-text::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
bottom: -2px;
|
||||
left: 0;
|
||||
height: 3px;
|
||||
width: 0%;
|
||||
/* QBZ blue gradient */
|
||||
background: linear-gradient(
|
||||
90deg,
|
||||
transparent 0%,
|
||||
#5281ff 20%,
|
||||
#7ba3ff 50%,
|
||||
#5281ff 80%,
|
||||
transparent 100%
|
||||
);
|
||||
width: 100%;
|
||||
/* QBZ blue - solid color, no gradient */
|
||||
background: #5281ff;
|
||||
border-radius: 2px;
|
||||
box-shadow:
|
||||
0 0 8px #5281ff,
|
||||
0 0 16px rgba(82, 129, 255, 0.5);
|
||||
/* GPU accelerated properties only */
|
||||
transform: scaleX(0);
|
||||
transform-origin: left center;
|
||||
will-change: transform;
|
||||
animation: karaoke-underline var(--duration) linear forwards;
|
||||
}
|
||||
|
||||
@keyframes karaoke-underline {
|
||||
0% {
|
||||
width: 0%;
|
||||
transform: scaleX(0);
|
||||
}
|
||||
100% {
|
||||
width: 100%;
|
||||
transform: scaleX(1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user