Skip to content

Commit 4479b10

Browse files
committed
✨ feat: 优化 AMLL 歌词高亮效果。
1 parent a7bc2e3 commit 4479b10

1 file changed

Lines changed: 42 additions & 1 deletion

File tree

src/components/Player/MainAMLyric.vue

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
:key="amLyricsData?.[0]?.words?.length"
55
:class="['lyric-am', { pure: statusStore.pureLyricMode }]"
66
:style="{
7-
'--amll-lp-color': 'rgb(var(--main-cover-color, 239 239 239))',
7+
'--amll-lp-color': 'rgb(239 239 239)',
88
}"
99
>
1010
<div v-if="statusStore.lyricLoading" class="lyric-loading">歌词正在加载中...</div>
@@ -142,6 +142,9 @@ onBeforeUnmount(() => {
142142
hsla(0, 0%, 100%, 0)
143143
);
144144
145+
/* 限定混合模式只作用于歌词区域,避免影响页面其它元素。 */
146+
isolation: isolate;
147+
145148
:deep(.am-lyric) {
146149
width: 100%;
147150
height: 100%;
@@ -164,6 +167,44 @@ onBeforeUnmount(() => {
164167
}
165168
}
166169
}
170+
171+
/* 对常见的“当前高亮行”类名应用加法混合模式,使其高亮更亮 */
172+
:deep(.am-lyric .current),
173+
:deep(.am-lyric .is-current),
174+
:deep(.am-lyric .active),
175+
:deep(.am-lyric .is-active),
176+
:deep(.am-lyric .lyric-line.current),
177+
:deep(.am-lyric .lyric-line.is-current) {
178+
/* 使用加法混合,叠加会更亮 */
179+
mix-blend-mode: plus-lighter;
180+
/* 更亮的文字颜色(半透明白),便于加法叠加效果 */
181+
color: rgba(255, 255, 255, 0.95);
182+
/* 轻微发光,配合混合模式效果更自然 */
183+
text-shadow: 0 2px 12px rgba(255, 255, 255, 0.06);
184+
/* 告诉浏览器该元素可能会变化,优化渲染 */
185+
will-change: transform, opacity, color;
186+
}
187+
188+
/* 只对主歌词文本(非翻译/音译)启用混合,匹配带有 lang 属性的主元素 */
189+
:deep(.am-lyric [lang]) {
190+
/* 默认保持正常,但在高亮时会被上面的规则覆盖 */
191+
-webkit-font-smoothing: antialiased;
192+
}
193+
194+
/* 若浏览器不支持 plus-lighter,使用 supports 提供降级样式 */
195+
@supports not (mix-blend-mode: plus-lighter) {
196+
:deep(.am-lyric .current),
197+
:deep(.am-lyric .is-current),
198+
:deep(.am-lyric .active),
199+
:deep(.am-lyric .is-active),
200+
:deep(.am-lyric .lyric-line.current),
201+
:deep(.am-lyric .lyric-line.is-current) {
202+
/* 降级为更明显的颜色与阴影(非混合) */
203+
color: #ffffff;
204+
text-shadow: 0 4px 18px rgba(0, 0, 0, 0.35);
205+
}
206+
}
207+
167208
:lang(ja) {
168209
font-family: var(--ja-font-family);
169210
}

0 commit comments

Comments
 (0)