Skip to content

Commit da96327

Browse files
committed
✨ feat: 同步 AMLL 0.2.0
1 parent 7083463 commit da96327

7 files changed

Lines changed: 89 additions & 103 deletions

File tree

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
"dependencies": {
3636
"@applemusic-like-lyrics/core": "^0.2.0",
3737
"@applemusic-like-lyrics/lyric": "^0.3.0",
38-
"@applemusic-like-lyrics/vue": "^0.1.5",
38+
"@applemusic-like-lyrics/vue": "^0.2.0",
3939
"@electron-toolkit/preload": "^3.0.2",
4040
"@electron-toolkit/utils": "^4.0.0",
4141
"@imsyy/color-utils": "^1.0.2",
@@ -48,6 +48,7 @@
4848
"@pixi/filter-bulge-pinch": "^5.1.1",
4949
"@pixi/filter-color-matrix": "^7.4.3",
5050
"@pixi/sprite": "^7.4.3",
51+
"@tanstack/vue-virtual": "^3.13.13",
5152
"@vueuse/core": "^13.9.0",
5253
"@vueuse/integrations": "^14.1.0",
5354
"axios": "^1.13.2",
@@ -75,8 +76,7 @@
7576
"pinia": "^3.0.4",
7677
"pinia-plugin-persistedstate": "^4.7.1",
7778
"plyr": "^3.8.3",
78-
"sortablejs": "^1.15.6",
79-
"vue-virtual-scroller": "2.0.0-beta.8"
79+
"sortablejs": "^1.15.6"
8080
},
8181
"devDependencies": {
8282
"@electron-toolkit/preload": "^3.0.1",

pnpm-lock.yaml

Lines changed: 24 additions & 72 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/components/Player/FullPlayer.vue

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,8 @@
5454
:light="pureLyricMode"
5555
/>
5656
<!-- 歌词 -->
57-
<MainAMLyric
58-
v-if="settingStore.useAMLyrics"
59-
:key="`am-lyric-${musicStore.playSong.id}`"
60-
/>
61-
<MainLyric v-else :key="`lyric-${musicStore.playSong.id}`" />
57+
<MainAMLyric v-if="settingStore.useAMLyrics" />
58+
<MainLyric v-else />
6259
</div>
6360
</div>
6461
</Transition>

src/components/Player/MainAMLyric.vue

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
<div
44
:key="amLyricsData?.[0]?.words?.length"
55
:class="['lyric-am', { pure: statusStore.pureLyricMode }]"
6+
:style="{
7+
'--amll-lp-color': 'rgb(var(--main-cover-color))',
8+
}"
69
>
710
<div v-if="statusStore.lyricLoading" class="lyric-loading">歌词正在加载中...</div>
811
<LyricPlayer
@@ -15,9 +18,10 @@
1518
:enableScale="settingStore.useAMSpring"
1619
:alignPosition="settingStore.lyricsScrollPosition === 'center' ? 0.5 : 0.2"
1720
:enableBlur="settingStore.lyricsBlur"
21+
:hidePassedLines="settingStore.hidePassedLines"
22+
:wordFadeWidth="settingStore.wordFadeWidth"
1823
:style="{
19-
'--amll-lyric-view-color': 'rgb(var(--main-cover-color))',
20-
'--amll-lyric-player-font-size': settingStore.lyricFontSize + 'px',
24+
'--amll-lp-font-size': settingStore.lyricFontSize + 'px',
2125
'--ja-font-family':
2226
settingStore.japaneseLyricFont !== 'follow' ? settingStore.japaneseLyricFont : '',
2327
'--en-font-family':
@@ -38,10 +42,12 @@
3842

