@applemusic-like-lyrics/core 0.0.12 → 0.0.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -0
- package/dist/amll-core.js +1 -1
- package/dist/amll-core.js.map +1 -1
- package/dist/amll-core.mjs +61 -54
- package/dist/amll-core.mjs.map +1 -1
- package/dist/lyric-player/index.d.ts +2 -1
- package/dist/lyric-player/lyric-line.d.ts +1 -0
- package/dist/utils/spring.d.ts +1 -0
- package/package.json +1 -1
package/dist/amll-core.mjs
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import { Container as
|
|
2
|
-
import { Application as
|
|
1
|
+
import { Container as z } from "@pixi/display";
|
|
2
|
+
import { Application as A } from "@pixi/app";
|
|
3
3
|
import { BlurFilter as y } from "@pixi/filter-blur";
|
|
4
4
|
import { ColorMatrixFilter as v } from "@pixi/filter-color-matrix";
|
|
5
|
-
import { Texture as
|
|
5
|
+
import { Texture as I } from "@pixi/core";
|
|
6
6
|
import { Sprite as S } from "@pixi/sprite";
|
|
7
7
|
import { BulgePinchFilter as E } from "@pixi/filter-bulge-pinch";
|
|
8
|
-
import { create as
|
|
9
|
-
import
|
|
10
|
-
const
|
|
8
|
+
import { create as D } from "jss";
|
|
9
|
+
import k from "jss-preset-default";
|
|
10
|
+
const B = /^(((?<hour>[0-9]+):)?(?<min>[0-9]+):)?(?<sec>[0-9]+([\.:]([0-9]+))?)/;
|
|
11
11
|
function T(h) {
|
|
12
|
-
const e =
|
|
12
|
+
const e = B.exec(h);
|
|
13
13
|
if (e) {
|
|
14
14
|
const t = Number(e.groups?.hour || "0"), i = Number(e.groups?.min || "0"), s = Number(e.groups?.sec.replace(/:/, ".") || "0");
|
|
15
15
|
return Math.floor((t * 3600 + i * 60 + s) * 1e3);
|
|
16
16
|
} else
|
|
17
17
|
throw new TypeError("时间戳字符串解析失败");
|
|
18
18
|
}
|
|
19
|
-
function
|
|
19
|
+
function $(h) {
|
|
20
20
|
const t = new DOMParser().parseFromString(
|
|
21
21
|
h,
|
|
22
22
|
"application/xml"
|
|
@@ -113,12 +113,12 @@ function B(h) {
|
|
|
113
113
|
}
|
|
114
114
|
const ae = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
115
115
|
__proto__: null,
|
|
116
|
-
parseTTML:
|
|
116
|
+
parseTTML: $
|
|
117
117
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
118
|
-
class O extends
|
|
118
|
+
class O extends z {
|
|
119
119
|
time = 0;
|
|
120
120
|
}
|
|
121
|
-
class
|
|
121
|
+
class W {
|
|
122
122
|
constructor(e) {
|
|
123
123
|
this.canvas = e;
|
|
124
124
|
const t = e.getBoundingClientRect();
|
|
@@ -128,7 +128,7 @@ class $ {
|
|
|
128
128
|
this.canvas.width * this.currerntRenderScale,
|
|
129
129
|
this.canvas.height * this.currerntRenderScale
|
|
130
130
|
), this.app.ticker.start(), this.rebuildFilters();
|
|
131
|
-
}), this.observer.observe(e), this.app = new
|
|
131
|
+
}), this.observer.observe(e), this.app = new A({
|
|
132
132
|
view: e,
|
|
133
133
|
resizeTo: this.canvas,
|
|
134
134
|
powerPreference: "low-power",
|
|
@@ -250,7 +250,7 @@ class $ {
|
|
|
250
250
|
let i = 5, s;
|
|
251
251
|
for (; !s?.baseTexture?.resource?.valid && i > 0; )
|
|
252
252
|
try {
|
|
253
|
-
await t.decode(), s =
|
|
253
|
+
await t.decode(), s = I.from(t, {
|
|
254
254
|
resourceOptions: {
|
|
255
255
|
autoLoad: !1
|
|
256
256
|
}
|
|
@@ -271,7 +271,7 @@ class $ {
|
|
|
271
271
|
this.observer.disconnect(), this.app.ticker.remove(this.onTick), this.app.destroy(!0);
|
|
272
272
|
}
|
|
273
273
|
}
|
|
274
|
-
class oe extends
|
|
274
|
+
class oe extends W {
|
|
275
275
|
element;
|
|
276
276
|
constructor() {
|
|
277
277
|
const e = document.createElement("canvas");
|
|
@@ -284,7 +284,7 @@ class oe extends $ {
|
|
|
284
284
|
super.dispose(), this.element.remove();
|
|
285
285
|
}
|
|
286
286
|
}
|
|
287
|
-
const
|
|
287
|
+
const N = (h, e) => h.size === e.size && [...h].every((t) => e.has(t));
|
|
288
288
|
class w {
|
|
289
289
|
currentPosition = 0;
|
|
290
290
|
targetPosition = 0;
|
|
@@ -292,26 +292,27 @@ class w {
|
|
|
292
292
|
params = {};
|
|
293
293
|
currentSolver;
|
|
294
294
|
getV;
|
|
295
|
+
getV2;
|
|
295
296
|
queueParams;
|
|
296
297
|
queuePosition;
|
|
297
298
|
constructor(e = 0) {
|
|
298
|
-
this.targetPosition = e, this.currentPosition = this.targetPosition, this.currentSolver = () => this.targetPosition, this.getV = () => 0;
|
|
299
|
+
this.targetPosition = e, this.currentPosition = this.targetPosition, this.currentSolver = () => this.targetPosition, this.getV = () => 0, this.getV2 = () => 0;
|
|
299
300
|
}
|
|
300
301
|
resetSolver() {
|
|
301
302
|
const e = this.getV(this.currentTime);
|
|
302
|
-
this.currentTime = 0, this.currentSolver =
|
|
303
|
+
this.currentTime = 0, this.currentSolver = q(
|
|
303
304
|
this.currentPosition,
|
|
304
305
|
e,
|
|
305
306
|
this.targetPosition,
|
|
306
307
|
0,
|
|
307
308
|
this.params
|
|
308
|
-
), this.getV =
|
|
309
|
+
), this.getV = M(this.currentSolver), this.getV2 = M(this.getV);
|
|
309
310
|
}
|
|
310
311
|
arrived() {
|
|
311
|
-
return Math.abs(this.targetPosition - this.currentPosition) < 0.01 && this.getV(this.currentTime) < 0.01 && this.queueParams === void 0 && this.queuePosition === void 0;
|
|
312
|
+
return Math.abs(this.targetPosition - this.currentPosition) < 0.01 && this.getV(this.currentTime) < 0.01 && this.getV2(this.currentTime) < 0.01 && this.queueParams === void 0 && this.queuePosition === void 0;
|
|
312
313
|
}
|
|
313
314
|
setPosition(e) {
|
|
314
|
-
this.targetPosition = e, this.currentPosition = e, this.currentSolver = () => this.targetPosition, this.getV = () => 0;
|
|
315
|
+
this.targetPosition = e, this.currentPosition = e, this.currentSolver = () => this.targetPosition, this.getV = () => 0, this.getV2 = () => 0;
|
|
315
316
|
}
|
|
316
317
|
update(e = 0) {
|
|
317
318
|
this.currentTime += e, this.currentPosition = this.currentSolver(this.currentTime), this.queueParams && (this.queueParams.time -= e, this.queueParams.time <= 0 && this.updateParams({
|
|
@@ -320,15 +321,17 @@ class w {
|
|
|
320
321
|
}
|
|
321
322
|
updateParams(e, t = 0) {
|
|
322
323
|
t > 0 ? this.queueParams = {
|
|
324
|
+
...this.queuePosition ?? {},
|
|
323
325
|
...e,
|
|
324
326
|
time: t
|
|
325
|
-
} : (this.params = {
|
|
327
|
+
} : (this.queuePosition = void 0, this.params = {
|
|
326
328
|
...this.params,
|
|
327
329
|
...e
|
|
328
330
|
}, this.resetSolver());
|
|
329
331
|
}
|
|
330
332
|
setTargetPosition(e, t = 0) {
|
|
331
333
|
t > 0 ? this.queuePosition = {
|
|
334
|
+
...this.queuePosition ?? {},
|
|
332
335
|
position: e,
|
|
333
336
|
time: t
|
|
334
337
|
} : (this.queuePosition = void 0, this.targetPosition = e, this.resetSolver());
|
|
@@ -337,7 +340,7 @@ class w {
|
|
|
337
340
|
return this.currentPosition;
|
|
338
341
|
}
|
|
339
342
|
}
|
|
340
|
-
function
|
|
343
|
+
function q(h, e, t, i = 0, s) {
|
|
341
344
|
const r = s?.soft ?? !1, n = s?.stiffness ?? 100, a = s?.damping ?? 10, l = s?.mass ?? 1, o = t - h;
|
|
342
345
|
if (r || 1 <= a / (2 * Math.sqrt(n * l))) {
|
|
343
346
|
const c = -Math.sqrt(n / l), m = -c * o - e;
|
|
@@ -352,10 +355,10 @@ function N(h, e, t, i = 0, s) {
|
|
|
352
355
|
function F(h) {
|
|
353
356
|
return (t) => (h(t + 1e-3) - h(t - 1e-3)) / (2 * 1e-3);
|
|
354
357
|
}
|
|
355
|
-
function
|
|
358
|
+
function M(h) {
|
|
356
359
|
return F(h);
|
|
357
360
|
}
|
|
358
|
-
class
|
|
361
|
+
class R {
|
|
359
362
|
constructor(e) {
|
|
360
363
|
this.lyricPlayer = e, this.element.setAttribute(
|
|
361
364
|
"class",
|
|
@@ -412,12 +415,12 @@ class q {
|
|
|
412
415
|
this.element.remove();
|
|
413
416
|
}
|
|
414
417
|
}
|
|
415
|
-
function
|
|
418
|
+
function _(h) {
|
|
416
419
|
const t = 2.5949095;
|
|
417
420
|
return h < 0.5 ? Math.pow(2 * h, 2) * ((t + 1) * 2 * h - t) / 2 : (Math.pow(2 * h - 2, 2) * ((t + 1) * (h * 2 - 2) + t) + 2) / 2;
|
|
418
421
|
}
|
|
419
422
|
const L = (h, e, t) => Math.max(h, Math.min(e, t));
|
|
420
|
-
class
|
|
423
|
+
class X {
|
|
421
424
|
constructor(e) {
|
|
422
425
|
this.lyricPlayer = e, this.element.className = this.lyricPlayer.style.classes.interludeDots, this.element.appendChild(this.dot0), this.element.appendChild(this.dot1), this.element.appendChild(this.dot2);
|
|
423
426
|
}
|
|
@@ -449,7 +452,7 @@ class Y {
|
|
|
449
452
|
if (s <= i) {
|
|
450
453
|
const r = i / Math.ceil(i / this.targetBreatheDuration);
|
|
451
454
|
let n = 1, a = 1;
|
|
452
|
-
n *= Math.sin(1.5 * Math.PI - s / r * 2) / 10 + 1, s < 1e3 && (n *= 1 - Math.pow((1e3 - s) / 1e3, 2)), s < 500 ? a = 0 : s < 1e3 && (a *= (s - 500) / 500), i - s < 750 && (n *= 1 -
|
|
455
|
+
n *= Math.sin(1.5 * Math.PI - s / r * 2) / 10 + 1, s < 1e3 && (n *= 1 - Math.pow((1e3 - s) / 1e3, 2)), s < 500 ? a = 0 : s < 1e3 && (a *= (s - 500) / 500), i - s < 750 && (n *= 1 - _(
|
|
453
456
|
(750 - (i - s)) / 750 / 2
|
|
454
457
|
)), i - s < 375 && (a *= L(
|
|
455
458
|
0,
|
|
@@ -492,7 +495,7 @@ class Y {
|
|
|
492
495
|
this.element.remove();
|
|
493
496
|
}
|
|
494
497
|
}
|
|
495
|
-
const
|
|
498
|
+
const Y = /^[\p{Unified_Ideograph}\u0800-\u9FFC]+$/u;
|
|
496
499
|
function G(h, e = "rgba(0,0,0,1)", t = "rgba(0,0,0,0.5)") {
|
|
497
500
|
const i = 2 + h, s = h / i, r = (1 - s) / 2;
|
|
498
501
|
return [
|
|
@@ -501,19 +504,19 @@ function G(h, e = "rgba(0,0,0,1)", t = "rgba(0,0,0,0.5)") {
|
|
|
501
504
|
i
|
|
502
505
|
];
|
|
503
506
|
}
|
|
504
|
-
function
|
|
507
|
+
function V(h, e) {
|
|
505
508
|
let t = [], i = [];
|
|
506
509
|
const s = [];
|
|
507
510
|
for (const r of h) {
|
|
508
511
|
const n = e(r);
|
|
509
|
-
t.push(n), i.push(r), n.length > 0 && n.trim().length === 0 ? (t.pop(), i.pop(), i.length === 1 ? s.push(i[0]) : i.length > 1 && s.push(i), s.push(r), t = [], i = []) : (!/^\s*[^\s]*\s*$/.test(t.join("")) ||
|
|
512
|
+
t.push(n), i.push(r), n.length > 0 && n.trim().length === 0 ? (t.pop(), i.pop(), i.length === 1 ? s.push(i[0]) : i.length > 1 && s.push(i), s.push(r), t = [], i = []) : (!/^\s*[^\s]*\s*$/.test(t.join("")) || Y.test(n)) && (t.pop(), i.pop(), i.length === 1 ? s.push(i[0]) : i.length > 1 && s.push(i), t = [n], i = [r]);
|
|
510
513
|
}
|
|
511
514
|
return i.length === 1 ? s.push(i[0]) : s.push(i), s;
|
|
512
515
|
}
|
|
513
516
|
function x(h) {
|
|
514
517
|
return h.endTime - h.startTime >= 1e3 && h.word.length <= 7;
|
|
515
518
|
}
|
|
516
|
-
class
|
|
519
|
+
class H extends MouseEvent {
|
|
517
520
|
constructor(e, t) {
|
|
518
521
|
super(t.type, t), this.line = e;
|
|
519
522
|
}
|
|
@@ -552,7 +555,7 @@ class j extends EventTarget {
|
|
|
552
555
|
};
|
|
553
556
|
listenersMap = /* @__PURE__ */ new Map();
|
|
554
557
|
onMouseEvent = (e) => {
|
|
555
|
-
if (!this.dispatchEvent(new
|
|
558
|
+
if (!this.dispatchEvent(new H(this, e)))
|
|
556
559
|
return e.preventDefault(), e.stopPropagation(), e.stopImmediatePropagation(), !1;
|
|
557
560
|
};
|
|
558
561
|
addEventListener(e, t, i) {
|
|
@@ -627,7 +630,7 @@ class j extends EventTarget {
|
|
|
627
630
|
e.innerText = this.lyricLine.words.map((r) => r.word).join(""), t.innerText = this.lyricLine.translatedLyric, i.innerText = this.lyricLine.romanLyric;
|
|
628
631
|
return;
|
|
629
632
|
}
|
|
630
|
-
const s =
|
|
633
|
+
const s = V(this.lyricLine.words, (r) => r.word);
|
|
631
634
|
e.innerHTML = "", this.splittedWords = [];
|
|
632
635
|
for (const r of s)
|
|
633
636
|
if (r instanceof Array) {
|
|
@@ -641,6 +644,7 @@ class j extends EventTarget {
|
|
|
641
644
|
c
|
|
642
645
|
);
|
|
643
646
|
if (n) {
|
|
647
|
+
c.classList.add("emphasize");
|
|
644
648
|
const u = [];
|
|
645
649
|
for (const p of o.word.trim().split("")) {
|
|
646
650
|
const d = document.createElement("span");
|
|
@@ -684,6 +688,7 @@ class j extends EventTarget {
|
|
|
684
688
|
shouldEmphasize: n
|
|
685
689
|
};
|
|
686
690
|
if (n) {
|
|
691
|
+
a.classList.add("emphasize");
|
|
687
692
|
const o = [];
|
|
688
693
|
for (const c of r.word.trim().split("")) {
|
|
689
694
|
const m = document.createElement("span");
|
|
@@ -730,7 +735,7 @@ class j extends EventTarget {
|
|
|
730
735
|
},
|
|
731
736
|
{
|
|
732
737
|
offset: 0.5,
|
|
733
|
-
transform: "translate3d(0, -
|
|
738
|
+
transform: "translate3d(0, -0.02em, 20px)",
|
|
734
739
|
filter: "drop-shadow(0 0 0.05em var(--amll-lyric-view-color,white))"
|
|
735
740
|
},
|
|
736
741
|
{
|
|
@@ -745,6 +750,7 @@ class j extends EventTarget {
|
|
|
745
750
|
id: "glow-word",
|
|
746
751
|
iterations: 1,
|
|
747
752
|
composite: "replace",
|
|
753
|
+
easing: "ease-in-out",
|
|
748
754
|
fill: "both"
|
|
749
755
|
}
|
|
750
756
|
);
|
|
@@ -794,6 +800,9 @@ class j extends EventTarget {
|
|
|
794
800
|
update(e = 0) {
|
|
795
801
|
this.lyricPlayer.getEnableSpring() && (this.lineTransforms.posX.update(e), this.lineTransforms.posY.update(e), this.lineTransforms.scale.update(e), this.isInSight ? this.show() : this.hide());
|
|
796
802
|
}
|
|
803
|
+
_getDebugTargetPos() {
|
|
804
|
+
return `[位移: ${this.left}, ${this.top}; 缩放: ${this.scale}; 延时: ${this.delay}]`;
|
|
805
|
+
}
|
|
797
806
|
get isInSight() {
|
|
798
807
|
const e = this.lineTransforms.posX.getCurrentPosition(), t = this.lineTransforms.posY.getCurrentPosition(), i = e + this.lineSize[0], s = t + this.lineSize[1], r = this.lyricPlayer.size[0], n = this.lyricPlayer.size[1];
|
|
799
808
|
return !(e > r || i < 0 || t > n || s < 0);
|
|
@@ -802,8 +811,8 @@ class j extends EventTarget {
|
|
|
802
811
|
this.element.remove();
|
|
803
812
|
}
|
|
804
813
|
}
|
|
805
|
-
const
|
|
806
|
-
class
|
|
814
|
+
const U = D(k());
|
|
815
|
+
class J extends MouseEvent {
|
|
807
816
|
constructor(e, t, i) {
|
|
808
817
|
super(`line-${i.type}`, i), this.lineIndex = e, this.line = t;
|
|
809
818
|
}
|
|
@@ -823,7 +832,6 @@ class le extends EventTarget {
|
|
|
823
832
|
scrolledHandler = 0;
|
|
824
833
|
isScrolled = !1;
|
|
825
834
|
invokedByScrollEvent = !1;
|
|
826
|
-
padding = 32;
|
|
827
835
|
scrollOffset = 0;
|
|
828
836
|
hidePassedLines = !1;
|
|
829
837
|
resizeObserver = new ResizeObserver((e) => {
|
|
@@ -847,6 +855,8 @@ class le extends EventTarget {
|
|
|
847
855
|
damping: 20,
|
|
848
856
|
stiffness: 100
|
|
849
857
|
};
|
|
858
|
+
emUnit = Math.max(Math.min(innerHeight * 0.05, innerWidth * 0.1), 12);
|
|
859
|
+
padding = this.emUnit;
|
|
850
860
|
enableBlur = !0;
|
|
851
861
|
enableScale = !0;
|
|
852
862
|
interludeDots;
|
|
@@ -861,7 +871,7 @@ class le extends EventTarget {
|
|
|
861
871
|
size = [0, 0];
|
|
862
872
|
innerSize = [0, 0];
|
|
863
873
|
onLineClickedHandler = (e) => {
|
|
864
|
-
const t = new
|
|
874
|
+
const t = new J(
|
|
865
875
|
this.lyricLinesIndexes.get(e.line) ?? -1,
|
|
866
876
|
e.line,
|
|
867
877
|
e
|
|
@@ -906,7 +916,7 @@ class le extends EventTarget {
|
|
|
906
916
|
getEnableScale() {
|
|
907
917
|
return this.enableScale;
|
|
908
918
|
}
|
|
909
|
-
style =
|
|
919
|
+
style = U.createStyleSheet({
|
|
910
920
|
lyricPlayer: {
|
|
911
921
|
userSelect: "none",
|
|
912
922
|
fontSize: "var(--amll-lyric-player-font-size,max(min(5vh, 10vw), 12px))",
|
|
@@ -933,16 +943,13 @@ class le extends EventTarget {
|
|
|
933
943
|
maxWidth: "var(--amll-lyric-player-width,100%)",
|
|
934
944
|
minWidth: "var(--amll-lyric-player-width,100%)",
|
|
935
945
|
width: "var(--amll-lyric-player-width,100%)",
|
|
936
|
-
padding: "2vh
|
|
946
|
+
padding: "2vh 1.05em",
|
|
947
|
+
margin: "0 -1em",
|
|
937
948
|
contain: "content",
|
|
938
949
|
willChange: "filter,transform,opacity",
|
|
939
950
|
transition: "filter 0.25s, background-color 0.25s, box-shadow 0.25s",
|
|
940
|
-
boxSizing: "
|
|
951
|
+
boxSizing: "content-box",
|
|
941
952
|
borderRadius: "8px",
|
|
942
|
-
"& span": {
|
|
943
|
-
padding: "0.05em",
|
|
944
|
-
margin: "-0.05em"
|
|
945
|
-
},
|
|
946
953
|
"&:hover": {
|
|
947
954
|
backgroundColor: "var(--amll-lyric-view-hover-bg-color,#fff1)",
|
|
948
955
|
boxShadow: "0 0 0 8px var(--amll-lyric-view-hover-bg-color,#fff1)"
|
|
@@ -953,7 +960,7 @@ class le extends EventTarget {
|
|
|
953
960
|
},
|
|
954
961
|
"@media (max-width: 1024px)": {
|
|
955
962
|
lyricLine: {
|
|
956
|
-
padding: "1vh
|
|
963
|
+
padding: "1vh 1em"
|
|
957
964
|
}
|
|
958
965
|
},
|
|
959
966
|
lyricDuetLine: {
|
|
@@ -1034,7 +1041,7 @@ class le extends EventTarget {
|
|
|
1034
1041
|
this.calcLayout(!0, !0);
|
|
1035
1042
|
};
|
|
1036
1043
|
constructor() {
|
|
1037
|
-
super(), this.interludeDots = new
|
|
1044
|
+
super(), this.interludeDots = new X(this), this.bottomLine = new R(this), this.element.setAttribute("class", this.style.classes.lyricPlayer), this.disableSpring && this.element.classList.add(this.style.classes.disableSpring), this.rebuildStyle(), this.resizeObserver.observe(this.element), this.element.appendChild(this.interludeDots.getElement()), this.element.appendChild(this.bottomLine.getElement()), this.style.attach(), this.interludeDots.setTransform(0, 200), window.addEventListener("pageshow", this.onPageShow), this.element.addEventListener("wheel", (e) => {
|
|
1038
1045
|
this.allowScroll && (this.isScrolled = !0, clearTimeout(this.scrolledHandler), this.scrolledHandler = setTimeout(() => {
|
|
1039
1046
|
this.isScrolled = !1, this.scrollOffset = 0;
|
|
1040
1047
|
}, 5e3), this.invokedByScrollEvent = !0, e.deltaMode === e.DOM_DELTA_PIXEL ? (this.scrollOffset += e.deltaY, this.calcLayout(!0)) : (this.scrollOffset += e.deltaY * 50, this.calcLayout(!1)), this.invokedByScrollEvent = !1);
|
|
@@ -1176,7 +1183,7 @@ class le extends EventTarget {
|
|
|
1176
1183
|
* @param reflow 是否进行重新布局(重新计算每行歌词大小)
|
|
1177
1184
|
*/
|
|
1178
1185
|
calcLayout(e = !1, t = !1) {
|
|
1179
|
-
t && (this.lyricLinesEl.forEach((p) => {
|
|
1186
|
+
t && (this.emUnit = parseFloat(getComputedStyle(this.element).fontSize), this.lyricLinesEl.forEach((p) => {
|
|
1180
1187
|
const d = p.measureSize();
|
|
1181
1188
|
this.lyricLinesSize.set(p, d), p.lineSize = d;
|
|
1182
1189
|
}), this.interludeDotsSize[0] = this.interludeDots.getElement().clientWidth, this.interludeDotsSize[1] = this.interludeDots.getElement().clientHeight, this.bottomLine.lineSize = this.bottomLine.measureSize());
|
|
@@ -1204,13 +1211,13 @@ class le extends EventTarget {
|
|
|
1204
1211
|
let m = 0, u = 0.05, f = !1;
|
|
1205
1212
|
this.lyricLinesEl.forEach((p, d) => {
|
|
1206
1213
|
const g = this.bufferedLines.has(d), b = g || d >= this.scrollToIndex && d < c, P = p.getLine();
|
|
1207
|
-
P.isDuet && this.size[0] - (this.lyricLinesSize.get(p)?.[0] ?? 0), !f && n >= 5e3 && (d === this.scrollToIndex && i?.[2] === -2 || d === this.scrollToIndex + 1) && (f = !0, this.interludeDots.setTransform(
|
|
1208
|
-
const
|
|
1214
|
+
P.isDuet && this.size[0] - (this.lyricLinesSize.get(p)?.[0] ?? 0), !f && n >= 5e3 && (d === this.scrollToIndex && i?.[2] === -2 || d === this.scrollToIndex + 1) && (f = !0, this.interludeDots.setTransform(this.padding, s), i && this.interludeDots.setInterlude([i[0], i[1]]), s += this.interludeDotsSize[1]);
|
|
1215
|
+
const C = this.hidePassedLines && d < (i ? i[2] + 1 : this.scrollToIndex) ? 0 : g ? 1 : 1 / 3;
|
|
1209
1216
|
p.setTransform(
|
|
1210
1217
|
this.padding,
|
|
1211
1218
|
s,
|
|
1212
1219
|
b ? 1 : a,
|
|
1213
|
-
|
|
1220
|
+
C,
|
|
1214
1221
|
!this.invokedByScrollEvent && this.enableBlur ? b ? 0 : 1 + (d < this.scrollToIndex ? Math.abs(this.scrollToIndex - d) : Math.abs(d - Math.max(this.scrollToIndex, c))) : 0,
|
|
1215
1222
|
e,
|
|
1216
1223
|
m
|
|
@@ -1300,13 +1307,13 @@ class le extends EventTarget {
|
|
|
1300
1307
|
(n) => n.startTime >= e
|
|
1301
1308
|
), this.bufferedLines.clear(), this.hotLines.forEach((n) => this.bufferedLines.add(n)), this.calcLayout(!0)) : (s.size > 0 || r.size > 0) && (s.size === 0 && r.size > 0 ? (r.forEach((n) => {
|
|
1302
1309
|
this.bufferedLines.add(n), this.lyricLinesEl[n].enable();
|
|
1303
|
-
}), this.scrollToIndex = Math.min(...this.bufferedLines)) : r.size === 0 && s.size > 0 ?
|
|
1310
|
+
}), this.scrollToIndex = Math.min(...this.bufferedLines), this.calcLayout()) : r.size === 0 && s.size > 0 ? N(s, this.bufferedLines) && (this.bufferedLines.forEach((n) => {
|
|
1304
1311
|
this.hotLines.has(n) || (this.bufferedLines.delete(n), this.lyricLinesEl[n].disable());
|
|
1305
|
-
}) : (r.forEach((n) => {
|
|
1312
|
+
}), this.calcLayout()) : (r.forEach((n) => {
|
|
1306
1313
|
this.bufferedLines.add(n), this.lyricLinesEl[n].enable();
|
|
1307
1314
|
}), s.forEach((n) => {
|
|
1308
1315
|
this.bufferedLines.delete(n), this.lyricLinesEl[n].disable();
|
|
1309
|
-
}), this.bufferedLines.size > 0 && (this.scrollToIndex = Math.min(...this.bufferedLines))
|
|
1316
|
+
}), this.bufferedLines.size > 0 && (this.scrollToIndex = Math.min(...this.bufferedLines)), this.calcLayout()));
|
|
1310
1317
|
}
|
|
1311
1318
|
/**
|
|
1312
1319
|
* 更新动画,这个函数应该被逐帧调用或者在以下情况下调用一次:
|