3943
<script setup lang="ts">
4044
import { LyricPlayer } from "@applemusic-like-lyrics/vue";
41-
import { type LyricLine } from "@applemusic-like-lyrics/lyric";
45+
import { type LyricLine } from "@applemusic-like-lyrics/core";
4246
import { useMusicStore, useSettingStore, useStatusStore } from "@/stores";
4347
import { getLyricLanguage } from "@/utils/format";
4448
import { usePlayerController } from "@/core/player/PlayerController";
49+
import "@applemusic-like-lyrics/core/style.css";
50+
import { cloneDeep } from "lodash-es";
4551
4652
const musicStore = useMusicStore();
4753
const statusStore = useStatusStore();
@@ -61,7 +67,7 @@ const { pause: pauseSeek, resume: resumeSeek } = useRafFn(() => {
6167
});
6268
6369
// 当前歌词
64-
const amLyricsData = computed<LyricLine[]>(() => {
70+
const amLyricsData = computed(() => {
6571
const { songLyric } = musicStore;
6672
if (!songLyric) return [];
6773
@@ -72,7 +78,7 @@ const amLyricsData = computed<LyricLine[]>(() => {
7278
// 简单检查歌词有效性
7379
if (!Array.isArray(lyrics) || lyrics.length === 0) return [];
7480
75-
return lyrics;
81+
return cloneDeep(lyrics) as LyricLine[];
7682
});
7783
7884
// 进度跳转
@@ -86,12 +92,12 @@ const jumpSeek = (line: any) => {
8692
8793
// 处理歌词语言
8894
const processLyricLanguage = (player = lyricPlayerRef.value) => {
89-
const lyricLinesEl = player?.lyricPlayer?.lyricLinesEl;
90-
if (!lyricLinesEl || lyricLinesEl.length === 0) {
95+
const lyricLineObjects = player?.lyricPlayer?.currentLyricLineObjects;
96+
if (!Array.isArray(lyricLineObjects) || lyricLineObjects.length === 0) {
9197
return;
9298
}
9399
// 遍历歌词行
94-
for (let e of lyricLinesEl) {
100+
for (let e of lyricLineObjects) {
95101
// 获取歌词行内容 (合并逐字歌词为一句)
96102
const content = e.lyricLine.words.map((word: any) => word.word).join("");
97103
// 获取歌词语言
@@ -177,7 +183,7 @@ onBeforeUnmount(() => {
177183
display: flex;
178184
align-items: center;
179185
justify-content: center;
180-
color: var(--amll-lyric-view-color, #efefef);
186+
color: var(--amll-lp-color, #efefef);
181187
font-size: 22px;
182188
}
183189
</style>

src/components/Player/MainLyric.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<template>
22
<div
3+
:key="`lyric-${musicStore.playSong.id}`"
34
:style="{
45
'--lrc-size': settingStore.lyricFontSize + 'px',
56
'--lrc-tran-size': settingStore.lyricTranFontSize + 'px',

src/components/Setting/LyricsSetting.vue

Lines changed: 38 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -385,20 +385,44 @@
385385
</div>
386386
<n-switch v-model:value="settingStore.useAMLyrics" class="set" :round="false" />
387387
</n-card>
388-
<n-card class="set-item">
389-
<div class="label">
390-
<n-text class="name">歌词弹簧效果</n-text>
391-
<n-text class="tip" :depth="3">
392-
是否使用物理弹簧算法实现歌词动画效果,需要高性能设备
393-
</n-text>
394-
</div>
395-
<n-switch
396-
v-model:value="settingStore.useAMSpring"
397-
class="set"
398-
:round="false"
399-
:disabled="!settingStore.useAMLyrics"
400-
/>
401-
</n-card>
388+
<n-collapse-transition :show="settingStore.useAMLyrics">
389+
<n-card class="set-item">
390+
<div class="label">
391+
<n-text class="name">歌词弹簧效果</n-text>
392+
<n-text class="tip" :depth="3">
393+
是否使用物理弹簧算法实现歌词动画效果,需要高性能设备
394+
</n-text>
395+
</div>
396+
<n-switch v-model:value="settingStore.useAMSpring" class="set" :round="false" />
397+
</n-card>
398+
<n-card class="set-item">
399+
<div class="label">
400+
<n-text class="name">隐藏已播放歌词</n-text>
401+
<n-text class="tip" :depth="3">是否隐藏已播放歌词</n-text>
402+
</div>
403+
<n-switch v-model:value="settingStore.hidePassedLines" class="set" :round="false" />
404+
</n-card>
405+
<n-card class="set-item">
406+
<div class="label">
407+
<n-text class="name">文字动画的渐变宽度</n-text>
408+
<n-text class="tip" :depth="3">
409+
单位以歌词行的主文字字体大小的倍数为单位 <br />
410+
默认为 0.5,即一个全角字符的一半宽度 <br />
411+
若模拟 Apple Music for Android 的效果,可以设为 1 <br />
412+
若模拟 Apple Music for iPad 的效果,可以设为 0.5 <br />
413+
若需近乎禁用渐变,可设为非常接近 0 的小数,如 0.01
414+
</n-text>
415+
</div>
416+
<n-input-number
417+
v-model:value="settingStore.wordFadeWidth"
418+
class="set"
419+
:min="0.01"
420+
:max="1"
421+
:step="0.01"
422+
:round="false"
423+
/>
424+
</n-card>
425+
</n-collapse-transition>
402426
</div>
403427
<div v-if="isElectron" ref="desktopLyricRef" class="set-list">
404428
<n-h3 prefix="bar">

0 commit comments

Comments
 (0)