@applemusic-like-lyrics/core 0.2.0-alpha.1 → 0.2.0-alpha.3
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/dist/amll-core.js +856 -744
- package/dist/amll-core.js.map +1 -1
- package/dist/lyric-player/{bottom-line.d.ts → dom/bottom-line.d.ts} +3 -3
- package/dist/lyric-player/dom/index.d.ts +263 -0
- package/dist/lyric-player/{interlude-dots.d.ts → dom/interlude-dots.d.ts} +2 -6
- package/dist/lyric-player/{lyric-line.d.ts → dom/lyric-line.d.ts} +2 -2
- package/dist/lyric-player/index.d.ts +5 -259
- package/dist/lyric-player/layouter.d.ts +2 -0
- package/dist/style.css +1 -1
- package/package.json +3 -1
package/dist/amll-core.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { Container as
|
|
5
|
-
import { Application as
|
|
1
|
+
var me = Object.defineProperty;
|
|
2
|
+
var fe = (d, t, e) => t in d ? me(d, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : d[t] = e;
|
|
3
|
+
var f = (d, t, e) => fe(d, typeof t != "symbol" ? t + "" : t, e);
|
|
4
|
+
import { Container as pe } from "@pixi/display";
|
|
5
|
+
import { Application as ge } from "@pixi/app";
|
|
6
6
|
import { BlurFilter as X } from "@pixi/filter-blur";
|
|
7
|
-
import { ColorMatrixFilter as
|
|
8
|
-
import { Texture as
|
|
9
|
-
import { Sprite as
|
|
10
|
-
import { BulgePinchFilter as
|
|
11
|
-
class
|
|
7
|
+
import { ColorMatrixFilter as Pt } from "@pixi/filter-color-matrix";
|
|
8
|
+
import { Texture as ue } from "@pixi/core";
|
|
9
|
+
import { Sprite as ft } from "@pixi/sprite";
|
|
10
|
+
import { BulgePinchFilter as pt } from "@pixi/filter-bulge-pinch";
|
|
11
|
+
class ye {
|
|
12
12
|
}
|
|
13
|
-
class
|
|
13
|
+
class Jt extends ye {
|
|
14
14
|
constructor(e) {
|
|
15
15
|
super();
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
f(this, "observer");
|
|
17
|
+
f(this, "flowSpeed", 4);
|
|
18
|
+
f(this, "currerntRenderScale", 0.75);
|
|
19
19
|
this.canvas = e, this.observer = new ResizeObserver(() => {
|
|
20
20
|
const s = Math.max(
|
|
21
21
|
1,
|
|
@@ -57,13 +57,13 @@ class qt extends ee {
|
|
|
57
57
|
return this.canvas;
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
|
-
function
|
|
60
|
+
function Me(d) {
|
|
61
61
|
return new Promise((t, e) => {
|
|
62
62
|
const s = document.createElement("img");
|
|
63
63
|
s.onload = () => t(s), s.onerror = e, s.src = d, s.crossOrigin = "anonymous", s.loading = "eager";
|
|
64
64
|
});
|
|
65
65
|
}
|
|
66
|
-
function
|
|
66
|
+
function Te(d) {
|
|
67
67
|
return new Promise((t, e) => {
|
|
68
68
|
const s = document.createElement("video");
|
|
69
69
|
let i = !1, n = !1, r = !1;
|
|
@@ -92,28 +92,28 @@ function ie(d) {
|
|
|
92
92
|
s.src = d, s.playsInline = !0, s.crossOrigin = "anonymous", s.autoplay = !0, s.loop = !0, s.muted = !0, s.play();
|
|
93
93
|
});
|
|
94
94
|
}
|
|
95
|
-
function
|
|
96
|
-
return t ?
|
|
95
|
+
function Qt(d, t = !1) {
|
|
96
|
+
return t ? Te(d) : Me(d);
|
|
97
97
|
}
|
|
98
|
-
function
|
|
98
|
+
function Kt(d) {
|
|
99
99
|
return new Promise((t, e) => {
|
|
100
100
|
(d instanceof HTMLImageElement ? d.complete : d.readyState >= 3) ? t(d) : (d.onload = () => t(d), d.onerror = e);
|
|
101
101
|
});
|
|
102
102
|
}
|
|
103
|
-
class
|
|
103
|
+
class xe extends pe {
|
|
104
104
|
constructor() {
|
|
105
105
|
super(...arguments);
|
|
106
|
-
|
|
106
|
+
f(this, "time", 0);
|
|
107
107
|
}
|
|
108
108
|
}
|
|
109
|
-
class
|
|
109
|
+
class Os extends Jt {
|
|
110
110
|
constructor(e) {
|
|
111
111
|
super(e);
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
112
|
+
f(this, "app");
|
|
113
|
+
f(this, "curContainer");
|
|
114
|
+
f(this, "staticMode", !1);
|
|
115
|
+
f(this, "lastContainer", /* @__PURE__ */ new Set());
|
|
116
|
+
f(this, "onTick", (e) => {
|
|
117
117
|
for (const s of this.lastContainer)
|
|
118
118
|
s.alpha = Math.max(0, s.alpha - e / 60), s.alpha <= 0 && (this.app.stage.removeChild(s), this.lastContainer.delete(s), s.destroy(!0));
|
|
119
119
|
if (this.curContainer) {
|
|
@@ -128,7 +128,7 @@ class ys extends qt {
|
|
|
128
128
|
), n.position.set(this.app.screen.width / 2, this.app.screen.height / 2), r.position.set(this.app.screen.width / 2, this.app.screen.height / 2), s.width = a * Math.sqrt(2), s.height = s.width, i.width = a * 0.8, i.height = i.width, n.width = a * 0.5, n.height = n.width, r.width = a * 0.25, r.height = r.width, this.curContainer.time += e * this.flowSpeed, s.rotation += e / 1e3 * this.flowSpeed, i.rotation -= e / 500 * this.flowSpeed, n.rotation += e / 1e3 * this.flowSpeed, r.rotation -= e / 750 * this.flowSpeed, n.x = this.app.screen.width / 2 + this.app.screen.width / 4 * Math.cos(this.curContainer.time / 1e3 * 0.75), n.y = this.app.screen.height / 2 + this.app.screen.width / 4 * Math.cos(this.curContainer.time / 1e3 * 0.75), r.x = this.app.screen.width / 2 + this.app.screen.width / 4 * 0.1 + Math.cos(this.curContainer.time * 6e-3 * 0.75), r.y = this.app.screen.height / 2 + this.app.screen.width / 4 * 0.1 + Math.cos(this.curContainer.time * 6e-3 * 0.75), this.curContainer.alpha >= 1 && this.lastContainer.size === 0 && this.staticMode && this.app.ticker.stop();
|
|
129
129
|
}
|
|
130
130
|
});
|
|
131
|
-
this.canvas = e, this.app = new
|
|
131
|
+
this.canvas = e, this.app = new ge({
|
|
132
132
|
view: e,
|
|
133
133
|
resizeTo: this.canvas,
|
|
134
134
|
powerPreference: "low-power",
|
|
@@ -143,33 +143,33 @@ class ys extends qt {
|
|
|
143
143
|
}
|
|
144
144
|
rebuildFilters() {
|
|
145
145
|
var a;
|
|
146
|
-
const e = Math.min(this.canvas.width, this.canvas.height), s = Math.max(this.canvas.width, this.canvas.height), i = new
|
|
146
|
+
const e = Math.min(this.canvas.width, this.canvas.height), s = Math.max(this.canvas.width, this.canvas.height), i = new Pt();
|
|
147
147
|
i.saturate(1.2, !1);
|
|
148
|
-
const n = new
|
|
148
|
+
const n = new Pt();
|
|
149
149
|
n.brightness(0.6, !1);
|
|
150
|
-
const r = new
|
|
150
|
+
const r = new Pt();
|
|
151
151
|
r.contrast(0.3, !0), (a = this.app.stage.filters) == null || a.forEach((c) => {
|
|
152
152
|
c.destroy();
|
|
153
153
|
}), this.app.stage.filters = [], this.app.stage.filters.push(new X(5, 1)), this.app.stage.filters.push(new X(10, 1)), this.app.stage.filters.push(new X(20, 2)), this.app.stage.filters.push(new X(40, 2)), this.app.stage.filters.push(new X(80, 2)), e > 768 && this.app.stage.filters.push(new X(160, 4)), e > 768 * 2 && this.app.stage.filters.push(new X(320, 4)), this.app.stage.filters.push(i, n, r), this.app.stage.filters.push(new X(5, 1)), Math.random() > 0.5 ? (this.app.stage.filters.push(
|
|
154
|
-
new
|
|
154
|
+
new pt({
|
|
155
155
|
radius: (s + e) / 2,
|
|
156
156
|
strength: 1,
|
|
157
157
|
center: [0.25, 1]
|
|
158
158
|
})
|
|
159
159
|
), this.app.stage.filters.push(
|
|
160
|
-
new
|
|
160
|
+
new pt({
|
|
161
161
|
radius: (s + e) / 2,
|
|
162
162
|
strength: 1,
|
|
163
163
|
center: [0.75, 0]
|
|
164
164
|
})
|
|
165
165
|
)) : (this.app.stage.filters.push(
|
|
166
|
-
new
|
|
166
|
+
new pt({
|
|
167
167
|
radius: (s + e) / 2,
|
|
168
168
|
strength: 1,
|
|
169
169
|
center: [0.75, 1]
|
|
170
170
|
})
|
|
171
171
|
), this.app.stage.filters.push(
|
|
172
|
-
new
|
|
172
|
+
new pt({
|
|
173
173
|
radius: (s + e) / 2,
|
|
174
174
|
strength: 1,
|
|
175
175
|
center: [0.25, 0]
|
|
@@ -193,13 +193,13 @@ class ys extends qt {
|
|
|
193
193
|
setHasLyric(e) {
|
|
194
194
|
}
|
|
195
195
|
async setAlbum(e, s) {
|
|
196
|
-
var
|
|
196
|
+
var m, g;
|
|
197
197
|
if (typeof e == "string" && e.trim().length === 0)
|
|
198
198
|
return;
|
|
199
199
|
let i = null, n = 5, r = null;
|
|
200
|
-
for (; !((g = (
|
|
200
|
+
for (; !((g = (m = r == null ? void 0 : r.baseTexture) == null ? void 0 : m.resource) != null && g.valid) && n > 0; )
|
|
201
201
|
try {
|
|
202
|
-
typeof e == "string" ? i = await
|
|
202
|
+
typeof e == "string" ? i = await Qt(e, s) : i = await Kt(e), r = ue.from(i, {
|
|
203
203
|
resourceOptions: {
|
|
204
204
|
autoLoad: !1
|
|
205
205
|
}
|
|
@@ -212,8 +212,8 @@ class ys extends qt {
|
|
|
212
212
|
), r = null, n--;
|
|
213
213
|
}
|
|
214
214
|
if (!r) return;
|
|
215
|
-
const a = new
|
|
216
|
-
c.anchor.set(0.5, 0.5),
|
|
215
|
+
const a = new xe(), c = new ft(r), h = new ft(r), o = new ft(r), l = new ft(r);
|
|
216
|
+
c.anchor.set(0.5, 0.5), h.anchor.set(0.5, 0.5), o.anchor.set(0.5, 0.5), l.anchor.set(0.5, 0.5), c.rotation = Math.random() * Math.PI * 2, h.rotation = Math.random() * Math.PI * 2, o.rotation = Math.random() * Math.PI * 2, l.rotation = Math.random() * Math.PI * 2, a.addChild(c, h, o, l), this.curContainer && this.lastContainer.add(this.curContainer), this.curContainer = a, this.app.stage.addChild(a), this.curContainer.alpha = 0, this.app.ticker.start();
|
|
217
217
|
}
|
|
218
218
|
dispose() {
|
|
219
219
|
super.dispose(), this.app.ticker.remove(this.onTick), this.app.destroy(!0);
|
|
@@ -222,7 +222,7 @@ class ys extends qt {
|
|
|
222
222
|
return this.canvas;
|
|
223
223
|
}
|
|
224
224
|
}
|
|
225
|
-
const
|
|
225
|
+
const O = 1e-6, Ot = new Float32Array([
|
|
226
226
|
1,
|
|
227
227
|
0,
|
|
228
228
|
0,
|
|
@@ -239,7 +239,7 @@ const q = 1e-6, zt = new Float32Array([
|
|
|
239
239
|
0,
|
|
240
240
|
0,
|
|
241
241
|
1
|
|
242
|
-
]),
|
|
242
|
+
]), q = class q extends Float32Array {
|
|
243
243
|
/**
|
|
244
244
|
* Create a {@link Mat4}.
|
|
245
245
|
*/
|
|
@@ -273,7 +273,7 @@ const q = 1e-6, zt = new Float32Array([
|
|
|
273
273
|
]) : super(e, 0, 16);
|
|
274
274
|
break;
|
|
275
275
|
default:
|
|
276
|
-
super(
|
|
276
|
+
super(Ot);
|
|
277
277
|
break;
|
|
278
278
|
}
|
|
279
279
|
}
|
|
@@ -285,7 +285,7 @@ const q = 1e-6, zt = new Float32Array([
|
|
|
285
285
|
* Equivalent to `Mat4.str(this);`
|
|
286
286
|
*/
|
|
287
287
|
get str() {
|
|
288
|
-
return
|
|
288
|
+
return q.str(this);
|
|
289
289
|
}
|
|
290
290
|
//===================
|
|
291
291
|
// Instance methods
|
|
@@ -306,7 +306,7 @@ const q = 1e-6, zt = new Float32Array([
|
|
|
306
306
|
* @returns `this`
|
|
307
307
|
*/
|
|
308
308
|
identity() {
|
|
309
|
-
return this.set(
|
|
309
|
+
return this.set(Ot), this;
|
|
310
310
|
}
|
|
311
311
|
/**
|
|
312
312
|
* Multiplies this {@link Mat4} against another one
|
|
@@ -318,7 +318,7 @@ const q = 1e-6, zt = new Float32Array([
|
|
|
318
318
|
* @returns `this`
|
|
319
319
|
*/
|
|
320
320
|
multiply(t) {
|
|
321
|
-
return
|
|
321
|
+
return q.multiply(this, this, t);
|
|
322
322
|
}
|
|
323
323
|
/**
|
|
324
324
|
* Alias for {@link Mat4.multiply}
|
|
@@ -333,7 +333,7 @@ const q = 1e-6, zt = new Float32Array([
|
|
|
333
333
|
* @returns `this`
|
|
334
334
|
*/
|
|
335
335
|
transpose() {
|
|
336
|
-
return
|
|
336
|
+
return q.transpose(this, this);
|
|
337
337
|
}
|
|
338
338
|
/**
|
|
339
339
|
* Inverts this {@link Mat4}
|
|
@@ -342,7 +342,7 @@ const q = 1e-6, zt = new Float32Array([
|
|
|
342
342
|
* @returns `this`
|
|
343
343
|
*/
|
|
344
344
|
invert() {
|
|
345
|
-
return
|
|
345
|
+
return q.invert(this, this);
|
|
346
346
|
}
|
|
347
347
|
/**
|
|
348
348
|
* Translate this {@link Mat4} by the given vector
|
|
@@ -352,7 +352,7 @@ const q = 1e-6, zt = new Float32Array([
|
|
|
352
352
|
* @returns `this`
|
|
353
353
|
*/
|
|
354
354
|
translate(t) {
|
|
355
|
-
return
|
|
355
|
+
return q.translate(this, this, t);
|
|
356
356
|
}
|
|
357
357
|
/**
|
|
358
358
|
* Rotates this {@link Mat4} by the given angle around the given axis
|
|
@@ -363,7 +363,7 @@ const q = 1e-6, zt = new Float32Array([
|
|
|
363
363
|
* @returns `out`
|
|
364
364
|
*/
|
|
365
365
|
rotate(t, e) {
|
|
366
|
-
return
|
|
366
|
+
return q.rotate(this, this, t, e);
|
|
367
367
|
}
|
|
368
368
|
/**
|
|
369
369
|
* Scales this {@link Mat4} by the dimensions in the given vec3 not using vectorization
|
|
@@ -373,7 +373,7 @@ const q = 1e-6, zt = new Float32Array([
|
|
|
373
373
|
* @returns `this`
|
|
374
374
|
*/
|
|
375
375
|
scale(t) {
|
|
376
|
-
return
|
|
376
|
+
return q.scale(this, this, t);
|
|
377
377
|
}
|
|
378
378
|
/**
|
|
379
379
|
* Rotates this {@link Mat4} by the given angle around the X axis
|
|
@@ -383,7 +383,7 @@ const q = 1e-6, zt = new Float32Array([
|
|
|
383
383
|
* @returns `this`
|
|
384
384
|
*/
|
|
385
385
|
rotateX(t) {
|
|
386
|
-
return
|
|
386
|
+
return q.rotateX(this, this, t);
|
|
387
387
|
}
|
|
388
388
|
/**
|
|
389
389
|
* Rotates this {@link Mat4} by the given angle around the Y axis
|
|
@@ -393,7 +393,7 @@ const q = 1e-6, zt = new Float32Array([
|
|
|
393
393
|
* @returns `this`
|
|
394
394
|
*/
|
|
395
395
|
rotateY(t) {
|
|
396
|
-
return
|
|
396
|
+
return q.rotateY(this, this, t);
|
|
397
397
|
}
|
|
398
398
|
/**
|
|
399
399
|
* Rotates this {@link Mat4} by the given angle around the Z axis
|
|
@@ -403,7 +403,7 @@ const q = 1e-6, zt = new Float32Array([
|
|
|
403
403
|
* @returns `this`
|
|
404
404
|
*/
|
|
405
405
|
rotateZ(t) {
|
|
406
|
-
return
|
|
406
|
+
return q.rotateZ(this, this, t);
|
|
407
407
|
}
|
|
408
408
|
/**
|
|
409
409
|
* Generates a perspective projection matrix with the given bounds.
|
|
@@ -419,7 +419,7 @@ const q = 1e-6, zt = new Float32Array([
|
|
|
419
419
|
* @returns `this`
|
|
420
420
|
*/
|
|
421
421
|
perspectiveNO(t, e, s, i) {
|
|
422
|
-
return
|
|
422
|
+
return q.perspectiveNO(this, t, e, s, i);
|
|
423
423
|
}
|
|
424
424
|
/**
|
|
425
425
|
* Generates a perspective projection matrix suitable for WebGPU with the given bounds.
|
|
@@ -435,7 +435,7 @@ const q = 1e-6, zt = new Float32Array([
|
|
|
435
435
|
* @returns `this`
|
|
436
436
|
*/
|
|
437
437
|
perspectiveZO(t, e, s, i) {
|
|
438
|
-
return
|
|
438
|
+
return q.perspectiveZO(this, t, e, s, i);
|
|
439
439
|
}
|
|
440
440
|
/**
|
|
441
441
|
* Generates a orthogonal projection matrix with the given bounds.
|
|
@@ -452,7 +452,7 @@ const q = 1e-6, zt = new Float32Array([
|
|
|
452
452
|
* @returns `this`
|
|
453
453
|
*/
|
|
454
454
|
orthoNO(t, e, s, i, n, r) {
|
|
455
|
-
return
|
|
455
|
+
return q.orthoNO(this, t, e, s, i, n, r);
|
|
456
456
|
}
|
|
457
457
|
/**
|
|
458
458
|
* Generates a orthogonal projection matrix with the given bounds.
|
|
@@ -469,7 +469,7 @@ const q = 1e-6, zt = new Float32Array([
|
|
|
469
469
|
* @returns `this`
|
|
470
470
|
*/
|
|
471
471
|
orthoZO(t, e, s, i, n, r) {
|
|
472
|
-
return
|
|
472
|
+
return q.orthoZO(this, t, e, s, i, n, r);
|
|
473
473
|
}
|
|
474
474
|
//================
|
|
475
475
|
// Static methods
|
|
@@ -481,7 +481,7 @@ const q = 1e-6, zt = new Float32Array([
|
|
|
481
481
|
* @returns A new {@link Mat4}
|
|
482
482
|
*/
|
|
483
483
|
static create() {
|
|
484
|
-
return new
|
|
484
|
+
return new q();
|
|
485
485
|
}
|
|
486
486
|
/**
|
|
487
487
|
* Creates a new {@link Mat4} initialized with values from an existing matrix
|
|
@@ -491,7 +491,7 @@ const q = 1e-6, zt = new Float32Array([
|
|
|
491
491
|
* @returns A new {@link Mat4}
|
|
492
492
|
*/
|
|
493
493
|
static clone(t) {
|
|
494
|
-
return new
|
|
494
|
+
return new q(t);
|
|
495
495
|
}
|
|
496
496
|
/**
|
|
497
497
|
* Copy the values from one {@link Mat4} to another
|
|
@@ -512,7 +512,7 @@ const q = 1e-6, zt = new Float32Array([
|
|
|
512
512
|
* @returns A new {@link Mat4}
|
|
513
513
|
*/
|
|
514
514
|
static fromValues(...t) {
|
|
515
|
-
return new
|
|
515
|
+
return new q(...t);
|
|
516
516
|
}
|
|
517
517
|
/**
|
|
518
518
|
* Set the components of a mat4 to the given values
|
|
@@ -560,9 +560,9 @@ const q = 1e-6, zt = new Float32Array([
|
|
|
560
560
|
* @returns `out` or `null` if the matrix is not invertable
|
|
561
561
|
*/
|
|
562
562
|
static invert(t, e) {
|
|
563
|
-
const s = e[0], i = e[1], n = e[2], r = e[3], a = e[4], c = e[5],
|
|
564
|
-
let
|
|
565
|
-
return
|
|
563
|
+
const s = e[0], i = e[1], n = e[2], r = e[3], a = e[4], c = e[5], h = e[6], o = e[7], l = e[8], m = e[9], g = e[10], u = e[11], M = e[12], p = e[13], T = e[14], x = e[15], L = s * c - i * a, E = s * h - n * a, b = s * o - r * a, w = i * h - n * c, S = i * o - r * c, _ = n * o - r * h, v = l * p - m * M, z = l * T - g * M, P = l * x - u * M, A = m * T - g * p, R = m * x - u * p, C = g * x - u * T;
|
|
564
|
+
let F = L * C - E * R + b * A + w * P - S * z + _ * v;
|
|
565
|
+
return F ? (F = 1 / F, t[0] = (c * C - h * R + o * A) * F, t[1] = (n * R - i * C - r * A) * F, t[2] = (p * _ - T * S + x * w) * F, t[3] = (g * S - m * _ - u * w) * F, t[4] = (h * P - a * C - o * z) * F, t[5] = (s * C - n * P + r * z) * F, t[6] = (T * b - M * _ - x * E) * F, t[7] = (l * _ - g * b + u * E) * F, t[8] = (a * R - c * P + o * v) * F, t[9] = (i * P - s * R - r * v) * F, t[10] = (M * S - p * b + x * L) * F, t[11] = (m * b - l * S - u * L) * F, t[12] = (c * z - a * A - h * v) * F, t[13] = (s * A - i * z + n * v) * F, t[14] = (p * E - M * w - T * L) * F, t[15] = (l * w - m * E + g * L) * F, t) : null;
|
|
566
566
|
}
|
|
567
567
|
/**
|
|
568
568
|
* Calculates the adjugate of a {@link Mat4}
|
|
@@ -573,8 +573,8 @@ const q = 1e-6, zt = new Float32Array([
|
|
|
573
573
|
* @returns `out`
|
|
574
574
|
*/
|
|
575
575
|
static adjoint(t, e) {
|
|
576
|
-
const s = e[0], i = e[1], n = e[2], r = e[3], a = e[4], c = e[5],
|
|
577
|
-
return t[0] = c * C -
|
|
576
|
+
const s = e[0], i = e[1], n = e[2], r = e[3], a = e[4], c = e[5], h = e[6], o = e[7], l = e[8], m = e[9], g = e[10], u = e[11], M = e[12], p = e[13], T = e[14], x = e[15], L = s * c - i * a, E = s * h - n * a, b = s * o - r * a, w = i * h - n * c, S = i * o - r * c, _ = n * o - r * h, v = l * p - m * M, z = l * T - g * M, P = l * x - u * M, A = m * T - g * p, R = m * x - u * p, C = g * x - u * T;
|
|
577
|
+
return t[0] = c * C - h * R + o * A, t[1] = n * R - i * C - r * A, t[2] = p * _ - T * S + x * w, t[3] = g * S - m * _ - u * w, t[4] = h * P - a * C - o * z, t[5] = s * C - n * P + r * z, t[6] = T * b - M * _ - x * E, t[7] = l * _ - g * b + u * E, t[8] = a * R - c * P + o * v, t[9] = i * P - s * R - r * v, t[10] = M * S - p * b + x * L, t[11] = m * b - l * S - u * L, t[12] = c * z - a * A - h * v, t[13] = s * A - i * z + n * v, t[14] = p * E - M * w - T * L, t[15] = l * w - m * E + g * L, t;
|
|
578
578
|
}
|
|
579
579
|
/**
|
|
580
580
|
* Calculates the determinant of a {@link Mat4}
|
|
@@ -584,8 +584,8 @@ const q = 1e-6, zt = new Float32Array([
|
|
|
584
584
|
* @returns determinant of a
|
|
585
585
|
*/
|
|
586
586
|
static determinant(t) {
|
|
587
|
-
const e = t[0], s = t[1], i = t[2], n = t[3], r = t[4], a = t[5], c = t[6],
|
|
588
|
-
return
|
|
587
|
+
const e = t[0], s = t[1], i = t[2], n = t[3], r = t[4], a = t[5], c = t[6], h = t[7], o = t[8], l = t[9], m = t[10], g = t[11], u = t[12], M = t[13], p = t[14], T = t[15], x = e * a - s * r, L = e * c - i * r, E = s * c - i * a, b = o * M - l * u, w = o * p - m * u, S = l * p - m * M, _ = e * S - s * w + i * b, v = r * S - a * w + c * b, z = o * E - l * L + m * x, P = u * E - M * L + p * x;
|
|
588
|
+
return h * _ - n * v + T * z - g * P;
|
|
589
589
|
}
|
|
590
590
|
/**
|
|
591
591
|
* Multiplies two {@link Mat4}s
|
|
@@ -597,9 +597,9 @@ const q = 1e-6, zt = new Float32Array([
|
|
|
597
597
|
* @returns `out`
|
|
598
598
|
*/
|
|
599
599
|
static multiply(t, e, s) {
|
|
600
|
-
const i = e[0], n = e[1], r = e[2], a = e[3], c = e[4],
|
|
601
|
-
let
|
|
602
|
-
return t[0] =
|
|
600
|
+
const i = e[0], n = e[1], r = e[2], a = e[3], c = e[4], h = e[5], o = e[6], l = e[7], m = e[8], g = e[9], u = e[10], M = e[11], p = e[12], T = e[13], x = e[14], L = e[15];
|
|
601
|
+
let E = s[0], b = s[1], w = s[2], S = s[3];
|
|
602
|
+
return t[0] = E * i + b * c + w * m + S * p, t[1] = E * n + b * h + w * g + S * T, t[2] = E * r + b * o + w * u + S * x, t[3] = E * a + b * l + w * M + S * L, E = s[4], b = s[5], w = s[6], S = s[7], t[4] = E * i + b * c + w * m + S * p, t[5] = E * n + b * h + w * g + S * T, t[6] = E * r + b * o + w * u + S * x, t[7] = E * a + b * l + w * M + S * L, E = s[8], b = s[9], w = s[10], S = s[11], t[8] = E * i + b * c + w * m + S * p, t[9] = E * n + b * h + w * g + S * T, t[10] = E * r + b * o + w * u + S * x, t[11] = E * a + b * l + w * M + S * L, E = s[12], b = s[13], w = s[14], S = s[15], t[12] = E * i + b * c + w * m + S * p, t[13] = E * n + b * h + w * g + S * T, t[14] = E * r + b * o + w * u + S * x, t[15] = E * a + b * l + w * M + S * L, t;
|
|
603
603
|
}
|
|
604
604
|
/**
|
|
605
605
|
* Alias for {@link Mat4.multiply}
|
|
@@ -622,8 +622,8 @@ const q = 1e-6, zt = new Float32Array([
|
|
|
622
622
|
if (e === t)
|
|
623
623
|
t[12] = e[0] * i + e[4] * n + e[8] * r + e[12], t[13] = e[1] * i + e[5] * n + e[9] * r + e[13], t[14] = e[2] * i + e[6] * n + e[10] * r + e[14], t[15] = e[3] * i + e[7] * n + e[11] * r + e[15];
|
|
624
624
|
else {
|
|
625
|
-
const a = e[0], c = e[1],
|
|
626
|
-
t[0] = a, t[1] = c, t[2] =
|
|
625
|
+
const a = e[0], c = e[1], h = e[2], o = e[3], l = e[4], m = e[5], g = e[6], u = e[7], M = e[8], p = e[9], T = e[10], x = e[11];
|
|
626
|
+
t[0] = a, t[1] = c, t[2] = h, t[3] = o, t[4] = l, t[5] = m, t[6] = g, t[7] = u, t[8] = M, t[9] = p, t[10] = T, t[11] = x, t[12] = a * i + l * n + M * r + e[12], t[13] = c * i + m * n + p * r + e[13], t[14] = h * i + g * n + T * r + e[14], t[15] = o * i + u * n + x * r + e[15];
|
|
627
627
|
}
|
|
628
628
|
return t;
|
|
629
629
|
}
|
|
@@ -652,11 +652,11 @@ const q = 1e-6, zt = new Float32Array([
|
|
|
652
652
|
*/
|
|
653
653
|
static rotate(t, e, s, i) {
|
|
654
654
|
let n = i[0], r = i[1], a = i[2], c = Math.sqrt(n * n + r * r + a * a);
|
|
655
|
-
if (c <
|
|
655
|
+
if (c < O)
|
|
656
656
|
return null;
|
|
657
657
|
c = 1 / c, n *= c, r *= c, a *= c;
|
|
658
|
-
const
|
|
659
|
-
return t[0] =
|
|
658
|
+
const h = Math.sin(s), o = Math.cos(s), l = 1 - o, m = e[0], g = e[1], u = e[2], M = e[3], p = e[4], T = e[5], x = e[6], L = e[7], E = e[8], b = e[9], w = e[10], S = e[11], _ = n * n * l + o, v = r * n * l + a * h, z = a * n * l - r * h, P = n * r * l - a * h, A = r * r * l + o, R = a * r * l + n * h, C = n * a * l + r * h, F = r * a * l - n * h, W = a * a * l + o;
|
|
659
|
+
return t[0] = m * _ + p * v + E * z, t[1] = g * _ + T * v + b * z, t[2] = u * _ + x * v + w * z, t[3] = M * _ + L * v + S * z, t[4] = m * P + p * A + E * R, t[5] = g * P + T * A + b * R, t[6] = u * P + x * A + w * R, t[7] = M * P + L * A + S * R, t[8] = m * C + p * F + E * W, t[9] = g * C + T * F + b * W, t[10] = u * C + x * F + w * W, t[11] = M * C + L * F + S * W, e !== t && (t[12] = e[12], t[13] = e[13], t[14] = e[14], t[15] = e[15]), t;
|
|
660
660
|
}
|
|
661
661
|
/**
|
|
662
662
|
* Rotates a matrix by the given angle around the X axis
|
|
@@ -668,8 +668,8 @@ const q = 1e-6, zt = new Float32Array([
|
|
|
668
668
|
* @returns `out`
|
|
669
669
|
*/
|
|
670
670
|
static rotateX(t, e, s) {
|
|
671
|
-
let i = Math.sin(s), n = Math.cos(s), r = e[4], a = e[5], c = e[6],
|
|
672
|
-
return e !== t && (t[0] = e[0], t[1] = e[1], t[2] = e[2], t[3] = e[3], t[12] = e[12], t[13] = e[13], t[14] = e[14], t[15] = e[15]), t[4] = r * n +
|
|
671
|
+
let i = Math.sin(s), n = Math.cos(s), r = e[4], a = e[5], c = e[6], h = e[7], o = e[8], l = e[9], m = e[10], g = e[11];
|
|
672
|
+
return e !== t && (t[0] = e[0], t[1] = e[1], t[2] = e[2], t[3] = e[3], t[12] = e[12], t[13] = e[13], t[14] = e[14], t[15] = e[15]), t[4] = r * n + o * i, t[5] = a * n + l * i, t[6] = c * n + m * i, t[7] = h * n + g * i, t[8] = o * n - r * i, t[9] = l * n - a * i, t[10] = m * n - c * i, t[11] = g * n - h * i, t;
|
|
673
673
|
}
|
|
674
674
|
/**
|
|
675
675
|
* Rotates a matrix by the given angle around the Y axis
|
|
@@ -681,8 +681,8 @@ const q = 1e-6, zt = new Float32Array([
|
|
|
681
681
|
* @returns `out`
|
|
682
682
|
*/
|
|
683
683
|
static rotateY(t, e, s) {
|
|
684
|
-
let i = Math.sin(s), n = Math.cos(s), r = e[0], a = e[1], c = e[2],
|
|
685
|
-
return e !== t && (t[4] = e[4], t[5] = e[5], t[6] = e[6], t[7] = e[7], t[12] = e[12], t[13] = e[13], t[14] = e[14], t[15] = e[15]), t[0] = r * n -
|
|
684
|
+
let i = Math.sin(s), n = Math.cos(s), r = e[0], a = e[1], c = e[2], h = e[3], o = e[8], l = e[9], m = e[10], g = e[11];
|
|
685
|
+
return e !== t && (t[4] = e[4], t[5] = e[5], t[6] = e[6], t[7] = e[7], t[12] = e[12], t[13] = e[13], t[14] = e[14], t[15] = e[15]), t[0] = r * n - o * i, t[1] = a * n - l * i, t[2] = c * n - m * i, t[3] = h * n - g * i, t[8] = r * i + o * n, t[9] = a * i + l * n, t[10] = c * i + m * n, t[11] = h * i + g * n, t;
|
|
686
686
|
}
|
|
687
687
|
/**
|
|
688
688
|
* Rotates a matrix by the given angle around the Z axis
|
|
@@ -694,8 +694,8 @@ const q = 1e-6, zt = new Float32Array([
|
|
|
694
694
|
* @returns `out`
|
|
695
695
|
*/
|
|
696
696
|
static rotateZ(t, e, s) {
|
|
697
|
-
let i = Math.sin(s), n = Math.cos(s), r = e[0], a = e[1], c = e[2],
|
|
698
|
-
return e !== t && (t[8] = e[8], t[9] = e[9], t[10] = e[10], t[11] = e[11], t[12] = e[12], t[13] = e[13], t[14] = e[14], t[15] = e[15]), t[0] = r * n +
|
|
697
|
+
let i = Math.sin(s), n = Math.cos(s), r = e[0], a = e[1], c = e[2], h = e[3], o = e[4], l = e[5], m = e[6], g = e[7];
|
|
698
|
+
return e !== t && (t[8] = e[8], t[9] = e[9], t[10] = e[10], t[11] = e[11], t[12] = e[12], t[13] = e[13], t[14] = e[14], t[15] = e[15]), t[0] = r * n + o * i, t[1] = a * n + l * i, t[2] = c * n + m * i, t[3] = h * n + g * i, t[4] = o * n - r * i, t[5] = l * n - a * i, t[6] = m * n - c * i, t[7] = g * n - h * i, t;
|
|
699
699
|
}
|
|
700
700
|
/**
|
|
701
701
|
* Creates a {@link Mat4} from a vector translation
|
|
@@ -742,11 +742,11 @@ const q = 1e-6, zt = new Float32Array([
|
|
|
742
742
|
*/
|
|
743
743
|
static fromRotation(t, e, s) {
|
|
744
744
|
let i = s[0], n = s[1], r = s[2], a = Math.sqrt(i * i + n * n + r * r);
|
|
745
|
-
if (a <
|
|
745
|
+
if (a < O)
|
|
746
746
|
return null;
|
|
747
747
|
a = 1 / a, i *= a, n *= a, r *= a;
|
|
748
|
-
const c = Math.sin(e),
|
|
749
|
-
return t[0] = i * i *
|
|
748
|
+
const c = Math.sin(e), h = Math.cos(e), o = 1 - h;
|
|
749
|
+
return t[0] = i * i * o + h, t[1] = n * i * o + r * c, t[2] = r * i * o - n * c, t[3] = 0, t[4] = i * n * o - r * c, t[5] = n * n * o + h, t[6] = r * n * o + i * c, t[7] = 0, t[8] = i * r * o + n * c, t[9] = n * r * o - i * c, t[10] = r * r * o + h, t[11] = 0, t[12] = 0, t[13] = 0, t[14] = 0, t[15] = 1, t;
|
|
750
750
|
}
|
|
751
751
|
/**
|
|
752
752
|
* Creates a matrix from the given angle around the X axis
|
|
@@ -813,8 +813,8 @@ const q = 1e-6, zt = new Float32Array([
|
|
|
813
813
|
* @returns `out`
|
|
814
814
|
*/
|
|
815
815
|
static fromRotationTranslation(t, e, s) {
|
|
816
|
-
const i = e[0], n = e[1], r = e[2], a = e[3], c = i + i,
|
|
817
|
-
return t[0] = 1 - (u + p), t[1] =
|
|
816
|
+
const i = e[0], n = e[1], r = e[2], a = e[3], c = i + i, h = n + n, o = r + r, l = i * c, m = i * h, g = i * o, u = n * h, M = n * o, p = r * o, T = a * c, x = a * h, L = a * o;
|
|
817
|
+
return t[0] = 1 - (u + p), t[1] = m + L, t[2] = g - x, t[3] = 0, t[4] = m - L, t[5] = 1 - (l + p), t[6] = M + T, t[7] = 0, t[8] = g + x, t[9] = M - T, t[10] = 1 - (l + u), t[11] = 0, t[12] = s[0], t[13] = s[1], t[14] = s[2], t[15] = 1, t;
|
|
818
818
|
}
|
|
819
819
|
/**
|
|
820
820
|
* Sets a {@link Mat4} from a {@link Quat2}.
|
|
@@ -825,9 +825,9 @@ const q = 1e-6, zt = new Float32Array([
|
|
|
825
825
|
* @returns `out`
|
|
826
826
|
*/
|
|
827
827
|
static fromQuat2(t, e) {
|
|
828
|
-
const s = -e[0], i = -e[1], n = -e[2], r = e[3], a = e[4], c = e[5],
|
|
828
|
+
const s = -e[0], i = -e[1], n = -e[2], r = e[3], a = e[4], c = e[5], h = e[6], o = e[7];
|
|
829
829
|
let l = s * s + i * i + n * n + r * r;
|
|
830
|
-
return l > 0 ? (V[0] = (a * r +
|
|
830
|
+
return l > 0 ? (V[0] = (a * r + o * s + c * n - h * i) * 2 / l, V[1] = (c * r + o * i + h * s - a * n) * 2 / l, V[2] = (h * r + o * n + a * i - c * s) * 2 / l) : (V[0] = (a * r + o * s + c * n - h * i) * 2, V[1] = (c * r + o * i + h * s - a * n) * 2, V[2] = (h * r + o * n + a * i - c * s) * 2), q.fromRotationTranslation(t, e, V), t;
|
|
831
831
|
}
|
|
832
832
|
/**
|
|
833
833
|
* Calculates a {@link Mat4} normal matrix (transpose inverse) from a {@link Mat4}
|
|
@@ -838,9 +838,9 @@ const q = 1e-6, zt = new Float32Array([
|
|
|
838
838
|
* @returns `out` or `null` if the matrix is not invertable
|
|
839
839
|
*/
|
|
840
840
|
static normalFromMat4(t, e) {
|
|
841
|
-
const s = e[0], i = e[1], n = e[2], r = e[3], a = e[4], c = e[5],
|
|
842
|
-
let
|
|
843
|
-
return
|
|
841
|
+
const s = e[0], i = e[1], n = e[2], r = e[3], a = e[4], c = e[5], h = e[6], o = e[7], l = e[8], m = e[9], g = e[10], u = e[11], M = e[12], p = e[13], T = e[14], x = e[15], L = s * c - i * a, E = s * h - n * a, b = s * o - r * a, w = i * h - n * c, S = i * o - r * c, _ = n * o - r * h, v = l * p - m * M, z = l * T - g * M, P = l * x - u * M, A = m * T - g * p, R = m * x - u * p, C = g * x - u * T;
|
|
842
|
+
let F = L * C - E * R + b * A + w * P - S * z + _ * v;
|
|
843
|
+
return F ? (F = 1 / F, t[0] = (c * C - h * R + o * A) * F, t[1] = (h * P - a * C - o * z) * F, t[2] = (a * R - c * P + o * v) * F, t[3] = 0, t[4] = (n * R - i * C - r * A) * F, t[5] = (s * C - n * P + r * z) * F, t[6] = (i * P - s * R - r * v) * F, t[7] = 0, t[8] = (p * _ - T * S + x * w) * F, t[9] = (T * b - M * _ - x * E) * F, t[10] = (M * S - p * b + x * L) * F, t[11] = 0, t[12] = 0, t[13] = 0, t[14] = 0, t[15] = 1, t) : null;
|
|
844
844
|
}
|
|
845
845
|
/**
|
|
846
846
|
* Calculates a {@link Mat4} normal matrix (transpose inverse) from a {@link Mat4}
|
|
@@ -854,8 +854,8 @@ const q = 1e-6, zt = new Float32Array([
|
|
|
854
854
|
* @returns `out`
|
|
855
855
|
*/
|
|
856
856
|
static normalFromMat4Fast(t, e) {
|
|
857
|
-
const s = e[0], i = e[1], n = e[2], r = e[4], a = e[5], c = e[6],
|
|
858
|
-
return t[0] = a * l - l *
|
|
857
|
+
const s = e[0], i = e[1], n = e[2], r = e[4], a = e[5], c = e[6], h = e[8], o = e[9], l = e[10];
|
|
858
|
+
return t[0] = a * l - l * o, t[1] = c * h - h * l, t[2] = r * o - o * h, t[3] = 0, t[4] = o * n - l * i, t[5] = l * s - h * n, t[6] = h * i - o * s, t[7] = 0, t[8] = i * c - n * a, t[9] = n * r - s * c, t[10] = s * a - i * r, t[11] = 0, t[12] = 0, t[13] = 0, t[14] = 0, t[15] = 1, t;
|
|
859
859
|
}
|
|
860
860
|
/**
|
|
861
861
|
* Returns the translation vector component of a transformation
|
|
@@ -884,8 +884,8 @@ const q = 1e-6, zt = new Float32Array([
|
|
|
884
884
|
* @return {vec3} out
|
|
885
885
|
*/
|
|
886
886
|
static getScaling(t, e) {
|
|
887
|
-
const s = e[0], i = e[1], n = e[2], r = e[4], a = e[5], c = e[6],
|
|
888
|
-
return t[0] = Math.sqrt(s * s + i * i + n * n), t[1] = Math.sqrt(r * r + a * a + c * c), t[2] = Math.sqrt(
|
|
887
|
+
const s = e[0], i = e[1], n = e[2], r = e[4], a = e[5], c = e[6], h = e[8], o = e[9], l = e[10];
|
|
888
|
+
return t[0] = Math.sqrt(s * s + i * i + n * n), t[1] = Math.sqrt(r * r + a * a + c * c), t[2] = Math.sqrt(h * h + o * o + l * l), t;
|
|
889
889
|
}
|
|
890
890
|
/**
|
|
891
891
|
* Returns a quaternion representing the rotational component
|
|
@@ -899,10 +899,10 @@ const q = 1e-6, zt = new Float32Array([
|
|
|
899
899
|
* @return `out`
|
|
900
900
|
*/
|
|
901
901
|
static getRotation(t, e) {
|
|
902
|
-
|
|
903
|
-
const s = 1 / V[0], i = 1 / V[1], n = 1 / V[2], r = e[0] * s, a = e[1] * i, c = e[2] * n,
|
|
902
|
+
q.getScaling(V, e);
|
|
903
|
+
const s = 1 / V[0], i = 1 / V[1], n = 1 / V[2], r = e[0] * s, a = e[1] * i, c = e[2] * n, h = e[4] * s, o = e[5] * i, l = e[6] * n, m = e[8] * s, g = e[9] * i, u = e[10] * n, M = r + o + u;
|
|
904
904
|
let p = 0;
|
|
905
|
-
return M > 0 ? (p = Math.sqrt(M + 1) * 2, t[3] = 0.25 * p, t[0] = (l - g) / p, t[1] = (
|
|
905
|
+
return M > 0 ? (p = Math.sqrt(M + 1) * 2, t[3] = 0.25 * p, t[0] = (l - g) / p, t[1] = (m - c) / p, t[2] = (a - h) / p) : r > o && r > u ? (p = Math.sqrt(1 + r - o - u) * 2, t[3] = (l - g) / p, t[0] = 0.25 * p, t[1] = (a + h) / p, t[2] = (m + c) / p) : o > u ? (p = Math.sqrt(1 + o - r - u) * 2, t[3] = (m - c) / p, t[0] = (a + h) / p, t[1] = 0.25 * p, t[2] = (l + g) / p) : (p = Math.sqrt(1 + u - r - o) * 2, t[3] = (a - h) / p, t[0] = (m + c) / p, t[1] = (l + g) / p, t[2] = 0.25 * p), t;
|
|
906
906
|
}
|
|
907
907
|
/**
|
|
908
908
|
* Decomposes a transformation matrix into its rotation, translation
|
|
@@ -917,11 +917,11 @@ const q = 1e-6, zt = new Float32Array([
|
|
|
917
917
|
*/
|
|
918
918
|
static decompose(t, e, s, i) {
|
|
919
919
|
e[0] = i[12], e[1] = i[13], e[2] = i[14];
|
|
920
|
-
const n = i[0], r = i[1], a = i[2], c = i[4],
|
|
921
|
-
s[0] = Math.sqrt(n * n + r * r + a * a), s[1] = Math.sqrt(c * c +
|
|
922
|
-
const u = 1 / s[0], M = 1 / s[1], p = 1 / s[2], T = n * u, x = r * M, L = a * p,
|
|
923
|
-
let
|
|
924
|
-
return
|
|
920
|
+
const n = i[0], r = i[1], a = i[2], c = i[4], h = i[5], o = i[6], l = i[8], m = i[9], g = i[10];
|
|
921
|
+
s[0] = Math.sqrt(n * n + r * r + a * a), s[1] = Math.sqrt(c * c + h * h + o * o), s[2] = Math.sqrt(l * l + m * m + g * g);
|
|
922
|
+
const u = 1 / s[0], M = 1 / s[1], p = 1 / s[2], T = n * u, x = r * M, L = a * p, E = c * u, b = h * M, w = o * p, S = l * u, _ = m * M, v = g * p, z = T + b + v;
|
|
923
|
+
let P = 0;
|
|
924
|
+
return z > 0 ? (P = Math.sqrt(z + 1) * 2, t[3] = 0.25 * P, t[0] = (w - _) / P, t[1] = (S - L) / P, t[2] = (x - E) / P) : T > b && T > v ? (P = Math.sqrt(1 + T - b - v) * 2, t[3] = (w - _) / P, t[0] = 0.25 * P, t[1] = (x + E) / P, t[2] = (S + L) / P) : b > v ? (P = Math.sqrt(1 + b - T - v) * 2, t[3] = (S - L) / P, t[0] = (x + E) / P, t[1] = 0.25 * P, t[2] = (w + _) / P) : (P = Math.sqrt(1 + v - T - b) * 2, t[3] = (x - E) / P, t[0] = (S + L) / P, t[1] = (w + _) / P, t[2] = 0.25 * P), t;
|
|
925
925
|
}
|
|
926
926
|
/**
|
|
927
927
|
* Creates a matrix from a quaternion rotation, vector translation and vector scale
|
|
@@ -942,8 +942,8 @@ const q = 1e-6, zt = new Float32Array([
|
|
|
942
942
|
* @returns `out`
|
|
943
943
|
*/
|
|
944
944
|
static fromRotationTranslationScale(t, e, s, i) {
|
|
945
|
-
const n = e[0], r = e[1], a = e[2], c = e[3],
|
|
946
|
-
return t[0] = (1 - (M + T)) *
|
|
945
|
+
const n = e[0], r = e[1], a = e[2], c = e[3], h = n + n, o = r + r, l = a + a, m = n * h, g = n * o, u = n * l, M = r * o, p = r * l, T = a * l, x = c * h, L = c * o, E = c * l, b = i[0], w = i[1], S = i[2];
|
|
946
|
+
return t[0] = (1 - (M + T)) * b, t[1] = (g + E) * b, t[2] = (u - L) * b, t[3] = 0, t[4] = (g - E) * w, t[5] = (1 - (m + T)) * w, t[6] = (p + x) * w, t[7] = 0, t[8] = (u + L) * S, t[9] = (p - x) * S, t[10] = (1 - (m + M)) * S, t[11] = 0, t[12] = s[0], t[13] = s[1], t[14] = s[2], t[15] = 1, t;
|
|
947
947
|
}
|
|
948
948
|
/**
|
|
949
949
|
* Creates a matrix from a quaternion rotation, vector translation and vector scale, rotating and scaling around the given origin
|
|
@@ -967,8 +967,8 @@ const q = 1e-6, zt = new Float32Array([
|
|
|
967
967
|
* @returns `out`
|
|
968
968
|
*/
|
|
969
969
|
static fromRotationTranslationScaleOrigin(t, e, s, i, n) {
|
|
970
|
-
const r = e[0], a = e[1], c = e[2],
|
|
971
|
-
return t[0] =
|
|
970
|
+
const r = e[0], a = e[1], c = e[2], h = e[3], o = r + r, l = a + a, m = c + c, g = r * o, u = r * l, M = r * m, p = a * l, T = a * m, x = c * m, L = h * o, E = h * l, b = h * m, w = i[0], S = i[1], _ = i[2], v = n[0], z = n[1], P = n[2], A = (1 - (p + x)) * w, R = (u + b) * w, C = (M - E) * w, F = (u - b) * S, W = (1 - (g + x)) * S, at = (T + L) * S, ct = (M + E) * _, Ct = (T - L) * _, Bt = (1 - (g + p)) * _;
|
|
971
|
+
return t[0] = A, t[1] = R, t[2] = C, t[3] = 0, t[4] = F, t[5] = W, t[6] = at, t[7] = 0, t[8] = ct, t[9] = Ct, t[10] = Bt, t[11] = 0, t[12] = s[0] + v - (A * v + F * z + ct * P), t[13] = s[1] + z - (R * v + W * z + Ct * P), t[14] = s[2] + P - (C * v + at * z + Bt * P), t[15] = 1, t;
|
|
972
972
|
}
|
|
973
973
|
/**
|
|
974
974
|
* Calculates a 4x4 matrix from the given quaternion
|
|
@@ -979,8 +979,8 @@ const q = 1e-6, zt = new Float32Array([
|
|
|
979
979
|
* @returns `out`
|
|
980
980
|
*/
|
|
981
981
|
static fromQuat(t, e) {
|
|
982
|
-
const s = e[0], i = e[1], n = e[2], r = e[3], a = s + s, c = i + i,
|
|
983
|
-
return t[0] = 1 -
|
|
982
|
+
const s = e[0], i = e[1], n = e[2], r = e[3], a = s + s, c = i + i, h = n + n, o = s * a, l = i * a, m = i * c, g = n * a, u = n * c, M = n * h, p = r * a, T = r * c, x = r * h;
|
|
983
|
+
return t[0] = 1 - m - M, t[1] = l + x, t[2] = g - T, t[3] = 0, t[4] = l - x, t[5] = 1 - o - M, t[6] = u + p, t[7] = 0, t[8] = g + T, t[9] = u - p, t[10] = 1 - o - m, t[11] = 0, t[12] = 0, t[13] = 0, t[14] = 0, t[15] = 1, t;
|
|
984
984
|
}
|
|
985
985
|
/**
|
|
986
986
|
* Generates a frustum matrix with the given bounds
|
|
@@ -999,10 +999,10 @@ const q = 1e-6, zt = new Float32Array([
|
|
|
999
999
|
* @returns `out`
|
|
1000
1000
|
*/
|
|
1001
1001
|
static frustumNO(t, e, s, i, n, r, a = 1 / 0) {
|
|
1002
|
-
const c = 1 / (s - e),
|
|
1003
|
-
if (t[0] = r * 2 * c, t[1] = 0, t[2] = 0, t[3] = 0, t[4] = 0, t[5] = r * 2 *
|
|
1004
|
-
const
|
|
1005
|
-
t[10] = (a + r) *
|
|
1002
|
+
const c = 1 / (s - e), h = 1 / (n - i);
|
|
1003
|
+
if (t[0] = r * 2 * c, t[1] = 0, t[2] = 0, t[3] = 0, t[4] = 0, t[5] = r * 2 * h, t[6] = 0, t[7] = 0, t[8] = (s + e) * c, t[9] = (n + i) * h, t[11] = -1, t[12] = 0, t[13] = 0, t[15] = 0, a != null && a !== 1 / 0) {
|
|
1004
|
+
const o = 1 / (r - a);
|
|
1005
|
+
t[10] = (a + r) * o, t[14] = 2 * a * r * o;
|
|
1006
1006
|
} else
|
|
1007
1007
|
t[10] = -1, t[14] = -2 * r;
|
|
1008
1008
|
return t;
|
|
@@ -1032,10 +1032,10 @@ const q = 1e-6, zt = new Float32Array([
|
|
|
1032
1032
|
* @returns `out`
|
|
1033
1033
|
*/
|
|
1034
1034
|
static frustumZO(t, e, s, i, n, r, a = 1 / 0) {
|
|
1035
|
-
const c = 1 / (s - e),
|
|
1036
|
-
if (t[0] = r * 2 * c, t[1] = 0, t[2] = 0, t[3] = 0, t[4] = 0, t[5] = r * 2 *
|
|
1037
|
-
const
|
|
1038
|
-
t[10] = a *
|
|
1035
|
+
const c = 1 / (s - e), h = 1 / (n - i);
|
|
1036
|
+
if (t[0] = r * 2 * c, t[1] = 0, t[2] = 0, t[3] = 0, t[4] = 0, t[5] = r * 2 * h, t[6] = 0, t[7] = 0, t[8] = (s + e) * c, t[9] = (n + i) * h, t[11] = -1, t[12] = 0, t[13] = 0, t[15] = 0, a != null && a !== 1 / 0) {
|
|
1037
|
+
const o = 1 / (r - a);
|
|
1038
|
+
t[10] = a * o, t[14] = a * r * o;
|
|
1039
1039
|
} else
|
|
1040
1040
|
t[10] = -1, t[14] = -r;
|
|
1041
1041
|
return t;
|
|
@@ -1108,8 +1108,8 @@ const q = 1e-6, zt = new Float32Array([
|
|
|
1108
1108
|
* @deprecated
|
|
1109
1109
|
*/
|
|
1110
1110
|
static perspectiveFromFieldOfView(t, e, s, i) {
|
|
1111
|
-
const n = Math.tan(e.upDegrees * Math.PI / 180), r = Math.tan(e.downDegrees * Math.PI / 180), a = Math.tan(e.leftDegrees * Math.PI / 180), c = Math.tan(e.rightDegrees * Math.PI / 180),
|
|
1112
|
-
return t[0] =
|
|
1111
|
+
const n = Math.tan(e.upDegrees * Math.PI / 180), r = Math.tan(e.downDegrees * Math.PI / 180), a = Math.tan(e.leftDegrees * Math.PI / 180), c = Math.tan(e.rightDegrees * Math.PI / 180), h = 2 / (a + c), o = 2 / (n + r);
|
|
1112
|
+
return t[0] = h, t[1] = 0, t[2] = 0, t[3] = 0, t[4] = 0, t[5] = o, t[6] = 0, t[7] = 0, t[8] = -((a - c) * h * 0.5), t[9] = (n - r) * o * 0.5, t[10] = i / (s - i), t[11] = -1, t[12] = 0, t[13] = 0, t[14] = i * s / (s - i), t[15] = 0, t;
|
|
1113
1113
|
}
|
|
1114
1114
|
/**
|
|
1115
1115
|
* Generates a orthogonal projection matrix with the given bounds.
|
|
@@ -1127,8 +1127,8 @@ const q = 1e-6, zt = new Float32Array([
|
|
|
1127
1127
|
* @returns `out`
|
|
1128
1128
|
*/
|
|
1129
1129
|
static orthoNO(t, e, s, i, n, r, a) {
|
|
1130
|
-
const c = 1 / (e - s),
|
|
1131
|
-
return t[0] = -2 * c, t[1] = 0, t[2] = 0, t[3] = 0, t[4] = 0, t[5] = -2 *
|
|
1130
|
+
const c = 1 / (e - s), h = 1 / (i - n), o = 1 / (r - a);
|
|
1131
|
+
return t[0] = -2 * c, t[1] = 0, t[2] = 0, t[3] = 0, t[4] = 0, t[5] = -2 * h, t[6] = 0, t[7] = 0, t[8] = 0, t[9] = 0, t[10] = 2 * o, t[11] = 0, t[12] = (e + s) * c, t[13] = (n + i) * h, t[14] = (a + r) * o, t[15] = 1, t;
|
|
1132
1132
|
}
|
|
1133
1133
|
/**
|
|
1134
1134
|
* Alias for {@link Mat4.orthoNO}
|
|
@@ -1154,8 +1154,8 @@ const q = 1e-6, zt = new Float32Array([
|
|
|
1154
1154
|
* @returns `out`
|
|
1155
1155
|
*/
|
|
1156
1156
|
static orthoZO(t, e, s, i, n, r, a) {
|
|
1157
|
-
const c = 1 / (e - s),
|
|
1158
|
-
return t[0] = -2 * c, t[1] = 0, t[2] = 0, t[3] = 0, t[4] = 0, t[5] = -2 *
|
|
1157
|
+
const c = 1 / (e - s), h = 1 / (i - n), o = 1 / (r - a);
|
|
1158
|
+
return t[0] = -2 * c, t[1] = 0, t[2] = 0, t[3] = 0, t[4] = 0, t[5] = -2 * h, t[6] = 0, t[7] = 0, t[8] = 0, t[9] = 0, t[10] = o, t[11] = 0, t[12] = (e + s) * c, t[13] = (n + i) * h, t[14] = r * o, t[15] = 1, t;
|
|
1159
1159
|
}
|
|
1160
1160
|
/**
|
|
1161
1161
|
* Generates a look-at matrix with the given eye position, focal point, and up axis.
|
|
@@ -1169,15 +1169,15 @@ const q = 1e-6, zt = new Float32Array([
|
|
|
1169
1169
|
* @returns `out`
|
|
1170
1170
|
*/
|
|
1171
1171
|
static lookAt(t, e, s, i) {
|
|
1172
|
-
const n = e[0], r = e[1], a = e[2], c = i[0],
|
|
1173
|
-
if (Math.abs(n - l) <
|
|
1174
|
-
return
|
|
1175
|
-
let u = n - l, M = r -
|
|
1172
|
+
const n = e[0], r = e[1], a = e[2], c = i[0], h = i[1], o = i[2], l = s[0], m = s[1], g = s[2];
|
|
1173
|
+
if (Math.abs(n - l) < O && Math.abs(r - m) < O && Math.abs(a - g) < O)
|
|
1174
|
+
return q.identity(t);
|
|
1175
|
+
let u = n - l, M = r - m, p = a - g, T = 1 / Math.sqrt(u * u + M * M + p * p);
|
|
1176
1176
|
u *= T, M *= T, p *= T;
|
|
1177
|
-
let x =
|
|
1178
|
-
T = Math.sqrt(x * x + L * L +
|
|
1179
|
-
let
|
|
1180
|
-
return T = Math.sqrt(
|
|
1177
|
+
let x = h * p - o * M, L = o * u - c * p, E = c * M - h * u;
|
|
1178
|
+
T = Math.sqrt(x * x + L * L + E * E), T ? (T = 1 / T, x *= T, L *= T, E *= T) : (x = 0, L = 0, E = 0);
|
|
1179
|
+
let b = M * E - p * L, w = p * x - u * E, S = u * L - M * x;
|
|
1180
|
+
return T = Math.sqrt(b * b + w * w + S * S), T ? (T = 1 / T, b *= T, w *= T, S *= T) : (b = 0, w = 0, S = 0), t[0] = x, t[1] = b, t[2] = u, t[3] = 0, t[4] = L, t[5] = w, t[6] = M, t[7] = 0, t[8] = E, t[9] = S, t[10] = p, t[11] = 0, t[12] = -(x * n + L * r + E * a), t[13] = -(b * n + w * r + S * a), t[14] = -(u * n + M * r + p * a), t[15] = 1, t;
|
|
1181
1181
|
}
|
|
1182
1182
|
/**
|
|
1183
1183
|
* Generates a matrix that makes something look at something else.
|
|
@@ -1190,11 +1190,11 @@ const q = 1e-6, zt = new Float32Array([
|
|
|
1190
1190
|
* @returns `out`
|
|
1191
1191
|
*/
|
|
1192
1192
|
static targetTo(t, e, s, i) {
|
|
1193
|
-
const n = e[0], r = e[1], a = e[2], c = i[0],
|
|
1194
|
-
let l = n - s[0],
|
|
1195
|
-
u > 0 && (u = 1 / Math.sqrt(u), l *= u,
|
|
1196
|
-
let M =
|
|
1197
|
-
return u = M * M + p * p + T * T, u > 0 && (u = 1 / Math.sqrt(u), M *= u, p *= u, T *= u), t[0] = M, t[1] = p, t[2] = T, t[3] = 0, t[4] =
|
|
1193
|
+
const n = e[0], r = e[1], a = e[2], c = i[0], h = i[1], o = i[2];
|
|
1194
|
+
let l = n - s[0], m = r - s[1], g = a - s[2], u = l * l + m * m + g * g;
|
|
1195
|
+
u > 0 && (u = 1 / Math.sqrt(u), l *= u, m *= u, g *= u);
|
|
1196
|
+
let M = h * g - o * m, p = o * l - c * g, T = c * m - h * l;
|
|
1197
|
+
return u = M * M + p * p + T * T, u > 0 && (u = 1 / Math.sqrt(u), M *= u, p *= u, T *= u), t[0] = M, t[1] = p, t[2] = T, t[3] = 0, t[4] = m * T - g * p, t[5] = g * M - l * T, t[6] = l * p - m * M, t[7] = 0, t[8] = l, t[9] = m, t[10] = g, t[11] = 0, t[12] = n, t[13] = r, t[14] = a, t[15] = 1, t;
|
|
1198
1198
|
}
|
|
1199
1199
|
/**
|
|
1200
1200
|
* Returns Frobenius norm of a {@link Mat4}
|
|
@@ -1282,8 +1282,8 @@ const q = 1e-6, zt = new Float32Array([
|
|
|
1282
1282
|
* @returns True if the matrices are equal, false otherwise.
|
|
1283
1283
|
*/
|
|
1284
1284
|
static equals(t, e) {
|
|
1285
|
-
const s = t[0], i = t[1], n = t[2], r = t[3], a = t[4], c = t[5],
|
|
1286
|
-
return Math.abs(s - L) <=
|
|
1285
|
+
const s = t[0], i = t[1], n = t[2], r = t[3], a = t[4], c = t[5], h = t[6], o = t[7], l = t[8], m = t[9], g = t[10], u = t[11], M = t[12], p = t[13], T = t[14], x = t[15], L = e[0], E = e[1], b = e[2], w = e[3], S = e[4], _ = e[5], v = e[6], z = e[7], P = e[8], A = e[9], R = e[10], C = e[11], F = e[12], W = e[13], at = e[14], ct = e[15];
|
|
1286
|
+
return Math.abs(s - L) <= O * Math.max(1, Math.abs(s), Math.abs(L)) && Math.abs(i - E) <= O * Math.max(1, Math.abs(i), Math.abs(E)) && Math.abs(n - b) <= O * Math.max(1, Math.abs(n), Math.abs(b)) && Math.abs(r - w) <= O * Math.max(1, Math.abs(r), Math.abs(w)) && Math.abs(a - S) <= O * Math.max(1, Math.abs(a), Math.abs(S)) && Math.abs(c - _) <= O * Math.max(1, Math.abs(c), Math.abs(_)) && Math.abs(h - v) <= O * Math.max(1, Math.abs(h), Math.abs(v)) && Math.abs(o - z) <= O * Math.max(1, Math.abs(o), Math.abs(z)) && Math.abs(l - P) <= O * Math.max(1, Math.abs(l), Math.abs(P)) && Math.abs(m - A) <= O * Math.max(1, Math.abs(m), Math.abs(A)) && Math.abs(g - R) <= O * Math.max(1, Math.abs(g), Math.abs(R)) && Math.abs(u - C) <= O * Math.max(1, Math.abs(u), Math.abs(C)) && Math.abs(M - F) <= O * Math.max(1, Math.abs(M), Math.abs(F)) && Math.abs(p - W) <= O * Math.max(1, Math.abs(p), Math.abs(W)) && Math.abs(T - at) <= O * Math.max(1, Math.abs(T), Math.abs(at)) && Math.abs(x - ct) <= O * Math.max(1, Math.abs(x), Math.abs(ct));
|
|
1287
1287
|
}
|
|
1288
1288
|
/**
|
|
1289
1289
|
* Returns a string representation of a {@link Mat4}
|
|
@@ -1299,15 +1299,15 @@ const q = 1e-6, zt = new Float32Array([
|
|
|
1299
1299
|
/**
|
|
1300
1300
|
* The number of bytes in a {@link Mat4}.
|
|
1301
1301
|
*/
|
|
1302
|
-
|
|
1303
|
-
let
|
|
1302
|
+
f(q, "BYTE_LENGTH", 16 * Float32Array.BYTES_PER_ELEMENT);
|
|
1303
|
+
let I = q;
|
|
1304
1304
|
const V = new Float32Array(3);
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1305
|
+
I.prototype.mul = I.prototype.multiply;
|
|
1306
|
+
I.sub = I.subtract;
|
|
1307
|
+
I.mul = I.multiply;
|
|
1308
|
+
I.frustum = I.frustumNO;
|
|
1309
|
+
I.perspective = I.perspectiveNO;
|
|
1310
|
+
I.ortho = I.orthoNO;
|
|
1311
1311
|
const U = class U extends Float32Array {
|
|
1312
1312
|
/**
|
|
1313
1313
|
* Create a {@link Vec3}.
|
|
@@ -1974,8 +1974,8 @@ const U = class U extends Float32Array {
|
|
|
1974
1974
|
* @returns `out`
|
|
1975
1975
|
*/
|
|
1976
1976
|
static cross(t, e, s) {
|
|
1977
|
-
const i = e[0], n = e[1], r = e[2], a = s[0], c = s[1],
|
|
1978
|
-
return t[0] = n *
|
|
1977
|
+
const i = e[0], n = e[1], r = e[2], a = s[0], c = s[1], h = s[2];
|
|
1978
|
+
return t[0] = n * h - r * c, t[1] = r * a - i * h, t[2] = i * c - n * a, t;
|
|
1979
1979
|
}
|
|
1980
1980
|
/**
|
|
1981
1981
|
* Performs a linear interpolation between two vec3's
|
|
@@ -2018,8 +2018,8 @@ const U = class U extends Float32Array {
|
|
|
2018
2018
|
* @returns `out`
|
|
2019
2019
|
*/
|
|
2020
2020
|
static hermite(t, e, s, i, n, r) {
|
|
2021
|
-
const a = r * r, c = a * (2 * r - 3) + 1,
|
|
2022
|
-
return t[0] = e[0] * c + s[0] *
|
|
2021
|
+
const a = r * r, c = a * (2 * r - 3) + 1, h = a * (r - 2) + r, o = a * (r - 1), l = a * (3 - 2 * r);
|
|
2022
|
+
return t[0] = e[0] * c + s[0] * h + i[0] * o + n[0] * l, t[1] = e[1] * c + s[1] * h + i[1] * o + n[1] * l, t[2] = e[2] * c + s[2] * h + i[2] * o + n[2] * l, t;
|
|
2023
2023
|
}
|
|
2024
2024
|
/**
|
|
2025
2025
|
* Performs a bezier interpolation with two control points
|
|
@@ -2034,8 +2034,8 @@ const U = class U extends Float32Array {
|
|
|
2034
2034
|
* @returns `out`
|
|
2035
2035
|
*/
|
|
2036
2036
|
static bezier(t, e, s, i, n, r) {
|
|
2037
|
-
const a = 1 - r, c = a * a,
|
|
2038
|
-
return t[0] = e[0] *
|
|
2037
|
+
const a = 1 - r, c = a * a, h = r * r, o = c * a, l = 3 * r * c, m = 3 * h * a, g = h * r;
|
|
2038
|
+
return t[0] = e[0] * o + s[0] * l + i[0] * m + n[0] * g, t[1] = e[1] * o + s[1] * l + i[1] * m + n[1] * g, t[2] = e[2] * o + s[2] * l + i[2] * m + n[2] * g, t;
|
|
2039
2039
|
}
|
|
2040
2040
|
/**
|
|
2041
2041
|
* Generates a random vector with the given scale
|
|
@@ -2095,8 +2095,8 @@ const U = class U extends Float32Array {
|
|
|
2095
2095
|
* @returns `out`
|
|
2096
2096
|
*/
|
|
2097
2097
|
static transformQuat(t, e, s) {
|
|
2098
|
-
const i = s[0], n = s[1], r = s[2], a = s[3] * 2, c = e[0],
|
|
2099
|
-
return t[0] = c + l * a + u, t[1] =
|
|
2098
|
+
const i = s[0], n = s[1], r = s[2], a = s[3] * 2, c = e[0], h = e[1], o = e[2], l = n * o - r * h, m = r * c - i * o, g = i * h - n * c, u = (n * g - r * m) * 2, M = (r * l - i * g) * 2, p = (i * m - n * l) * 2;
|
|
2099
|
+
return t[0] = c + l * a + u, t[1] = h + m * a + M, t[2] = o + g * a + p, t;
|
|
2100
2100
|
}
|
|
2101
2101
|
/**
|
|
2102
2102
|
* Rotate a 3D vector around the x-axis
|
|
@@ -2141,8 +2141,8 @@ const U = class U extends Float32Array {
|
|
|
2141
2141
|
* @returns The angle in radians
|
|
2142
2142
|
*/
|
|
2143
2143
|
static angle(t, e) {
|
|
2144
|
-
const s = t[0], i = t[1], n = t[2], r = e[0], a = e[1], c = e[2],
|
|
2145
|
-
return Math.acos(Math.min(Math.max(
|
|
2144
|
+
const s = t[0], i = t[1], n = t[2], r = e[0], a = e[1], c = e[2], h = Math.sqrt((s * s + i * i + n * n) * (r * r + a * a + c * c)), o = h && U.dot(t, e) / h;
|
|
2145
|
+
return Math.acos(Math.min(Math.max(o, -1), 1));
|
|
2146
2146
|
}
|
|
2147
2147
|
/**
|
|
2148
2148
|
* Set the components of a vec3 to zero
|
|
@@ -2185,13 +2185,13 @@ const U = class U extends Float32Array {
|
|
|
2185
2185
|
*/
|
|
2186
2186
|
static equals(t, e) {
|
|
2187
2187
|
const s = t[0], i = t[1], n = t[2], r = e[0], a = e[1], c = e[2];
|
|
2188
|
-
return Math.abs(s - r) <=
|
|
2188
|
+
return Math.abs(s - r) <= O * Math.max(1, Math.abs(s), Math.abs(r)) && Math.abs(i - a) <= O * Math.max(1, Math.abs(i), Math.abs(a)) && Math.abs(n - c) <= O * Math.max(1, Math.abs(n), Math.abs(c));
|
|
2189
2189
|
}
|
|
2190
2190
|
};
|
|
2191
2191
|
/**
|
|
2192
2192
|
* The number of bytes in a {@link Vec3}.
|
|
2193
2193
|
*/
|
|
2194
|
-
|
|
2194
|
+
f(U, "BYTE_LENGTH", 3 * Float32Array.BYTES_PER_ELEMENT);
|
|
2195
2195
|
let B = U;
|
|
2196
2196
|
B.prototype.sub = B.prototype.subtract;
|
|
2197
2197
|
B.prototype.mul = B.prototype.multiply;
|
|
@@ -2207,7 +2207,7 @@ B.sqrLen = B.squaredLength;
|
|
|
2207
2207
|
B.mag = B.magnitude;
|
|
2208
2208
|
B.length = B.magnitude;
|
|
2209
2209
|
B.len = B.magnitude;
|
|
2210
|
-
const
|
|
2210
|
+
const H = class H extends Float32Array {
|
|
2211
2211
|
/**
|
|
2212
2212
|
* Create a {@link Vec4}.
|
|
2213
2213
|
*/
|
|
@@ -2338,7 +2338,7 @@ const $ = class $ extends Float32Array {
|
|
|
2338
2338
|
* Equivalent to `Vec4.str(this);`
|
|
2339
2339
|
*/
|
|
2340
2340
|
get str() {
|
|
2341
|
-
return
|
|
2341
|
+
return H.str(this);
|
|
2342
2342
|
}
|
|
2343
2343
|
//===================
|
|
2344
2344
|
// Instances methods
|
|
@@ -2439,7 +2439,7 @@ const $ = class $ extends Float32Array {
|
|
|
2439
2439
|
* @returns Distance between `this` and `b`
|
|
2440
2440
|
*/
|
|
2441
2441
|
distance(t) {
|
|
2442
|
-
return
|
|
2442
|
+
return H.distance(this, t);
|
|
2443
2443
|
}
|
|
2444
2444
|
/**
|
|
2445
2445
|
* Alias for {@link Vec4.distance}
|
|
@@ -2455,7 +2455,7 @@ const $ = class $ extends Float32Array {
|
|
|
2455
2455
|
* @returns Squared distance between `this` and `b`
|
|
2456
2456
|
*/
|
|
2457
2457
|
squaredDistance(t) {
|
|
2458
|
-
return
|
|
2458
|
+
return H.squaredDistance(this, t);
|
|
2459
2459
|
}
|
|
2460
2460
|
/**
|
|
2461
2461
|
* Alias for {@link Vec4.squaredDistance}
|
|
@@ -2507,7 +2507,7 @@ const $ = class $ extends Float32Array {
|
|
|
2507
2507
|
* @returns `this`
|
|
2508
2508
|
*/
|
|
2509
2509
|
normalize() {
|
|
2510
|
-
return
|
|
2510
|
+
return H.normalize(this, this);
|
|
2511
2511
|
}
|
|
2512
2512
|
//===================
|
|
2513
2513
|
// Static methods
|
|
@@ -2519,7 +2519,7 @@ const $ = class $ extends Float32Array {
|
|
|
2519
2519
|
* @returns a new 4D vector
|
|
2520
2520
|
*/
|
|
2521
2521
|
static create() {
|
|
2522
|
-
return new
|
|
2522
|
+
return new H();
|
|
2523
2523
|
}
|
|
2524
2524
|
/**
|
|
2525
2525
|
* Creates a new {@link Vec4} initialized with values from an existing vector
|
|
@@ -2529,7 +2529,7 @@ const $ = class $ extends Float32Array {
|
|
|
2529
2529
|
* @returns a new 4D vector
|
|
2530
2530
|
*/
|
|
2531
2531
|
static clone(t) {
|
|
2532
|
-
return new
|
|
2532
|
+
return new H(t);
|
|
2533
2533
|
}
|
|
2534
2534
|
/**
|
|
2535
2535
|
* Creates a new {@link Vec4} initialized with the given values
|
|
@@ -2542,7 +2542,7 @@ const $ = class $ extends Float32Array {
|
|
|
2542
2542
|
* @returns a new 4D vector
|
|
2543
2543
|
*/
|
|
2544
2544
|
static fromValues(t, e, s, i) {
|
|
2545
|
-
return new
|
|
2545
|
+
return new H(t, e, s, i);
|
|
2546
2546
|
}
|
|
2547
2547
|
/**
|
|
2548
2548
|
* Copy the values from one {@link Vec4} to another
|
|
@@ -2879,8 +2879,8 @@ const $ = class $ extends Float32Array {
|
|
|
2879
2879
|
* @returns result
|
|
2880
2880
|
*/
|
|
2881
2881
|
static cross(t, e, s, i) {
|
|
2882
|
-
const n = s[0] * i[1] - s[1] * i[0], r = s[0] * i[2] - s[2] * i[0], a = s[0] * i[3] - s[3] * i[0], c = s[1] * i[2] - s[2] * i[1],
|
|
2883
|
-
return t[0] =
|
|
2882
|
+
const n = s[0] * i[1] - s[1] * i[0], r = s[0] * i[2] - s[2] * i[0], a = s[0] * i[3] - s[3] * i[0], c = s[1] * i[2] - s[2] * i[1], h = s[1] * i[3] - s[3] * i[1], o = s[2] * i[3] - s[3] * i[2], l = e[0], m = e[1], g = e[2], u = e[3];
|
|
2883
|
+
return t[0] = m * o - g * h + u * c, t[1] = -(l * o) + g * a - u * r, t[2] = l * h - m * a + u * n, t[3] = -(l * c) + m * r - g * n, t;
|
|
2884
2884
|
}
|
|
2885
2885
|
/**
|
|
2886
2886
|
* Performs a linear interpolation between two {@link Vec4}'s
|
|
@@ -2953,8 +2953,8 @@ const $ = class $ extends Float32Array {
|
|
|
2953
2953
|
* @returns `out`
|
|
2954
2954
|
*/
|
|
2955
2955
|
static transformQuat(t, e, s) {
|
|
2956
|
-
const i = e[0], n = e[1], r = e[2], a = s[0], c = s[1],
|
|
2957
|
-
return t[0] = l *
|
|
2956
|
+
const i = e[0], n = e[1], r = e[2], a = s[0], c = s[1], h = s[2], o = s[3], l = o * i + c * r - h * n, m = o * n + h * i - a * r, g = o * r + a * n - c * i, u = -a * i - c * n - h * r;
|
|
2957
|
+
return t[0] = l * o + u * -a + m * -h - g * -c, t[1] = m * o + u * -c + g * -a - l * -h, t[2] = g * o + u * -h + l * -c - m * -a, t[3] = e[3], t;
|
|
2958
2958
|
}
|
|
2959
2959
|
/**
|
|
2960
2960
|
* Set the components of a {@link Vec4} to zero
|
|
@@ -2996,15 +2996,15 @@ const $ = class $ extends Float32Array {
|
|
|
2996
2996
|
* @returns True if the vectors are equal, false otherwise.
|
|
2997
2997
|
*/
|
|
2998
2998
|
static equals(t, e) {
|
|
2999
|
-
const s = t[0], i = t[1], n = t[2], r = t[3], a = e[0], c = e[1],
|
|
3000
|
-
return Math.abs(s - a) <=
|
|
2999
|
+
const s = t[0], i = t[1], n = t[2], r = t[3], a = e[0], c = e[1], h = e[2], o = e[3];
|
|
3000
|
+
return Math.abs(s - a) <= O * Math.max(1, Math.abs(s), Math.abs(a)) && Math.abs(i - c) <= O * Math.max(1, Math.abs(i), Math.abs(c)) && Math.abs(n - h) <= O * Math.max(1, Math.abs(n), Math.abs(h)) && Math.abs(r - o) <= O * Math.max(1, Math.abs(r), Math.abs(o));
|
|
3001
3001
|
}
|
|
3002
3002
|
};
|
|
3003
3003
|
/**
|
|
3004
3004
|
* The number of bytes in a {@link Vec4}.
|
|
3005
3005
|
*/
|
|
3006
|
-
|
|
3007
|
-
let D =
|
|
3006
|
+
f(H, "BYTE_LENGTH", 4 * Float32Array.BYTES_PER_ELEMENT);
|
|
3007
|
+
let D = H;
|
|
3008
3008
|
D.prototype.sub = D.prototype.subtract;
|
|
3009
3009
|
D.prototype.mul = D.prototype.multiply;
|
|
3010
3010
|
D.prototype.div = D.prototype.divide;
|
|
@@ -3019,7 +3019,7 @@ D.sqrLen = D.squaredLength;
|
|
|
3019
3019
|
D.mag = D.magnitude;
|
|
3020
3020
|
D.length = D.magnitude;
|
|
3021
3021
|
D.len = D.magnitude;
|
|
3022
|
-
const
|
|
3022
|
+
const $ = class $ extends Float32Array {
|
|
3023
3023
|
/**
|
|
3024
3024
|
* Create a {@link Vec2}.
|
|
3025
3025
|
*/
|
|
@@ -3122,7 +3122,7 @@ const H = class H extends Float32Array {
|
|
|
3122
3122
|
* Equivalent to `Vec2.str(this);`
|
|
3123
3123
|
*/
|
|
3124
3124
|
get str() {
|
|
3125
|
-
return
|
|
3125
|
+
return $.str(this);
|
|
3126
3126
|
}
|
|
3127
3127
|
//===================
|
|
3128
3128
|
// Instances methods
|
|
@@ -3224,7 +3224,7 @@ const H = class H extends Float32Array {
|
|
|
3224
3224
|
* @returns Distance between `this` and `b`
|
|
3225
3225
|
*/
|
|
3226
3226
|
distance(t) {
|
|
3227
|
-
return
|
|
3227
|
+
return $.distance(this, t);
|
|
3228
3228
|
}
|
|
3229
3229
|
/**
|
|
3230
3230
|
* Alias for {@link Vec2.distance}
|
|
@@ -3240,7 +3240,7 @@ const H = class H extends Float32Array {
|
|
|
3240
3240
|
* @returns Squared distance between `this` and `b`
|
|
3241
3241
|
*/
|
|
3242
3242
|
squaredDistance(t) {
|
|
3243
|
-
return
|
|
3243
|
+
return $.squaredDistance(this, t);
|
|
3244
3244
|
}
|
|
3245
3245
|
/**
|
|
3246
3246
|
* Alias for {@link Vec2.squaredDistance}
|
|
@@ -3292,7 +3292,7 @@ const H = class H extends Float32Array {
|
|
|
3292
3292
|
* @returns `this`
|
|
3293
3293
|
*/
|
|
3294
3294
|
normalize() {
|
|
3295
|
-
return
|
|
3295
|
+
return $.normalize(this, this);
|
|
3296
3296
|
}
|
|
3297
3297
|
//================
|
|
3298
3298
|
// Static methods
|
|
@@ -3304,7 +3304,7 @@ const H = class H extends Float32Array {
|
|
|
3304
3304
|
* @returns A new 2D vector
|
|
3305
3305
|
*/
|
|
3306
3306
|
static create() {
|
|
3307
|
-
return new
|
|
3307
|
+
return new $();
|
|
3308
3308
|
}
|
|
3309
3309
|
/**
|
|
3310
3310
|
* Creates a new {@link Vec2} initialized with values from an existing vector
|
|
@@ -3314,7 +3314,7 @@ const H = class H extends Float32Array {
|
|
|
3314
3314
|
* @returns A new 2D vector
|
|
3315
3315
|
*/
|
|
3316
3316
|
static clone(t) {
|
|
3317
|
-
return new
|
|
3317
|
+
return new $(t);
|
|
3318
3318
|
}
|
|
3319
3319
|
/**
|
|
3320
3320
|
* Creates a new {@link Vec2} initialized with the given values
|
|
@@ -3325,7 +3325,7 @@ const H = class H extends Float32Array {
|
|
|
3325
3325
|
* @returns A new 2D vector
|
|
3326
3326
|
*/
|
|
3327
3327
|
static fromValues(t, e) {
|
|
3328
|
-
return new
|
|
3328
|
+
return new $(t, e);
|
|
3329
3329
|
}
|
|
3330
3330
|
/**
|
|
3331
3331
|
* Copy the values from one {@link Vec2} to another
|
|
@@ -3787,7 +3787,7 @@ const H = class H extends Float32Array {
|
|
|
3787
3787
|
*/
|
|
3788
3788
|
static equals(t, e) {
|
|
3789
3789
|
const s = t[0], i = t[1], n = e[0], r = e[1];
|
|
3790
|
-
return Math.abs(s - n) <=
|
|
3790
|
+
return Math.abs(s - n) <= O * Math.max(1, Math.abs(s), Math.abs(n)) && Math.abs(i - r) <= O * Math.max(1, Math.abs(i), Math.abs(r));
|
|
3791
3791
|
}
|
|
3792
3792
|
/**
|
|
3793
3793
|
* Returns a string representation of a vector
|
|
@@ -3803,64 +3803,64 @@ const H = class H extends Float32Array {
|
|
|
3803
3803
|
/**
|
|
3804
3804
|
* The number of bytes in a {@link Vec2}.
|
|
3805
3805
|
*/
|
|
3806
|
-
|
|
3807
|
-
let
|
|
3808
|
-
|
|
3809
|
-
|
|
3810
|
-
|
|
3811
|
-
|
|
3812
|
-
|
|
3813
|
-
|
|
3814
|
-
|
|
3815
|
-
|
|
3816
|
-
|
|
3817
|
-
|
|
3818
|
-
|
|
3819
|
-
|
|
3820
|
-
|
|
3821
|
-
|
|
3822
|
-
function
|
|
3806
|
+
f($, "BYTE_LENGTH", 2 * Float32Array.BYTES_PER_ELEMENT);
|
|
3807
|
+
let k = $;
|
|
3808
|
+
k.prototype.sub = k.prototype.subtract;
|
|
3809
|
+
k.prototype.mul = k.prototype.multiply;
|
|
3810
|
+
k.prototype.div = k.prototype.divide;
|
|
3811
|
+
k.prototype.dist = k.prototype.distance;
|
|
3812
|
+
k.prototype.sqrDist = k.prototype.squaredDistance;
|
|
3813
|
+
k.sub = k.subtract;
|
|
3814
|
+
k.mul = k.multiply;
|
|
3815
|
+
k.div = k.divide;
|
|
3816
|
+
k.dist = k.distance;
|
|
3817
|
+
k.sqrDist = k.squaredDistance;
|
|
3818
|
+
k.sqrLen = k.squaredLength;
|
|
3819
|
+
k.mag = k.magnitude;
|
|
3820
|
+
k.length = k.magnitude;
|
|
3821
|
+
k.len = k.magnitude;
|
|
3822
|
+
function be(d, t, e) {
|
|
3823
3823
|
const s = d.data, i = d.width, n = d.height;
|
|
3824
|
-
let r, a, c,
|
|
3825
|
-
const L = i - 1,
|
|
3824
|
+
let r, a, c, h, o, l, m, g, u, M, p, T, x;
|
|
3825
|
+
const L = i - 1, E = n - 1, b = t + 1, w = t + b, S = t + 1, _ = t + S, v = 1 / (w * _), z = [], P = [], A = [], R = [], C = [], F = [];
|
|
3826
3826
|
for (; e-- > 0; ) {
|
|
3827
3827
|
for (x = T = 0, l = 0; l < n; l++) {
|
|
3828
|
-
for (r = s[x] *
|
|
3829
|
-
g = x + ((
|
|
3830
|
-
for (
|
|
3831
|
-
|
|
3828
|
+
for (r = s[x] * b, a = s[x + 1] * b, c = s[x + 2] * b, h = s[x + 3] * b, m = 1; m <= t; m++)
|
|
3829
|
+
g = x + ((m > L ? L : m) << 2), r += s[g++], a += s[g++], c += s[g++], h += s[g];
|
|
3830
|
+
for (o = 0; o < i; o++)
|
|
3831
|
+
z[T] = r, P[T] = a, A[T] = c, R[T] = h, l === 0 && (C[o] = Math.min(o + b, L) << 2, F[o] = Math.max(o - t, 0) << 2), u = x + C[o], M = x + F[o], r += s[u++] - s[M++], a += s[u++] - s[M++], c += s[u++] - s[M++], h += s[u] - s[M], T++;
|
|
3832
3832
|
x += i << 2;
|
|
3833
3833
|
}
|
|
3834
|
-
for (
|
|
3835
|
-
for (p =
|
|
3836
|
-
p +=
|
|
3837
|
-
for (T =
|
|
3838
|
-
s[T] = r *
|
|
3834
|
+
for (o = 0; o < i; o++) {
|
|
3835
|
+
for (p = o, r = z[p] * S, a = P[p] * S, c = A[p] * S, h = R[p] * S, m = 1; m <= t; m++)
|
|
3836
|
+
p += m > E ? 0 : i, r += z[p], a += P[p], c += A[p], h += R[p];
|
|
3837
|
+
for (T = o << 2, l = 0; l < n; l++)
|
|
3838
|
+
s[T] = r * v + 0.5 | 0, s[T + 1] = a * v + 0.5 | 0, s[T + 2] = c * v + 0.5 | 0, s[T + 3] = h * v + 0.5 | 0, o === 0 && (C[l] = Math.min(l + S, E) * i, F[l] = Math.max(l - t, 0) * i), u = o + C[l], M = o + F[l], r += z[u] - z[M], a += P[u] - P[M], c += A[u] - A[M], h += R[u] - R[M], T += i << 2;
|
|
3839
3839
|
}
|
|
3840
3840
|
}
|
|
3841
3841
|
}
|
|
3842
|
-
function
|
|
3842
|
+
function Ee(d, t) {
|
|
3843
3843
|
const e = d.data;
|
|
3844
3844
|
for (let s = 0; s < e.length; s += 4) {
|
|
3845
3845
|
const i = e[s], n = e[s + 1], r = e[s + 2], a = e[s + 3], c = i * 0.3 + n * 0.59 + r * 0.11;
|
|
3846
3846
|
e[s] = c * (1 - t) + i * t, e[s + 1] = c * (1 - t) + n * t, e[s + 2] = c * (1 - t) + r * t, e[s + 3] = a;
|
|
3847
3847
|
}
|
|
3848
3848
|
}
|
|
3849
|
-
function
|
|
3849
|
+
function Se(d, t) {
|
|
3850
3850
|
const e = d.data;
|
|
3851
3851
|
for (let s = 0; s < e.length; s += 4) {
|
|
3852
3852
|
const i = e[s], n = e[s + 1], r = e[s + 2], a = e[s + 3];
|
|
3853
3853
|
e[s] = i * t, e[s + 1] = n * t, e[s + 2] = r * t, e[s + 3] = a;
|
|
3854
3854
|
}
|
|
3855
3855
|
}
|
|
3856
|
-
function
|
|
3856
|
+
function Nt(d, t) {
|
|
3857
3857
|
const e = d.data;
|
|
3858
3858
|
for (let s = 0; s < e.length; s += 4) {
|
|
3859
3859
|
const i = e[s], n = e[s + 1], r = e[s + 2], a = e[s + 3];
|
|
3860
3860
|
e[s] = (i - 128) * t + 128, e[s + 1] = (n - 128) * t + 128, e[s + 2] = (r - 128) * t + 128, e[s + 3] = a;
|
|
3861
3861
|
}
|
|
3862
3862
|
}
|
|
3863
|
-
const
|
|
3863
|
+
const we = `precision highp float;
|
|
3864
3864
|
|
|
3865
3865
|
varying vec2 v_uv;
|
|
3866
3866
|
uniform sampler2D u_texture;
|
|
@@ -3885,7 +3885,7 @@ void main() {
|
|
|
3885
3885
|
vec4 result = texture2D(u_texture, v_uv);
|
|
3886
3886
|
gl_FragColor = result * vec4(1.0, 1.0, 1.0, u_alpha) + vec4(dither);
|
|
3887
3887
|
}
|
|
3888
|
-
`,
|
|
3888
|
+
`, Le = `precision highp float;
|
|
3889
3889
|
|
|
3890
3890
|
attribute vec2 a_pos;
|
|
3891
3891
|
attribute vec2 a_uv;
|
|
@@ -3895,9 +3895,9 @@ void main() {
|
|
|
3895
3895
|
v_uv = a_uv;
|
|
3896
3896
|
gl_Position = vec4(a_pos, 0.0, 1.0);
|
|
3897
3897
|
}
|
|
3898
|
-
`, y = (d, t, e, s, i = 0, n = 0, r = 1, a = 1) => Object.freeze({ cx: d, cy: t, x: e, y: s, ur: i, vr: n, up: r, vp: a }),
|
|
3898
|
+
`, y = (d, t, e, s, i = 0, n = 0, r = 1, a = 1) => Object.freeze({ cx: d, cy: t, x: e, y: s, ur: i, vr: n, up: r, vp: a }), J = (d, t, e) => Object.freeze({ width: d, height: t, conf: e }), qt = [
|
|
3899
3899
|
// TODO: 竖屏推荐
|
|
3900
|
-
|
|
3900
|
+
J(5, 5, [
|
|
3901
3901
|
y(0, 0, -1, -1, 0, 0, 1, 1),
|
|
3902
3902
|
y(1, 0, -0.5, -1, 0, 0, 1, 1),
|
|
3903
3903
|
y(2, 0, 0, -1, 0, 0, 1, 1),
|
|
@@ -3924,7 +3924,7 @@ void main() {
|
|
|
3924
3924
|
y(3, 4, 0.5, 1, 0, 0, 1, 1),
|
|
3925
3925
|
y(4, 4, 1, 1, 0, 0, 1, 1)
|
|
3926
3926
|
]),
|
|
3927
|
-
|
|
3927
|
+
J(6, 6, [
|
|
3928
3928
|
y(0, 0, -1, -1, 0, 0, 1, 1),
|
|
3929
3929
|
y(1, 0, -0.6, -1, 0, 0, 1, 1),
|
|
3930
3930
|
y(2, 0, -0.19999999999999996, -1, 0, 0, 1, 1),
|
|
@@ -3963,7 +3963,7 @@ void main() {
|
|
|
3963
3963
|
y(5, 5, 1, 1, 0, 0, 1, 1)
|
|
3964
3964
|
]),
|
|
3965
3965
|
// TODO: 横屏推荐
|
|
3966
|
-
|
|
3966
|
+
J(4, 4, [
|
|
3967
3967
|
y(0, 0, -1, -1, 0, 0, 1, 1),
|
|
3968
3968
|
y(1, 0, -0.33333333333333337, -1, 0, 0, 1, 1),
|
|
3969
3969
|
y(2, 0, 0.33333333333333326, -1, 0, 0, 1, 1),
|
|
@@ -3981,7 +3981,7 @@ void main() {
|
|
|
3981
3981
|
y(2, 3, 0.33333333333333326, 1, 0, 0, 1, 1),
|
|
3982
3982
|
y(3, 3, 1, 1, 0, 0, 1, 1)
|
|
3983
3983
|
]),
|
|
3984
|
-
|
|
3984
|
+
J(4, 4, [
|
|
3985
3985
|
y(0, 0, -1, -1, 0, 0, 1, 2.075),
|
|
3986
3986
|
y(1, 0, -0.33333333333333337, -1, 0, 0, 1, 1),
|
|
3987
3987
|
y(2, 0, 0.33333333333333326, -1, 0, 0, 1, 1),
|
|
@@ -3999,7 +3999,7 @@ void main() {
|
|
|
3999
3999
|
y(2, 3, 0.5125850864305672, 1, -20, -18, 0, 1.604),
|
|
4000
4000
|
y(3, 3, 1, 1, 0, 0, 1, 1)
|
|
4001
4001
|
]),
|
|
4002
|
-
|
|
4002
|
+
J(4, 4, [
|
|
4003
4003
|
y(0, 0, -1, -1, 0, 0, 1, 1),
|
|
4004
4004
|
y(1, 0, -0.04704442742088466, -1, 0, 14, 2.013, 3.522),
|
|
4005
4005
|
y(2, 0, 0.5910378220172194, -1, 0, 0, 1, 1),
|
|
@@ -4017,7 +4017,7 @@ void main() {
|
|
|
4017
4017
|
y(2, 3, 0.33333333333333326, 1, 0, 0, 1, 1),
|
|
4018
4018
|
y(3, 3, 1, 1, 0, 0, 1, 1)
|
|
4019
4019
|
]),
|
|
4020
|
-
|
|
4020
|
+
J(5, 5, [
|
|
4021
4021
|
y(0, 0, -1, -1, 0, 0, 1, 1),
|
|
4022
4022
|
y(1, 0, -0.632824853134554, -1, 0, -31, 1.101, 1.038),
|
|
4023
4023
|
y(2, 0, -0.1019613423315412, -1, 0, 0, 1, 1),
|
|
@@ -4044,7 +4044,7 @@ void main() {
|
|
|
4044
4044
|
y(3, 4, 0.6093434603207717, 1, 0, 0, 0.629, 1),
|
|
4045
4045
|
y(4, 4, 1, 1, 0, 0, 1, 1)
|
|
4046
4046
|
])
|
|
4047
|
-
],
|
|
4047
|
+
], Pe = `precision highp float;
|
|
4048
4048
|
|
|
4049
4049
|
varying vec3 v_color;
|
|
4050
4050
|
varying vec2 v_uv;
|
|
@@ -4065,7 +4065,7 @@ void main() {
|
|
|
4065
4065
|
result *= vec4(1.0 - u_volume * 0.1);
|
|
4066
4066
|
gl_FragColor = result;
|
|
4067
4067
|
}
|
|
4068
|
-
`,
|
|
4068
|
+
`, ve = `precision highp float;
|
|
4069
4069
|
|
|
4070
4070
|
attribute vec2 a_pos;
|
|
4071
4071
|
attribute vec3 a_color;
|
|
@@ -4087,14 +4087,14 @@ void main() {
|
|
|
4087
4087
|
gl_Position = vec4(pos, 0.0, 1.0);
|
|
4088
4088
|
}
|
|
4089
4089
|
`;
|
|
4090
|
-
class
|
|
4090
|
+
class Ut {
|
|
4091
4091
|
constructor(t, e, s, i = "unknown") {
|
|
4092
|
-
|
|
4093
|
-
|
|
4094
|
-
|
|
4095
|
-
|
|
4096
|
-
|
|
4097
|
-
|
|
4092
|
+
f(this, "gl");
|
|
4093
|
+
f(this, "program");
|
|
4094
|
+
f(this, "vertexShader");
|
|
4095
|
+
f(this, "fragmentShader");
|
|
4096
|
+
f(this, "attrs");
|
|
4097
|
+
f(this, "notFoundUniforms", /* @__PURE__ */ new Set());
|
|
4098
4098
|
this.label = i, this.gl = t, this.vertexShader = this.createShader(t.VERTEX_SHADER, e), this.fragmentShader = this.createShader(
|
|
4099
4099
|
t.FRAGMENT_SHADER,
|
|
4100
4100
|
s
|
|
@@ -4103,8 +4103,8 @@ class Dt {
|
|
|
4103
4103
|
for (let a = 0; a < n; a++) {
|
|
4104
4104
|
const c = t.getActiveAttrib(this.program, a);
|
|
4105
4105
|
if (!c) continue;
|
|
4106
|
-
const
|
|
4107
|
-
|
|
4106
|
+
const h = t.getAttribLocation(this.program, c.name);
|
|
4107
|
+
h !== -1 && (r[c.name] = h);
|
|
4108
4108
|
}
|
|
4109
4109
|
this.attrs = r;
|
|
4110
4110
|
}
|
|
@@ -4151,17 +4151,17 @@ class Dt {
|
|
|
4151
4151
|
t.deleteShader(this.vertexShader), t.deleteShader(this.fragmentShader), t.deleteProgram(this.program);
|
|
4152
4152
|
}
|
|
4153
4153
|
}
|
|
4154
|
-
class
|
|
4154
|
+
class te {
|
|
4155
4155
|
constructor(t, e, s, i) {
|
|
4156
|
-
|
|
4157
|
-
|
|
4158
|
-
|
|
4159
|
-
|
|
4160
|
-
|
|
4161
|
-
|
|
4162
|
-
|
|
4156
|
+
f(this, "vertexWidth", 0);
|
|
4157
|
+
f(this, "vertexHeight", 0);
|
|
4158
|
+
f(this, "vertexBuffer");
|
|
4159
|
+
f(this, "indexBuffer");
|
|
4160
|
+
f(this, "vertexData");
|
|
4161
|
+
f(this, "indexData");
|
|
4162
|
+
f(this, "vertexIndexLength", 0);
|
|
4163
4163
|
// 调试用途,开启线框模式
|
|
4164
|
-
|
|
4164
|
+
f(this, "wireFrame", !1);
|
|
4165
4165
|
this.gl = t, this.attrPos = e, this.attrColor = s, this.attrUV = i;
|
|
4166
4166
|
const n = t.createBuffer();
|
|
4167
4167
|
if (!n) throw new Error("Failed to create vertex buffer");
|
|
@@ -4217,8 +4217,8 @@ class Ut {
|
|
|
4217
4217
|
this.vertexData = s, this.indexData = i;
|
|
4218
4218
|
for (let r = 0; r < e; r++)
|
|
4219
4219
|
for (let a = 0; a < t; a++) {
|
|
4220
|
-
const c = a / (t - 1) * 2 - 1,
|
|
4221
|
-
this.setVertexPos(a, r, c || 0,
|
|
4220
|
+
const c = a / (t - 1) * 2 - 1, h = r / (e - 1) * 2 - 1;
|
|
4221
|
+
this.setVertexPos(a, r, c || 0, h || 0), this.setVertexColor(a, r, 1, 1, 1), this.setVertexUV(a, r, a / (t - 1), r / (e - 1));
|
|
4222
4222
|
}
|
|
4223
4223
|
for (let r = 0; r < e - 1; r++)
|
|
4224
4224
|
for (let a = 0; a < t - 1; a++)
|
|
@@ -4244,16 +4244,16 @@ class Ut {
|
|
|
4244
4244
|
this.gl.deleteBuffer(this.vertexBuffer), this.gl.deleteBuffer(this.indexBuffer);
|
|
4245
4245
|
}
|
|
4246
4246
|
}
|
|
4247
|
-
class
|
|
4247
|
+
class ze {
|
|
4248
4248
|
constructor() {
|
|
4249
|
-
|
|
4250
|
-
|
|
4251
|
-
|
|
4252
|
-
|
|
4253
|
-
|
|
4254
|
-
|
|
4255
|
-
|
|
4256
|
-
|
|
4249
|
+
f(this, "color", B.fromValues(1, 1, 1));
|
|
4250
|
+
f(this, "location", k.fromValues(0, 0));
|
|
4251
|
+
f(this, "uTangent", k.fromValues(0, 0));
|
|
4252
|
+
f(this, "vTangent", k.fromValues(0, 0));
|
|
4253
|
+
f(this, "_uRot", 0);
|
|
4254
|
+
f(this, "_vRot", 0);
|
|
4255
|
+
f(this, "_uScale", 1);
|
|
4256
|
+
f(this, "_vScale", 1);
|
|
4257
4257
|
Object.seal(this);
|
|
4258
4258
|
}
|
|
4259
4259
|
get uRot() {
|
|
@@ -4287,31 +4287,31 @@ class me {
|
|
|
4287
4287
|
this.vTangent[0] = -Math.sin(this._vRot) * this._vScale, this.vTangent[1] = Math.cos(this._vRot) * this._vScale;
|
|
4288
4288
|
}
|
|
4289
4289
|
}
|
|
4290
|
-
const
|
|
4291
|
-
function
|
|
4292
|
-
G[0] = d ** 3, G[1] = d ** 2, G[2] = d, G[3] = 1,
|
|
4293
|
-
const n =
|
|
4294
|
-
tt.copy(s).transpose(),
|
|
4295
|
-
const r =
|
|
4290
|
+
const rt = I.fromValues(2, -2, 1, 1, -3, 3, -2, -1, 0, 0, 1, 0, 1, 0, 0, 0), dt = I.clone(rt).transpose(), G = D.create(), gt = D.create(), Q = D.create(), K = I.create(), tt = I.create();
|
|
4291
|
+
function _e(d, t, e, s, i = k.create()) {
|
|
4292
|
+
G[0] = d ** 3, G[1] = d ** 2, G[2] = d, G[3] = 1, gt.copy(G), Q[0] = t ** 3, Q[1] = t ** 2, Q[2] = t, Q[3] = 1, K.copy(e).transpose(), I.mul(K, K, rt), I.mul(K, dt, K), D.transformMat4(G, G, K);
|
|
4293
|
+
const n = Q.dot(G);
|
|
4294
|
+
tt.copy(s).transpose(), I.mul(tt, tt, rt), I.mul(tt, dt, tt), D.transformMat4(gt, gt, tt);
|
|
4295
|
+
const r = Q.dot(gt);
|
|
4296
4296
|
return i.x = n, i.y = r, i;
|
|
4297
4297
|
}
|
|
4298
|
-
function
|
|
4299
|
-
const r = (
|
|
4298
|
+
function Vt(d, t, e, s, i, n = I.create()) {
|
|
4299
|
+
const r = (h) => h.location[i], a = (h) => h.uTangent[i], c = (h) => h.vTangent[i];
|
|
4300
4300
|
return n[0] = r(d), n[1] = r(t), n[2] = c(d), n[3] = c(t), n[4] = r(e), n[5] = r(s), n[6] = c(e), n[7] = c(s), n[8] = a(d), n[9] = a(t), n[10] = 0, n[11] = 0, n[12] = a(e), n[13] = a(s), n[14] = 0, n[15] = 0, n;
|
|
4301
4301
|
}
|
|
4302
|
-
function
|
|
4302
|
+
function vt(d, t, e, s, i, n = I.create()) {
|
|
4303
4303
|
const r = (a) => a.color[i];
|
|
4304
4304
|
return n.fill(0), n[0] = r(d), n[1] = r(t), n[4] = r(e), n[5] = r(s), n;
|
|
4305
4305
|
}
|
|
4306
|
-
const Y = D.create(),
|
|
4307
|
-
function
|
|
4308
|
-
return Y[0] = d ** 3, Y[1] = d ** 2, Y[2] = d, Y[3] = 1,
|
|
4306
|
+
const Y = D.create(), ut = D.create(), yt = D.create(), j = D.create(), et = I.create(), st = I.create(), it = I.create(), Mt = B.create();
|
|
4307
|
+
function Fe(d, t, e, s, i) {
|
|
4308
|
+
return Y[0] = d ** 3, Y[1] = d ** 2, Y[2] = d, Y[3] = 1, ut.copy(Y), yt.copy(Y), j[0] = t ** 3, j[1] = t ** 2, j[2] = t, j[3] = 1, et.copy(e).transpose(), I.mul(et, et, rt), I.mul(et, dt, et), D.transformMat4(Y, Y, et), Mt.r = j.dot(Y), st.copy(s).transpose(), I.mul(st, st, rt), I.mul(st, dt, st), D.transformMat4(ut, ut, st), Mt.g = j.dot(ut), it.copy(i).transpose(), I.mul(it, it, rt), I.mul(it, dt, it), D.transformMat4(yt, yt, it), Mt.b = j.dot(yt), Mt;
|
|
4309
4309
|
}
|
|
4310
|
-
class
|
|
4310
|
+
class De {
|
|
4311
4311
|
constructor(t, e) {
|
|
4312
|
-
|
|
4313
|
-
|
|
4314
|
-
|
|
4312
|
+
f(this, "_width", 0);
|
|
4313
|
+
f(this, "_height", 0);
|
|
4314
|
+
f(this, "_data", []);
|
|
4315
4315
|
this.resize(t, e), Object.seal(this);
|
|
4316
4316
|
}
|
|
4317
4317
|
resize(t, e) {
|
|
@@ -4330,20 +4330,20 @@ class ge {
|
|
|
4330
4330
|
return this._height;
|
|
4331
4331
|
}
|
|
4332
4332
|
}
|
|
4333
|
-
class
|
|
4333
|
+
class Ie extends te {
|
|
4334
4334
|
constructor(e, s, i, n) {
|
|
4335
4335
|
super(e, s, i, n);
|
|
4336
4336
|
/**
|
|
4337
4337
|
* 细分级别,越大曲线越平滑,但是性能消耗也越大
|
|
4338
4338
|
*/
|
|
4339
|
-
|
|
4340
|
-
|
|
4341
|
-
|
|
4342
|
-
|
|
4343
|
-
|
|
4344
|
-
|
|
4345
|
-
|
|
4346
|
-
|
|
4339
|
+
f(this, "_subDivisions", 10);
|
|
4340
|
+
f(this, "_controlPoints", new De(3, 3));
|
|
4341
|
+
f(this, "uMX", I.create());
|
|
4342
|
+
f(this, "uMY", I.create());
|
|
4343
|
+
f(this, "uMR", I.create());
|
|
4344
|
+
f(this, "uMG", I.create());
|
|
4345
|
+
f(this, "uMB", I.create());
|
|
4346
|
+
f(this, "tmpV2", k.create());
|
|
4347
4347
|
this.resizeControlPoints(3, 3), Object.seal(this);
|
|
4348
4348
|
}
|
|
4349
4349
|
setWireFrame(e) {
|
|
@@ -4371,7 +4371,7 @@ class ue extends Ut {
|
|
|
4371
4371
|
this._controlPoints.resize(e, s);
|
|
4372
4372
|
for (let i = 0; i < s; i++)
|
|
4373
4373
|
for (let n = 0; n < e; n++) {
|
|
4374
|
-
const r = new
|
|
4374
|
+
const r = new ze();
|
|
4375
4375
|
r.location.x = n / (e - 1) * 2 - 1, r.location.y = i / (s - 1) * 2 - 1, r.uTangent.x = 2 / (e - 1), r.vTangent.y = 2 / (s - 1), this._controlPoints.set(n, i, r);
|
|
4376
4376
|
}
|
|
4377
4377
|
this.resetSubdivition(this._subDivisions);
|
|
@@ -4395,33 +4395,33 @@ class ue extends Ut {
|
|
|
4395
4395
|
const e = this._subDivisions - 1, s = e * (this._controlPoints.height - 1), i = e * (this._controlPoints.width - 1);
|
|
4396
4396
|
for (let n = 0; n < this._controlPoints.width - 1; n++)
|
|
4397
4397
|
for (let r = 0; r < this._controlPoints.height - 1; r++) {
|
|
4398
|
-
const a = this._controlPoints.get(n, r), c = this._controlPoints.get(n, r + 1),
|
|
4398
|
+
const a = this._controlPoints.get(n, r), c = this._controlPoints.get(n, r + 1), h = this._controlPoints.get(n + 1, r), o = this._controlPoints.get(n + 1, r + 1), l = Vt(a, c, h, o, "x", this.uMX), m = Vt(a, c, h, o, "y", this.uMY), g = vt(a, c, h, o, "r", this.uMR), u = vt(a, c, h, o, "g", this.uMG), M = vt(a, c, h, o, "b", this.uMB), p = n / (this._controlPoints.width - 1), T = r / (this._controlPoints.height - 1);
|
|
4399
4399
|
for (let x = 0; x < this._subDivisions; x++)
|
|
4400
4400
|
for (let L = 0; L < this._subDivisions; L++) {
|
|
4401
|
-
const
|
|
4401
|
+
const E = r * this._subDivisions + x, b = n * this._subDivisions + L, [w, S] = _e(
|
|
4402
4402
|
x / e,
|
|
4403
4403
|
L / e,
|
|
4404
4404
|
l,
|
|
4405
|
-
|
|
4405
|
+
m,
|
|
4406
4406
|
this.tmpV2
|
|
4407
4407
|
);
|
|
4408
|
-
this.setVertexPos(
|
|
4409
|
-
const [
|
|
4408
|
+
this.setVertexPos(E, b, w, S), this.setVertexUV(E, b, p + L / i, 1 - T - x / s);
|
|
4409
|
+
const [_, v, z] = Fe(
|
|
4410
4410
|
x / e,
|
|
4411
4411
|
L / e,
|
|
4412
4412
|
g,
|
|
4413
4413
|
u,
|
|
4414
4414
|
M
|
|
4415
4415
|
);
|
|
4416
|
-
this.setVertexColor(
|
|
4416
|
+
this.setVertexColor(E, b, _, v, z);
|
|
4417
4417
|
}
|
|
4418
4418
|
}
|
|
4419
4419
|
this.update();
|
|
4420
4420
|
}
|
|
4421
4421
|
}
|
|
4422
|
-
class
|
|
4422
|
+
class Wt {
|
|
4423
4423
|
constructor(t, e) {
|
|
4424
|
-
|
|
4424
|
+
f(this, "tex");
|
|
4425
4425
|
this.gl = t;
|
|
4426
4426
|
const s = t.createTexture();
|
|
4427
4427
|
if (!s) throw new Error("Failed to create texture");
|
|
@@ -4441,52 +4441,52 @@ class At {
|
|
|
4441
4441
|
this.gl.deleteTexture(this.tex);
|
|
4442
4442
|
}
|
|
4443
4443
|
}
|
|
4444
|
-
function
|
|
4444
|
+
function Ae(d, t) {
|
|
4445
4445
|
if ("OffscreenCanvas" in window) return new OffscreenCanvas(d, t);
|
|
4446
4446
|
const e = document.createElement("canvas");
|
|
4447
4447
|
return e.width = d, e.height = t, e;
|
|
4448
4448
|
}
|
|
4449
|
-
class
|
|
4449
|
+
class Ns extends Jt {
|
|
4450
4450
|
constructor(e) {
|
|
4451
4451
|
super(e);
|
|
4452
|
-
|
|
4453
|
-
|
|
4454
|
-
|
|
4455
|
-
|
|
4456
|
-
|
|
4457
|
-
|
|
4458
|
-
|
|
4459
|
-
|
|
4460
|
-
|
|
4461
|
-
|
|
4462
|
-
|
|
4463
|
-
|
|
4464
|
-
|
|
4452
|
+
f(this, "gl");
|
|
4453
|
+
f(this, "lastFrameTime", 0);
|
|
4454
|
+
f(this, "frameTime", 0);
|
|
4455
|
+
f(this, "lastTickTime", 0);
|
|
4456
|
+
f(this, "volume", 0);
|
|
4457
|
+
f(this, "tickHandle", 0);
|
|
4458
|
+
f(this, "maxFPS", 60);
|
|
4459
|
+
f(this, "paused", !1);
|
|
4460
|
+
f(this, "staticMode", !1);
|
|
4461
|
+
f(this, "mainProgram");
|
|
4462
|
+
f(this, "blendProgram");
|
|
4463
|
+
f(this, "manualControl", !1);
|
|
4464
|
+
f(this, "reduceImageSizeCanvas", Ae(
|
|
4465
4465
|
32,
|
|
4466
4466
|
32
|
|
4467
4467
|
));
|
|
4468
|
-
|
|
4469
|
-
|
|
4470
|
-
|
|
4471
|
-
|
|
4472
|
-
|
|
4473
|
-
|
|
4474
|
-
|
|
4475
|
-
|
|
4476
|
-
|
|
4468
|
+
f(this, "targetSize", k.fromValues(0, 0));
|
|
4469
|
+
f(this, "currentSize", k.fromValues(0, 0));
|
|
4470
|
+
f(this, "fullScreenMesh");
|
|
4471
|
+
f(this, "drawFrameBuffer");
|
|
4472
|
+
f(this, "drawFrameBufferTexture");
|
|
4473
|
+
f(this, "meshStates", []);
|
|
4474
|
+
f(this, "_disposed", !1);
|
|
4475
|
+
f(this, "onTickBinded", this.onTick.bind(this));
|
|
4476
|
+
f(this, "supportTextureFloat", !0);
|
|
4477
4477
|
const s = e.getContext("webgl");
|
|
4478
4478
|
if (!s) throw new Error("WebGL not supported");
|
|
4479
|
-
s.getExtension("EXT_color_buffer_float") || console.warn("EXT_color_buffer_float not supported"), s.getExtension("EXT_float_blend") || (console.warn("EXT_float_blend not supported"), this.supportTextureFloat = !1), s.getExtension("OES_texture_float_linear") || console.warn("OES_texture_float_linear not supported"), s.getExtension("OES_texture_float") || (this.supportTextureFloat = !1, console.warn("OES_texture_float not supported")), this.gl = s, s.enable(s.BLEND), s.enable(s.DEPTH_TEST), s.depthFunc(s.ALWAYS), this.mainProgram = new
|
|
4479
|
+
s.getExtension("EXT_color_buffer_float") || console.warn("EXT_color_buffer_float not supported"), s.getExtension("EXT_float_blend") || (console.warn("EXT_float_blend not supported"), this.supportTextureFloat = !1), s.getExtension("OES_texture_float_linear") || console.warn("OES_texture_float_linear not supported"), s.getExtension("OES_texture_float") || (this.supportTextureFloat = !1, console.warn("OES_texture_float not supported")), this.gl = s, s.enable(s.BLEND), s.enable(s.DEPTH_TEST), s.depthFunc(s.ALWAYS), this.mainProgram = new Ut(
|
|
4480
4480
|
s,
|
|
4481
|
-
|
|
4482
|
-
|
|
4481
|
+
ve,
|
|
4482
|
+
Pe,
|
|
4483
4483
|
"main-program-mg"
|
|
4484
|
-
), this.blendProgram = new
|
|
4484
|
+
), this.blendProgram = new Ut(
|
|
4485
4485
|
s,
|
|
4486
|
-
|
|
4487
|
-
|
|
4486
|
+
Le,
|
|
4487
|
+
we,
|
|
4488
4488
|
"blend-program-mg"
|
|
4489
|
-
), this.fullScreenMesh = new
|
|
4489
|
+
), this.fullScreenMesh = new te(
|
|
4490
4490
|
s,
|
|
4491
4491
|
this.blendProgram.attrs.a_pos,
|
|
4492
4492
|
this.blendProgram.attrs.a_color,
|
|
@@ -4612,7 +4612,7 @@ class Ms extends qt {
|
|
|
4612
4612
|
let i = null, n = 5;
|
|
4613
4613
|
for (; !i && n > 0; )
|
|
4614
4614
|
try {
|
|
4615
|
-
typeof e == "string" ? i = await
|
|
4615
|
+
typeof e == "string" ? i = await Qt(e, s) : i = await Kt(e);
|
|
4616
4616
|
} catch (l) {
|
|
4617
4617
|
console.warn(
|
|
4618
4618
|
`failed on loading album resource, retrying (${n})`,
|
|
@@ -4628,29 +4628,29 @@ class Ms extends qt {
|
|
|
4628
4628
|
});
|
|
4629
4629
|
if (!a) throw new Error("Failed to create canvas context");
|
|
4630
4630
|
a.clearRect(0, 0, r.width, r.height);
|
|
4631
|
-
const c = i instanceof HTMLVideoElement ? i.videoWidth : i.naturalWidth,
|
|
4632
|
-
if (c *
|
|
4633
|
-
a.drawImage(i, 0, 0, c,
|
|
4634
|
-
const
|
|
4635
|
-
if (
|
|
4636
|
-
this.meshStates[0].texture.dispose(), this.meshStates[0].texture = new
|
|
4631
|
+
const c = i instanceof HTMLVideoElement ? i.videoWidth : i.naturalWidth, h = i instanceof HTMLVideoElement ? i.videoHeight : i.naturalHeight;
|
|
4632
|
+
if (c * h === 0) throw new Error("Invalid image size");
|
|
4633
|
+
a.drawImage(i, 0, 0, c, h, 0, 0, r.width, r.height);
|
|
4634
|
+
const o = a.getImageData(0, 0, r.width, r.height);
|
|
4635
|
+
if (Nt(o, 0.4), Ee(o, 3), Nt(o, 1.7), Se(o, 0.75), be(o, 2, 4), this.manualControl && this.meshStates.length > 0)
|
|
4636
|
+
this.meshStates[0].texture.dispose(), this.meshStates[0].texture = new Wt(this.gl, o);
|
|
4637
4637
|
else {
|
|
4638
|
-
const l = new
|
|
4638
|
+
const l = new Ie(
|
|
4639
4639
|
this.gl,
|
|
4640
4640
|
this.mainProgram.attrs.a_pos,
|
|
4641
4641
|
this.mainProgram.attrs.a_color,
|
|
4642
4642
|
this.mainProgram.attrs.a_uv
|
|
4643
4643
|
);
|
|
4644
4644
|
l.resetSubdivition(15);
|
|
4645
|
-
const
|
|
4646
|
-
l.resizeControlPoints(
|
|
4647
|
-
const g = 2 / (
|
|
4648
|
-
for (const T of
|
|
4645
|
+
const m = qt[Math.floor(Math.random() * qt.length)];
|
|
4646
|
+
l.resizeControlPoints(m.width, m.height);
|
|
4647
|
+
const g = 2 / (m.width - 1), u = 2 / (m.height - 1);
|
|
4648
|
+
for (const T of m.conf) {
|
|
4649
4649
|
const x = l.getControlPoint(T.cx, T.cy);
|
|
4650
4650
|
x.location.x = T.x, x.location.y = T.y, x.uRot = T.ur * Math.PI / 180, x.vRot = T.vr * Math.PI / 180, x.uScale = g * T.up, x.vScale = u * T.vp;
|
|
4651
4651
|
}
|
|
4652
4652
|
l.updateMesh();
|
|
4653
|
-
const M = new
|
|
4653
|
+
const M = new Wt(this.gl, o), p = {
|
|
4654
4654
|
mesh: l,
|
|
4655
4655
|
texture: M,
|
|
4656
4656
|
alpha: 0
|
|
@@ -4670,15 +4670,15 @@ class Ms extends qt {
|
|
|
4670
4670
|
e.mesh.dispose(), e.texture.dispose();
|
|
4671
4671
|
}
|
|
4672
4672
|
}
|
|
4673
|
-
class
|
|
4673
|
+
class ee {
|
|
4674
4674
|
constructor(t, e) {
|
|
4675
|
-
|
|
4676
|
-
|
|
4675
|
+
f(this, "element");
|
|
4676
|
+
f(this, "renderer");
|
|
4677
4677
|
this.renderer = t, this.element = e, e.style.pointerEvents = "none", e.style.zIndex = "-1", e.style.contain = "strict";
|
|
4678
4678
|
}
|
|
4679
4679
|
static new(t) {
|
|
4680
4680
|
const e = document.createElement("canvas");
|
|
4681
|
-
return new
|
|
4681
|
+
return new ee(new t(e), e);
|
|
4682
4682
|
}
|
|
4683
4683
|
setRenderScale(t) {
|
|
4684
4684
|
this.renderer.setRenderScale(t);
|
|
@@ -4714,21 +4714,172 @@ class Vt {
|
|
|
4714
4714
|
this.renderer.dispose(), this.element.remove();
|
|
4715
4715
|
}
|
|
4716
4716
|
}
|
|
4717
|
-
const
|
|
4718
|
-
lyricLine:
|
|
4719
|
-
lyricBgLine:
|
|
4720
|
-
active:
|
|
4721
|
-
lyricDuetLine:
|
|
4722
|
-
lyricMainLine:
|
|
4723
|
-
emphasizeWrapper:
|
|
4724
|
-
emphasize:
|
|
4725
|
-
lyricSubLine:
|
|
4726
|
-
disableSpring:
|
|
4727
|
-
interludeDots:
|
|
4728
|
-
duet:
|
|
4729
|
-
tmpDisableTransition:
|
|
4730
|
-
}
|
|
4731
|
-
|
|
4717
|
+
const ke = "_lyricLine_kocao_6", Re = "_lyricBgLine_kocao_31", Ce = "_active_kocao_40", Be = "_lyricDuetLine_kocao_47", Oe = "_lyricMainLine_kocao_52", Ne = "_emphasizeWrapper_kocao_62", qe = "_emphasize_kocao_62", Ue = "_lyricSubLine_kocao_84", Ve = "_disableSpring_kocao_91", We = "_interludeDots_kocao_96", He = "_duet_kocao_115", $e = "_tmpDisableTransition_kocao_127", N = {
|
|
4718
|
+
lyricLine: ke,
|
|
4719
|
+
lyricBgLine: Re,
|
|
4720
|
+
active: Ce,
|
|
4721
|
+
lyricDuetLine: Be,
|
|
4722
|
+
lyricMainLine: Oe,
|
|
4723
|
+
emphasizeWrapper: Ne,
|
|
4724
|
+
emphasize: qe,
|
|
4725
|
+
lyricSubLine: Ue,
|
|
4726
|
+
disableSpring: Ve,
|
|
4727
|
+
interludeDots: We,
|
|
4728
|
+
duet: He,
|
|
4729
|
+
tmpDisableTransition: $e
|
|
4730
|
+
}, se = -1, Lt = 0, Et = 1, St = 2, Dt = 3, It = 4, At = 5, kt = 6, ie = 7, ne = 8, Ht = typeof self == "object" ? self : globalThis, Ye = (d, t) => {
|
|
4731
|
+
const e = (i, n) => (d.set(n, i), i), s = (i) => {
|
|
4732
|
+
if (d.has(i))
|
|
4733
|
+
return d.get(i);
|
|
4734
|
+
const [n, r] = t[i];
|
|
4735
|
+
switch (n) {
|
|
4736
|
+
case Lt:
|
|
4737
|
+
case se:
|
|
4738
|
+
return e(r, i);
|
|
4739
|
+
case Et: {
|
|
4740
|
+
const a = e([], i);
|
|
4741
|
+
for (const c of r)
|
|
4742
|
+
a.push(s(c));
|
|
4743
|
+
return a;
|
|
4744
|
+
}
|
|
4745
|
+
case St: {
|
|
4746
|
+
const a = e({}, i);
|
|
4747
|
+
for (const [c, h] of r)
|
|
4748
|
+
a[s(c)] = s(h);
|
|
4749
|
+
return a;
|
|
4750
|
+
}
|
|
4751
|
+
case Dt:
|
|
4752
|
+
return e(new Date(r), i);
|
|
4753
|
+
case It: {
|
|
4754
|
+
const { source: a, flags: c } = r;
|
|
4755
|
+
return e(new RegExp(a, c), i);
|
|
4756
|
+
}
|
|
4757
|
+
case At: {
|
|
4758
|
+
const a = e(/* @__PURE__ */ new Map(), i);
|
|
4759
|
+
for (const [c, h] of r)
|
|
4760
|
+
a.set(s(c), s(h));
|
|
4761
|
+
return a;
|
|
4762
|
+
}
|
|
4763
|
+
case kt: {
|
|
4764
|
+
const a = e(/* @__PURE__ */ new Set(), i);
|
|
4765
|
+
for (const c of r)
|
|
4766
|
+
a.add(s(c));
|
|
4767
|
+
return a;
|
|
4768
|
+
}
|
|
4769
|
+
case ie: {
|
|
4770
|
+
const { name: a, message: c } = r;
|
|
4771
|
+
return e(new Ht[a](c), i);
|
|
4772
|
+
}
|
|
4773
|
+
case ne:
|
|
4774
|
+
return e(BigInt(r), i);
|
|
4775
|
+
case "BigInt":
|
|
4776
|
+
return e(Object(BigInt(r)), i);
|
|
4777
|
+
}
|
|
4778
|
+
return e(new Ht[n](r), i);
|
|
4779
|
+
};
|
|
4780
|
+
return s;
|
|
4781
|
+
}, $t = (d) => Ye(/* @__PURE__ */ new Map(), d)(0), nt = "", { toString: Xe } = {}, { keys: Ge } = Object, ot = (d) => {
|
|
4782
|
+
const t = typeof d;
|
|
4783
|
+
if (t !== "object" || !d)
|
|
4784
|
+
return [Lt, t];
|
|
4785
|
+
const e = Xe.call(d).slice(8, -1);
|
|
4786
|
+
switch (e) {
|
|
4787
|
+
case "Array":
|
|
4788
|
+
return [Et, nt];
|
|
4789
|
+
case "Object":
|
|
4790
|
+
return [St, nt];
|
|
4791
|
+
case "Date":
|
|
4792
|
+
return [Dt, nt];
|
|
4793
|
+
case "RegExp":
|
|
4794
|
+
return [It, nt];
|
|
4795
|
+
case "Map":
|
|
4796
|
+
return [At, nt];
|
|
4797
|
+
case "Set":
|
|
4798
|
+
return [kt, nt];
|
|
4799
|
+
}
|
|
4800
|
+
return e.includes("Array") ? [Et, e] : e.includes("Error") ? [ie, e] : [St, e];
|
|
4801
|
+
}, Tt = ([d, t]) => d === Lt && (t === "function" || t === "symbol"), je = (d, t, e, s) => {
|
|
4802
|
+
const i = (r, a) => {
|
|
4803
|
+
const c = s.push(r) - 1;
|
|
4804
|
+
return e.set(a, c), c;
|
|
4805
|
+
}, n = (r) => {
|
|
4806
|
+
if (e.has(r))
|
|
4807
|
+
return e.get(r);
|
|
4808
|
+
let [a, c] = ot(r);
|
|
4809
|
+
switch (a) {
|
|
4810
|
+
case Lt: {
|
|
4811
|
+
let o = r;
|
|
4812
|
+
switch (c) {
|
|
4813
|
+
case "bigint":
|
|
4814
|
+
a = ne, o = r.toString();
|
|
4815
|
+
break;
|
|
4816
|
+
case "function":
|
|
4817
|
+
case "symbol":
|
|
4818
|
+
if (d)
|
|
4819
|
+
throw new TypeError("unable to serialize " + c);
|
|
4820
|
+
o = null;
|
|
4821
|
+
break;
|
|
4822
|
+
case "undefined":
|
|
4823
|
+
return i([se], r);
|
|
4824
|
+
}
|
|
4825
|
+
return i([a, o], r);
|
|
4826
|
+
}
|
|
4827
|
+
case Et: {
|
|
4828
|
+
if (c)
|
|
4829
|
+
return i([c, [...r]], r);
|
|
4830
|
+
const o = [], l = i([a, o], r);
|
|
4831
|
+
for (const m of r)
|
|
4832
|
+
o.push(n(m));
|
|
4833
|
+
return l;
|
|
4834
|
+
}
|
|
4835
|
+
case St: {
|
|
4836
|
+
if (c)
|
|
4837
|
+
switch (c) {
|
|
4838
|
+
case "BigInt":
|
|
4839
|
+
return i([c, r.toString()], r);
|
|
4840
|
+
case "Boolean":
|
|
4841
|
+
case "Number":
|
|
4842
|
+
case "String":
|
|
4843
|
+
return i([c, r.valueOf()], r);
|
|
4844
|
+
}
|
|
4845
|
+
if (t && "toJSON" in r)
|
|
4846
|
+
return n(r.toJSON());
|
|
4847
|
+
const o = [], l = i([a, o], r);
|
|
4848
|
+
for (const m of Ge(r))
|
|
4849
|
+
(d || !Tt(ot(r[m]))) && o.push([n(m), n(r[m])]);
|
|
4850
|
+
return l;
|
|
4851
|
+
}
|
|
4852
|
+
case Dt:
|
|
4853
|
+
return i([a, r.toISOString()], r);
|
|
4854
|
+
case It: {
|
|
4855
|
+
const { source: o, flags: l } = r;
|
|
4856
|
+
return i([a, { source: o, flags: l }], r);
|
|
4857
|
+
}
|
|
4858
|
+
case At: {
|
|
4859
|
+
const o = [], l = i([a, o], r);
|
|
4860
|
+
for (const [m, g] of r)
|
|
4861
|
+
(d || !(Tt(ot(m)) || Tt(ot(g)))) && o.push([n(m), n(g)]);
|
|
4862
|
+
return l;
|
|
4863
|
+
}
|
|
4864
|
+
case kt: {
|
|
4865
|
+
const o = [], l = i([a, o], r);
|
|
4866
|
+
for (const m of r)
|
|
4867
|
+
(d || !Tt(ot(m))) && o.push(n(m));
|
|
4868
|
+
return l;
|
|
4869
|
+
}
|
|
4870
|
+
}
|
|
4871
|
+
const { message: h } = r;
|
|
4872
|
+
return i([a, { name: c, message: h }], r);
|
|
4873
|
+
};
|
|
4874
|
+
return n;
|
|
4875
|
+
}, Yt = (d, { json: t, lossy: e } = {}) => {
|
|
4876
|
+
const s = [];
|
|
4877
|
+
return je(!(t || e), !!t, /* @__PURE__ */ new Map(), s)(d), s;
|
|
4878
|
+
}, Ze = typeof structuredClone == "function" ? (
|
|
4879
|
+
/* c8 ignore start */
|
|
4880
|
+
(d, t) => t && ("json" in t || "lossy" in t) ? $t(Yt(d, t)) : structuredClone(d)
|
|
4881
|
+
) : (d, t) => $t(Yt(d, t));
|
|
4882
|
+
function Xt(d, t = 1) {
|
|
4732
4883
|
let e = 0, s = t;
|
|
4733
4884
|
return (...n) => {
|
|
4734
4885
|
s = t, cancelAnimationFrame(e);
|
|
@@ -4738,35 +4889,35 @@ function kt(d, t = 1) {
|
|
|
4738
4889
|
e = requestAnimationFrame(r);
|
|
4739
4890
|
};
|
|
4740
4891
|
}
|
|
4741
|
-
const
|
|
4742
|
-
function
|
|
4892
|
+
const Je = (d, t) => d.size === t.size && [...d].every((e) => t.has(e));
|
|
4893
|
+
function Qe(d) {
|
|
4743
4894
|
return (e) => (d(e + 1e-3) - d(e - 1e-3)) / (2 * 1e-3);
|
|
4744
4895
|
}
|
|
4745
|
-
function
|
|
4746
|
-
return
|
|
4896
|
+
function Gt(d) {
|
|
4897
|
+
return Qe(d);
|
|
4747
4898
|
}
|
|
4748
|
-
class
|
|
4899
|
+
class mt {
|
|
4749
4900
|
constructor(t = 0) {
|
|
4750
|
-
|
|
4751
|
-
|
|
4752
|
-
|
|
4753
|
-
|
|
4754
|
-
|
|
4755
|
-
|
|
4756
|
-
|
|
4757
|
-
|
|
4758
|
-
|
|
4901
|
+
f(this, "currentPosition", 0);
|
|
4902
|
+
f(this, "targetPosition", 0);
|
|
4903
|
+
f(this, "currentTime", 0);
|
|
4904
|
+
f(this, "params", {});
|
|
4905
|
+
f(this, "currentSolver");
|
|
4906
|
+
f(this, "getV");
|
|
4907
|
+
f(this, "getV2");
|
|
4908
|
+
f(this, "queueParams");
|
|
4909
|
+
f(this, "queuePosition");
|
|
4759
4910
|
this.targetPosition = t, this.currentPosition = this.targetPosition, this.currentSolver = () => this.targetPosition, this.getV = () => 0, this.getV2 = () => 0;
|
|
4760
4911
|
}
|
|
4761
4912
|
resetSolver() {
|
|
4762
4913
|
const t = this.getV(this.currentTime);
|
|
4763
|
-
this.currentTime = 0, this.currentSolver =
|
|
4914
|
+
this.currentTime = 0, this.currentSolver = Ke(
|
|
4764
4915
|
this.currentPosition,
|
|
4765
4916
|
t,
|
|
4766
4917
|
this.targetPosition,
|
|
4767
4918
|
0,
|
|
4768
4919
|
this.params
|
|
4769
|
-
), this.getV =
|
|
4920
|
+
), this.getV = Gt(this.currentSolver), this.getV2 = Gt(this.getV);
|
|
4770
4921
|
}
|
|
4771
4922
|
arrived() {
|
|
4772
4923
|
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;
|
|
@@ -4800,28 +4951,28 @@ class lt {
|
|
|
4800
4951
|
return this.currentPosition;
|
|
4801
4952
|
}
|
|
4802
4953
|
}
|
|
4803
|
-
function
|
|
4804
|
-
const n = (i == null ? void 0 : i.soft) ?? !1, r = (i == null ? void 0 : i.stiffness) ?? 100, a = (i == null ? void 0 : i.damping) ?? 10, c = (i == null ? void 0 : i.mass) ?? 1,
|
|
4954
|
+
function Ke(d, t, e, s = 0, i) {
|
|
4955
|
+
const n = (i == null ? void 0 : i.soft) ?? !1, r = (i == null ? void 0 : i.stiffness) ?? 100, a = (i == null ? void 0 : i.damping) ?? 10, c = (i == null ? void 0 : i.mass) ?? 1, h = e - d;
|
|
4805
4956
|
if (n || 1 <= a / (2 * Math.sqrt(r * c))) {
|
|
4806
|
-
const u = -Math.sqrt(r / c), M = -u *
|
|
4807
|
-
return (p) => (p -= s, p < 0 ? d : e - (
|
|
4957
|
+
const u = -Math.sqrt(r / c), M = -u * h - t;
|
|
4958
|
+
return (p) => (p -= s, p < 0 ? d : e - (h + p * M) * Math.E ** (p * u));
|
|
4808
4959
|
}
|
|
4809
|
-
const
|
|
4810
|
-
return (u) => (u -= s, u < 0 ? d : e - (Math.cos(u *
|
|
4960
|
+
const o = Math.sqrt(4 * c * r - a ** 2), l = (a * h - 2 * c * t) / o, m = 0.5 * o / c, g = -(0.5 * a) / c;
|
|
4961
|
+
return (u) => (u -= s, u < 0 ? d : e - (Math.cos(u * m) * h + Math.sin(u * m) * l) * Math.E ** (u * g));
|
|
4811
4962
|
}
|
|
4812
|
-
class
|
|
4963
|
+
class ts {
|
|
4813
4964
|
constructor(t) {
|
|
4814
|
-
|
|
4815
|
-
|
|
4816
|
-
|
|
4817
|
-
|
|
4965
|
+
f(this, "element", document.createElement("div"));
|
|
4966
|
+
f(this, "left", 0);
|
|
4967
|
+
f(this, "top", 0);
|
|
4968
|
+
f(this, "delay", 0);
|
|
4818
4969
|
// 由 LyricPlayer 来设置
|
|
4819
|
-
|
|
4820
|
-
|
|
4821
|
-
posX: new
|
|
4822
|
-
posY: new
|
|
4970
|
+
f(this, "lineSize", [0, 0]);
|
|
4971
|
+
f(this, "lineTransforms", {
|
|
4972
|
+
posX: new mt(0),
|
|
4973
|
+
posY: new mt(0)
|
|
4823
4974
|
});
|
|
4824
|
-
|
|
4975
|
+
f(this, "lastStyle", "");
|
|
4825
4976
|
this.lyricPlayer = t, this.element.setAttribute("class", N.lyricLine), this.rebuildStyle();
|
|
4826
4977
|
}
|
|
4827
4978
|
measureSize() {
|
|
@@ -4859,30 +5010,28 @@ class Ae {
|
|
|
4859
5010
|
this.element.remove();
|
|
4860
5011
|
}
|
|
4861
5012
|
}
|
|
4862
|
-
function
|
|
5013
|
+
function es(d) {
|
|
4863
5014
|
const e = 2.5949095;
|
|
4864
|
-
return d < 0.5 ?
|
|
5015
|
+
return d < 0.5 ? (2 * d) ** 2 * ((e + 1) * 2 * d - e) / 2 : ((2 * d - 2) ** 2 * ((e + 1) * (d * 2 - 2) + e) + 2) / 2;
|
|
4865
5016
|
}
|
|
4866
|
-
function
|
|
5017
|
+
function ss(d) {
|
|
4867
5018
|
return d === 1 ? 1 : 1 - 2 ** (-10 * d);
|
|
4868
5019
|
}
|
|
4869
5020
|
const Z = (d, t, e) => Math.max(d, Math.min(t, e));
|
|
4870
|
-
class
|
|
4871
|
-
constructor(
|
|
4872
|
-
|
|
4873
|
-
|
|
4874
|
-
|
|
4875
|
-
|
|
4876
|
-
|
|
4877
|
-
|
|
4878
|
-
|
|
4879
|
-
|
|
4880
|
-
|
|
4881
|
-
|
|
4882
|
-
|
|
4883
|
-
|
|
4884
|
-
m(this, "targetBreatheDuration", 1500);
|
|
4885
|
-
this.lyricPlayer = t, this.element.className = N.interludeDots, this.element.appendChild(this.dot0), this.element.appendChild(this.dot1), this.element.appendChild(this.dot2);
|
|
5021
|
+
class is {
|
|
5022
|
+
constructor() {
|
|
5023
|
+
f(this, "element", document.createElement("div"));
|
|
5024
|
+
f(this, "dot0", document.createElement("span"));
|
|
5025
|
+
f(this, "dot1", document.createElement("span"));
|
|
5026
|
+
f(this, "dot2", document.createElement("span"));
|
|
5027
|
+
f(this, "left", 0);
|
|
5028
|
+
f(this, "top", 0);
|
|
5029
|
+
f(this, "playing", !0);
|
|
5030
|
+
f(this, "lastStyle", "");
|
|
5031
|
+
f(this, "currentInterlude");
|
|
5032
|
+
f(this, "currentTime", 0);
|
|
5033
|
+
f(this, "targetBreatheDuration", 1500);
|
|
5034
|
+
this.element.className = N.interludeDots, this.element.appendChild(this.dot0), this.element.appendChild(this.dot1), this.element.appendChild(this.dot2);
|
|
4886
5035
|
}
|
|
4887
5036
|
getElement() {
|
|
4888
5037
|
return this.element;
|
|
@@ -4910,7 +5059,7 @@ class Ce {
|
|
|
4910
5059
|
if (i <= s) {
|
|
4911
5060
|
const n = s / Math.ceil(s / this.targetBreatheDuration);
|
|
4912
5061
|
let r = 1, a = 1;
|
|
4913
|
-
r *= Math.sin(1.5 * Math.PI - i / n * 2) / 20 + 1, i < 2e3 && (r *=
|
|
5062
|
+
r *= Math.sin(1.5 * Math.PI - i / n * 2) / 20 + 1, i < 2e3 && (r *= ss(i / 2e3)), i < 500 ? a = 0 : i < 1e3 && (a *= (i - 500) / 500), s - i < 750 && (r *= 1 - es(
|
|
4914
5063
|
(750 - (s - i)) / 750 / 2
|
|
4915
5064
|
)), s - i < 375 && (a *= Z(
|
|
4916
5065
|
0,
|
|
@@ -4919,11 +5068,11 @@ class Ce {
|
|
|
4919
5068
|
));
|
|
4920
5069
|
const c = Math.max(0, s - 750);
|
|
4921
5070
|
r = Math.max(0, r) * 0.7, e += ` scale(${r})`;
|
|
4922
|
-
const
|
|
5071
|
+
const h = Z(
|
|
4923
5072
|
0.25,
|
|
4924
5073
|
i * 3 / c * 0.75,
|
|
4925
5074
|
1
|
|
4926
|
-
),
|
|
5075
|
+
), o = Z(
|
|
4927
5076
|
0.25,
|
|
4928
5077
|
(i - c / 3) * 3 / c * 0.75,
|
|
4929
5078
|
1
|
|
@@ -4934,11 +5083,11 @@ class Ce {
|
|
|
4934
5083
|
);
|
|
4935
5084
|
this.dot0.style.opacity = `${Z(
|
|
4936
5085
|
0,
|
|
4937
|
-
Math.max(0, a *
|
|
5086
|
+
Math.max(0, a * h),
|
|
4938
5087
|
1
|
|
4939
5088
|
)}`, this.dot1.style.opacity = `${Z(
|
|
4940
5089
|
0,
|
|
4941
|
-
Math.max(0, a *
|
|
5090
|
+
Math.max(0, a * o),
|
|
4942
5091
|
1
|
|
4943
5092
|
)}`, this.dot2.style.opacity = `${Z(
|
|
4944
5093
|
0,
|
|
@@ -4955,65 +5104,65 @@ class Ce {
|
|
|
4955
5104
|
this.element.remove();
|
|
4956
5105
|
}
|
|
4957
5106
|
}
|
|
4958
|
-
function
|
|
5107
|
+
function ns(d) {
|
|
4959
5108
|
return d && d.__esModule && Object.prototype.hasOwnProperty.call(d, "default") ? d.default : d;
|
|
4960
5109
|
}
|
|
4961
|
-
var
|
|
4962
|
-
function
|
|
5110
|
+
var rs = 4, as = 1e-3, cs = 1e-7, os = 10, lt = 11, xt = 1 / (lt - 1), hs = typeof Float32Array == "function";
|
|
5111
|
+
function re(d, t) {
|
|
4963
5112
|
return 1 - 3 * t + 3 * d;
|
|
4964
5113
|
}
|
|
4965
|
-
function
|
|
5114
|
+
function ae(d, t) {
|
|
4966
5115
|
return 3 * t - 6 * d;
|
|
4967
5116
|
}
|
|
4968
|
-
function
|
|
5117
|
+
function ce(d) {
|
|
4969
5118
|
return 3 * d;
|
|
4970
5119
|
}
|
|
4971
|
-
function
|
|
4972
|
-
return ((
|
|
5120
|
+
function wt(d, t, e) {
|
|
5121
|
+
return ((re(t, e) * d + ae(t, e)) * d + ce(t)) * d;
|
|
4973
5122
|
}
|
|
4974
|
-
function
|
|
4975
|
-
return 3 *
|
|
5123
|
+
function oe(d, t, e) {
|
|
5124
|
+
return 3 * re(t, e) * d * d + 2 * ae(t, e) * d + ce(t);
|
|
4976
5125
|
}
|
|
4977
|
-
function
|
|
5126
|
+
function ls(d, t, e, s, i) {
|
|
4978
5127
|
var n, r, a = 0;
|
|
4979
5128
|
do
|
|
4980
|
-
r = t + (e - t) / 2, n =
|
|
4981
|
-
while (Math.abs(n) >
|
|
5129
|
+
r = t + (e - t) / 2, n = wt(r, s, i) - d, n > 0 ? e = r : t = r;
|
|
5130
|
+
while (Math.abs(n) > cs && ++a < os);
|
|
4982
5131
|
return r;
|
|
4983
5132
|
}
|
|
4984
|
-
function
|
|
4985
|
-
for (var i = 0; i <
|
|
4986
|
-
var n =
|
|
5133
|
+
function ds(d, t, e, s) {
|
|
5134
|
+
for (var i = 0; i < rs; ++i) {
|
|
5135
|
+
var n = oe(t, e, s);
|
|
4987
5136
|
if (n === 0)
|
|
4988
5137
|
return t;
|
|
4989
|
-
var r =
|
|
5138
|
+
var r = wt(t, e, s) - d;
|
|
4990
5139
|
t -= r / n;
|
|
4991
5140
|
}
|
|
4992
5141
|
return t;
|
|
4993
5142
|
}
|
|
4994
|
-
function
|
|
5143
|
+
function ms(d) {
|
|
4995
5144
|
return d;
|
|
4996
5145
|
}
|
|
4997
|
-
var
|
|
5146
|
+
var fs = function(t, e, s, i) {
|
|
4998
5147
|
if (!(0 <= t && t <= 1 && 0 <= s && s <= 1))
|
|
4999
5148
|
throw new Error("bezier x values must be in [0, 1] range");
|
|
5000
5149
|
if (t === e && s === i)
|
|
5001
|
-
return
|
|
5002
|
-
for (var n =
|
|
5003
|
-
n[r] =
|
|
5150
|
+
return ms;
|
|
5151
|
+
for (var n = hs ? new Float32Array(lt) : new Array(lt), r = 0; r < lt; ++r)
|
|
5152
|
+
n[r] = wt(r * xt, t, s);
|
|
5004
5153
|
function a(c) {
|
|
5005
|
-
for (var
|
|
5006
|
-
|
|
5007
|
-
--
|
|
5008
|
-
var
|
|
5009
|
-
return u >=
|
|
5010
|
-
}
|
|
5011
|
-
return function(
|
|
5012
|
-
return
|
|
5154
|
+
for (var h = 0, o = 1, l = lt - 1; o !== l && n[o] <= c; ++o)
|
|
5155
|
+
h += xt;
|
|
5156
|
+
--o;
|
|
5157
|
+
var m = (c - n[o]) / (n[o + 1] - n[o]), g = h + m * xt, u = oe(g, t, s);
|
|
5158
|
+
return u >= as ? ds(c, g, t, s) : u === 0 ? g : ls(c, h, h + xt, t, s);
|
|
5159
|
+
}
|
|
5160
|
+
return function(h) {
|
|
5161
|
+
return h === 0 ? 0 : h === 1 ? 1 : wt(a(h), e, i);
|
|
5013
5162
|
};
|
|
5014
5163
|
};
|
|
5015
|
-
const
|
|
5016
|
-
function
|
|
5164
|
+
const he = /* @__PURE__ */ ns(fs);
|
|
5165
|
+
function ps() {
|
|
5017
5166
|
return [
|
|
5018
5167
|
1,
|
|
5019
5168
|
0,
|
|
@@ -5033,7 +5182,7 @@ function Xe() {
|
|
|
5033
5182
|
1
|
|
5034
5183
|
];
|
|
5035
5184
|
}
|
|
5036
|
-
function
|
|
5185
|
+
function gs(d, t = 1, e = { x: 0, y: 0 }) {
|
|
5037
5186
|
const [s, i] = [e.x, e.y];
|
|
5038
5187
|
return [
|
|
5039
5188
|
d[0] * t,
|
|
@@ -5054,36 +5203,36 @@ function Ge(d, t = 1, e = { x: 0, y: 0 }) {
|
|
|
5054
5203
|
d[15]
|
|
5055
5204
|
];
|
|
5056
5205
|
}
|
|
5057
|
-
function
|
|
5206
|
+
function us(d, t = 4) {
|
|
5058
5207
|
const e = (s, i) => s.toFixed(t);
|
|
5059
5208
|
return `matrix3d(${d.map(e).join(", ")})`;
|
|
5060
5209
|
}
|
|
5061
|
-
const
|
|
5062
|
-
let
|
|
5063
|
-
function
|
|
5064
|
-
let d =
|
|
5210
|
+
const zt = [], _t = [];
|
|
5211
|
+
let Ft = !1;
|
|
5212
|
+
function ys() {
|
|
5213
|
+
let d = _t.shift();
|
|
5065
5214
|
for (; d; ) {
|
|
5066
5215
|
try {
|
|
5067
5216
|
d.resolve(d.task());
|
|
5068
5217
|
} catch (t) {
|
|
5069
5218
|
d.reject(t);
|
|
5070
5219
|
}
|
|
5071
|
-
d =
|
|
5220
|
+
d = _t.shift();
|
|
5072
5221
|
}
|
|
5073
|
-
for (d =
|
|
5222
|
+
for (d = zt.shift(); d; ) {
|
|
5074
5223
|
try {
|
|
5075
5224
|
d.resolve(d.task());
|
|
5076
5225
|
} catch (t) {
|
|
5077
5226
|
d.reject(t);
|
|
5078
5227
|
}
|
|
5079
|
-
d =
|
|
5228
|
+
d = zt.shift();
|
|
5080
5229
|
}
|
|
5081
|
-
|
|
5230
|
+
Ft = !1;
|
|
5082
5231
|
}
|
|
5083
|
-
function
|
|
5084
|
-
|
|
5232
|
+
function le() {
|
|
5233
|
+
Ft || (Ft = !0, requestAnimationFrame(ys));
|
|
5085
5234
|
}
|
|
5086
|
-
function
|
|
5235
|
+
function Ms(d) {
|
|
5087
5236
|
const t = {
|
|
5088
5237
|
task: d,
|
|
5089
5238
|
resolve: () => {
|
|
@@ -5093,9 +5242,9 @@ function Qe(d) {
|
|
|
5093
5242
|
}, e = new Promise((s, i) => {
|
|
5094
5243
|
t.resolve = s, t.reject = i;
|
|
5095
5244
|
});
|
|
5096
|
-
return
|
|
5245
|
+
return zt.push(t), le(), e;
|
|
5097
5246
|
}
|
|
5098
|
-
function
|
|
5247
|
+
function jt(d) {
|
|
5099
5248
|
const t = {
|
|
5100
5249
|
task: d,
|
|
5101
5250
|
resolve: () => {
|
|
@@ -5105,17 +5254,17 @@ function Ct(d) {
|
|
|
5105
5254
|
}, e = new Promise((s, i) => {
|
|
5106
5255
|
t.resolve = s, t.reject = i;
|
|
5107
5256
|
});
|
|
5108
|
-
return
|
|
5257
|
+
return _t.push(t), le(), e;
|
|
5109
5258
|
}
|
|
5110
|
-
const
|
|
5111
|
-
function
|
|
5259
|
+
const Ts = /^[\p{Unified_Ideograph}\u0800-\u9FFC]+$/u, bt = 32, de = (d, t) => (e) => Math.min(1, Math.max(0, (e - d) / (t - d))), Rt = 0.5, xs = de(0, Rt), bs = de(Rt, 1), Es = he(0.2, 0.4, 0.58, 1), Ss = he(0.3, 0, 0.58, 1), ws = (d) => (t) => t < d ? Es(xs(t)) : 1 - Ss(bs(t));
|
|
5260
|
+
function Zt(d, t = 0, e = "rgba(0,0,0,var(--bright-mask-alpha, 1.0))", s = "rgba(0,0,0,var(--dark-mask-alpha, 1.0))") {
|
|
5112
5261
|
const i = 2 + d + t, n = d / i, r = (1 - n) / 2;
|
|
5113
5262
|
return [
|
|
5114
5263
|
`linear-gradient(to right,${e} ${r * 100}%,${s} ${(r + n) * 100}%)`,
|
|
5115
5264
|
i
|
|
5116
5265
|
];
|
|
5117
5266
|
}
|
|
5118
|
-
function
|
|
5267
|
+
function Ls(d) {
|
|
5119
5268
|
const t = [];
|
|
5120
5269
|
for (const n of d) {
|
|
5121
5270
|
const r = n.word.replace(/\s/g, "").length, a = n.word.split(" ").filter((c) => c.trim().length > 0);
|
|
@@ -5126,17 +5275,17 @@ function ns(d) {
|
|
|
5126
5275
|
endTime: 0
|
|
5127
5276
|
});
|
|
5128
5277
|
let c = 0;
|
|
5129
|
-
for (const
|
|
5130
|
-
const
|
|
5131
|
-
word:
|
|
5278
|
+
for (const h of a) {
|
|
5279
|
+
const o = {
|
|
5280
|
+
word: h,
|
|
5132
5281
|
startTime: n.startTime + c / r * (n.endTime - n.startTime),
|
|
5133
|
-
endTime: n.startTime + (c +
|
|
5282
|
+
endTime: n.startTime + (c + h.length) / r * (n.endTime - n.startTime)
|
|
5134
5283
|
};
|
|
5135
|
-
t.push(
|
|
5284
|
+
t.push(o), t.push({
|
|
5136
5285
|
word: " ",
|
|
5137
5286
|
startTime: 0,
|
|
5138
5287
|
endTime: 0
|
|
5139
|
-
}), c +=
|
|
5288
|
+
}), c += h.length;
|
|
5140
5289
|
}
|
|
5141
5290
|
n.word.endsWith(" ") || t.pop();
|
|
5142
5291
|
} else
|
|
@@ -5148,19 +5297,19 @@ function ns(d) {
|
|
|
5148
5297
|
const i = [];
|
|
5149
5298
|
for (const n of t) {
|
|
5150
5299
|
const r = n.word;
|
|
5151
|
-
e.push(r), s.push(n), r.length > 0 && r.trim().length === 0 ? (e.pop(), s.pop(), s.length === 1 ? i.push(s[0]) : s.length > 1 && i.push(s), i.push(n), e = [], s = []) : (!/^\s*[^\s]*\s*$/.test(e.join("")) ||
|
|
5300
|
+
e.push(r), s.push(n), r.length > 0 && r.trim().length === 0 ? (e.pop(), s.pop(), s.length === 1 ? i.push(s[0]) : s.length > 1 && i.push(s), i.push(n), e = [], s = []) : (!/^\s*[^\s]*\s*$/.test(e.join("")) || Ts.test(r)) && (e.pop(), s.pop(), s.length === 1 ? i.push(s[0]) : s.length > 1 && i.push(s), e = [r], s = [n]);
|
|
5152
5301
|
}
|
|
5153
5302
|
return s.length === 1 ? i.push(s[0]) : i.push(s), i;
|
|
5154
5303
|
}
|
|
5155
|
-
function
|
|
5304
|
+
function ht(d) {
|
|
5156
5305
|
return d.endTime - d.startTime >= 1e3 && d.word.trim().length <= 7 && d.word.trim().length > 1;
|
|
5157
5306
|
}
|
|
5158
|
-
class
|
|
5307
|
+
class Ps extends MouseEvent {
|
|
5159
5308
|
constructor(t, e) {
|
|
5160
5309
|
super(e.type, e), this.line = t;
|
|
5161
5310
|
}
|
|
5162
5311
|
}
|
|
5163
|
-
function
|
|
5312
|
+
function vs(d) {
|
|
5164
5313
|
const t = d.match(/matrix\(([^)]+)\)/);
|
|
5165
5314
|
if (t) {
|
|
5166
5315
|
const e = t[1].split(", "), s = Number.parseFloat(e[0]), i = Number.parseFloat(e[3]);
|
|
@@ -5168,7 +5317,7 @@ function as(d) {
|
|
|
5168
5317
|
}
|
|
5169
5318
|
return 1;
|
|
5170
5319
|
}
|
|
5171
|
-
class
|
|
5320
|
+
class zs extends EventTarget {
|
|
5172
5321
|
constructor(e, s = {
|
|
5173
5322
|
words: [],
|
|
5174
5323
|
translatedLyric: "",
|
|
@@ -5179,36 +5328,36 @@ class cs extends EventTarget {
|
|
|
5179
5328
|
isDuet: !1
|
|
5180
5329
|
}) {
|
|
5181
5330
|
super();
|
|
5182
|
-
|
|
5183
|
-
|
|
5184
|
-
|
|
5185
|
-
|
|
5186
|
-
|
|
5187
|
-
|
|
5188
|
-
|
|
5331
|
+
f(this, "element", document.createElement("div"));
|
|
5332
|
+
f(this, "left", 0);
|
|
5333
|
+
f(this, "top", 0);
|
|
5334
|
+
f(this, "scale", 1);
|
|
5335
|
+
f(this, "blur", 0);
|
|
5336
|
+
f(this, "delay", 0);
|
|
5337
|
+
f(this, "splittedWords", []);
|
|
5189
5338
|
// 由 LyricPlayer 来设置
|
|
5190
|
-
|
|
5191
|
-
|
|
5192
|
-
posX: new
|
|
5193
|
-
posY: new
|
|
5194
|
-
scale: new
|
|
5339
|
+
f(this, "lineSize", [0, 0]);
|
|
5340
|
+
f(this, "lineTransforms", {
|
|
5341
|
+
posX: new mt(0),
|
|
5342
|
+
posY: new mt(0),
|
|
5343
|
+
scale: new mt(100)
|
|
5195
5344
|
});
|
|
5196
|
-
|
|
5197
|
-
|
|
5198
|
-
const s = new
|
|
5345
|
+
f(this, "listenersMap", /* @__PURE__ */ new Map());
|
|
5346
|
+
f(this, "onMouseEvent", (e) => {
|
|
5347
|
+
const s = new Ps(this, e);
|
|
5199
5348
|
for (const i of this.listenersMap.get(e.type) ?? [])
|
|
5200
5349
|
i.call(this, s);
|
|
5201
5350
|
if (!this.dispatchEvent(s) || s.defaultPrevented)
|
|
5202
5351
|
return e.preventDefault(), e.stopPropagation(), e.stopImmediatePropagation(), !1;
|
|
5203
5352
|
});
|
|
5204
|
-
|
|
5205
|
-
|
|
5206
|
-
|
|
5207
|
-
|
|
5208
|
-
|
|
5209
|
-
|
|
5210
|
-
|
|
5211
|
-
|
|
5353
|
+
f(this, "isEnabled", !1);
|
|
5354
|
+
f(this, "hasFaded", !1);
|
|
5355
|
+
f(this, "lastWord");
|
|
5356
|
+
f(this, "_hide", !0);
|
|
5357
|
+
f(this, "_prevParentEl", null);
|
|
5358
|
+
f(this, "lastStyle", "");
|
|
5359
|
+
f(this, "maskImageDirty", !1);
|
|
5360
|
+
f(this, "markImageDirtyPromises", []);
|
|
5212
5361
|
this.lyricPlayer = e, this.lyricLine = s, this._prevParentEl = e.getElement(), this.element.setAttribute("class", N.lyricLine), this.lyricLine.isBG && this.element.classList.add(N.lyricBgLine), this.lyricLine.isDuet && this.element.classList.add(N.lyricDuetLine), this.element.appendChild(document.createElement("div")), this.element.appendChild(document.createElement("div")), this.element.appendChild(document.createElement("div"));
|
|
5213
5362
|
const i = this.element.children[0], n = this.element.children[1], r = this.element.children[2];
|
|
5214
5363
|
i.setAttribute("class", N.lyricMainLine), n.setAttribute("class", N.lyricSubLine), r.setAttribute("class", N.lyricSubLine), this.rebuildElement(), this.rebuildStyle();
|
|
@@ -5318,35 +5467,35 @@ class cs extends EventTarget {
|
|
|
5318
5467
|
e.innerText = this.lyricLine.words.map((r) => r.word).join(""), s.innerText = this.lyricLine.translatedLyric, i.innerText = this.lyricLine.romanLyric;
|
|
5319
5468
|
return;
|
|
5320
5469
|
}
|
|
5321
|
-
const n =
|
|
5470
|
+
const n = Ls(this.lyricLine.words);
|
|
5322
5471
|
e.innerHTML = "";
|
|
5323
5472
|
for (const r of n)
|
|
5324
5473
|
if (Array.isArray(r)) {
|
|
5325
5474
|
if (r.length === 0) continue;
|
|
5326
5475
|
const a = r.reduce(
|
|
5327
|
-
(l,
|
|
5476
|
+
(l, m) => (l.endTime = Math.max(l.endTime, m.endTime), l.startTime = Math.min(l.startTime, m.startTime), l.word += m.word, l),
|
|
5328
5477
|
{
|
|
5329
5478
|
word: "",
|
|
5330
5479
|
startTime: Number.POSITIVE_INFINITY,
|
|
5331
5480
|
endTime: Number.NEGATIVE_INFINITY
|
|
5332
5481
|
}
|
|
5333
|
-
), c = r.map((l) =>
|
|
5334
|
-
|
|
5335
|
-
const
|
|
5482
|
+
), c = r.map((l) => ht(l)).reduce((l, m) => l || m, ht(a)), h = document.createElement("span");
|
|
5483
|
+
h.classList.add(N.emphasizeWrapper);
|
|
5484
|
+
const o = [];
|
|
5336
5485
|
for (const l of r) {
|
|
5337
|
-
const
|
|
5486
|
+
const m = document.createElement("span");
|
|
5338
5487
|
if (c) {
|
|
5339
|
-
|
|
5488
|
+
m.classList.add(N.emphasize);
|
|
5340
5489
|
const g = [];
|
|
5341
5490
|
for (const M of l.word.trim().split("")) {
|
|
5342
5491
|
const p = document.createElement("span");
|
|
5343
|
-
p.innerText = M, g.push(p),
|
|
5492
|
+
p.innerText = M, g.push(p), o.push(p), m.appendChild(p);
|
|
5344
5493
|
}
|
|
5345
5494
|
const u = {
|
|
5346
5495
|
...l,
|
|
5347
|
-
mainElement:
|
|
5496
|
+
mainElement: m,
|
|
5348
5497
|
subElements: g,
|
|
5349
|
-
elementAnimations: [this.initFloatAnimation(l,
|
|
5498
|
+
elementAnimations: [this.initFloatAnimation(l, m)],
|
|
5350
5499
|
maskAnimations: [],
|
|
5351
5500
|
width: 0,
|
|
5352
5501
|
height: 0,
|
|
@@ -5355,31 +5504,31 @@ class cs extends EventTarget {
|
|
|
5355
5504
|
};
|
|
5356
5505
|
this.splittedWords.push(u);
|
|
5357
5506
|
} else
|
|
5358
|
-
|
|
5507
|
+
m.innerText = l.word, this.splittedWords.push({
|
|
5359
5508
|
...l,
|
|
5360
|
-
mainElement:
|
|
5509
|
+
mainElement: m,
|
|
5361
5510
|
subElements: [],
|
|
5362
|
-
elementAnimations: [this.initFloatAnimation(l,
|
|
5511
|
+
elementAnimations: [this.initFloatAnimation(l, m)],
|
|
5363
5512
|
maskAnimations: [],
|
|
5364
5513
|
width: 0,
|
|
5365
5514
|
height: 0,
|
|
5366
5515
|
padding: 0,
|
|
5367
5516
|
shouldEmphasize: c
|
|
5368
5517
|
});
|
|
5369
|
-
|
|
5518
|
+
h.appendChild(m);
|
|
5370
5519
|
}
|
|
5371
5520
|
c && this.splittedWords[this.splittedWords.length - 1].elementAnimations.push(
|
|
5372
5521
|
...this.initEmphasizeAnimation(
|
|
5373
5522
|
a,
|
|
5374
|
-
|
|
5523
|
+
o,
|
|
5375
5524
|
a.endTime - a.startTime,
|
|
5376
5525
|
a.startTime - this.lyricLine.startTime
|
|
5377
5526
|
)
|
|
5378
|
-
), a.word.trimStart() !== a.word && e.appendChild(document.createTextNode(" ")), e.appendChild(
|
|
5527
|
+
), a.word.trimStart() !== a.word && e.appendChild(document.createTextNode(" ")), e.appendChild(h), a.word.trimEnd() !== a.word && ht(a) && e.appendChild(document.createTextNode(" "));
|
|
5379
5528
|
} else if (r.word.trim().length === 0)
|
|
5380
5529
|
e.appendChild(document.createTextNode(" "));
|
|
5381
5530
|
else {
|
|
5382
|
-
const a =
|
|
5531
|
+
const a = ht(r), c = document.createElement("span"), h = {
|
|
5383
5532
|
...r,
|
|
5384
5533
|
mainElement: c,
|
|
5385
5534
|
subElements: [],
|
|
@@ -5390,26 +5539,26 @@ class cs extends EventTarget {
|
|
|
5390
5539
|
padding: 0,
|
|
5391
5540
|
shouldEmphasize: a
|
|
5392
5541
|
};
|
|
5393
|
-
if (
|
|
5542
|
+
if (ht(r)) {
|
|
5394
5543
|
c.classList.add(N.emphasize);
|
|
5395
|
-
const
|
|
5396
|
-
for (const
|
|
5544
|
+
const o = [];
|
|
5545
|
+
for (const m of r.word.trim().split("")) {
|
|
5397
5546
|
const g = document.createElement("span");
|
|
5398
|
-
g.innerText =
|
|
5547
|
+
g.innerText = m, o.push(g), c.appendChild(g);
|
|
5399
5548
|
}
|
|
5400
|
-
|
|
5401
|
-
const l = Math.abs(
|
|
5402
|
-
|
|
5549
|
+
h.subElements = o;
|
|
5550
|
+
const l = Math.abs(h.endTime - h.startTime);
|
|
5551
|
+
h.elementAnimations.push(
|
|
5403
5552
|
...this.initEmphasizeAnimation(
|
|
5404
5553
|
r,
|
|
5405
|
-
|
|
5554
|
+
o,
|
|
5406
5555
|
l,
|
|
5407
|
-
|
|
5556
|
+
h.startTime - this.lyricLine.startTime
|
|
5408
5557
|
)
|
|
5409
5558
|
);
|
|
5410
5559
|
} else
|
|
5411
5560
|
c.innerText = r.word.trim();
|
|
5412
|
-
r.word.trimStart() !== r.word && e.appendChild(document.createTextNode(" ")), e.appendChild(c), r.word.trimEnd() !== r.word && e.appendChild(document.createTextNode(" ")), this.splittedWords.push(
|
|
5561
|
+
r.word.trimStart() !== r.word && e.appendChild(document.createTextNode(" ")), e.appendChild(c), r.word.trimEnd() !== r.word && e.appendChild(document.createTextNode(" ")), this.splittedWords.push(h);
|
|
5413
5562
|
}
|
|
5414
5563
|
s.innerText = this.lyricLine.translatedLyric, i.innerText = this.lyricLine.romanLyric;
|
|
5415
5564
|
}
|
|
@@ -5441,26 +5590,26 @@ class cs extends EventTarget {
|
|
|
5441
5590
|
// 为了避免产生锯齿抖动感,使用 matrix3d 来实现缩放和位移
|
|
5442
5591
|
initEmphasizeAnimation(e, s, i, n) {
|
|
5443
5592
|
const r = Math.max(0, n);
|
|
5444
|
-
let a = Math.max(1e3, i), c = [],
|
|
5445
|
-
|
|
5446
|
-
let
|
|
5447
|
-
|
|
5593
|
+
let a = Math.max(1e3, i), c = [], h = a / 2e3;
|
|
5594
|
+
h = h > 1 ? Math.sqrt(h) : h ** 3;
|
|
5595
|
+
let o = a / 3e3;
|
|
5596
|
+
o = o > 1 ? Math.sqrt(o) : o ** 3, h *= 0.6, o *= 0.5, this.lyricLine.words.length > 0 && e.word.includes(
|
|
5448
5597
|
this.lyricLine.words[this.lyricLine.words.length - 1].word
|
|
5449
|
-
) && (
|
|
5450
|
-
const l = Number.isFinite(a) ? a : 0,
|
|
5598
|
+
) && (h *= 1.6, o *= 1.5, a *= 1.2), h = Math.min(1.2, h), o = Math.min(0.8, o);
|
|
5599
|
+
const l = Number.isFinite(a) ? a : 0, m = ws(Rt);
|
|
5451
5600
|
return c = s.flatMap((g, u, M) => {
|
|
5452
|
-
const p = r + a / 2.5 / M.length * u, T = [], x = new Array(
|
|
5453
|
-
const
|
|
5601
|
+
const p = r + a / 2.5 / M.length * u, T = [], x = new Array(bt).fill(0).map((w, S) => {
|
|
5602
|
+
const _ = (S + 1) / bt, v = m(_), z = m(_) * o, P = gs(ps(), 1 + v * 0.1 * h), A = -v * 0.03 * h * (M.length / 2 - u), R = -v * 0.025 * h;
|
|
5454
5603
|
return {
|
|
5455
|
-
offset:
|
|
5456
|
-
transform: `${
|
|
5457
|
-
|
|
5604
|
+
offset: _,
|
|
5605
|
+
transform: `${us(
|
|
5606
|
+
P,
|
|
5458
5607
|
4
|
|
5459
|
-
)} translate(${
|
|
5608
|
+
)} translate(${A}em, ${R}em)`,
|
|
5460
5609
|
textShadow: `0 0 ${Math.min(
|
|
5461
5610
|
0.3,
|
|
5462
|
-
|
|
5463
|
-
)}em rgba(255, 255, 255, ${
|
|
5611
|
+
o * 0.3
|
|
5612
|
+
)}em rgba(255, 255, 255, ${z})`
|
|
5464
5613
|
};
|
|
5465
5614
|
}), L = g.animate(x, {
|
|
5466
5615
|
duration: l,
|
|
@@ -5468,31 +5617,29 @@ class cs extends EventTarget {
|
|
|
5468
5617
|
id: `emphasize-word-${g.innerText}-${u}`,
|
|
5469
5618
|
iterations: 1,
|
|
5470
5619
|
composite: "replace",
|
|
5471
|
-
easing: "linear",
|
|
5472
5620
|
fill: "both"
|
|
5473
5621
|
});
|
|
5474
5622
|
L.onfinish = () => {
|
|
5475
5623
|
L.pause();
|
|
5476
5624
|
}, L.pause(), T.push(L);
|
|
5477
|
-
const
|
|
5478
|
-
const
|
|
5479
|
-
let
|
|
5480
|
-
return this.lyricLine.isBG && (
|
|
5481
|
-
offset:
|
|
5482
|
-
transform: `translateY(${-
|
|
5625
|
+
const E = new Array(bt).fill(0).map((w, S) => {
|
|
5626
|
+
const _ = (S + 1) / bt;
|
|
5627
|
+
let v = Math.sin(_ * Math.PI);
|
|
5628
|
+
return this.lyricLine.isBG && (v *= 2), {
|
|
5629
|
+
offset: _,
|
|
5630
|
+
transform: `translateY(${-v * 0.05}em)`
|
|
5483
5631
|
};
|
|
5484
|
-
}),
|
|
5632
|
+
}), b = g.animate(E, {
|
|
5485
5633
|
duration: l * 1.4,
|
|
5486
5634
|
delay: Number.isFinite(p) ? p - 400 : 0,
|
|
5487
5635
|
id: "emphasize-word-float",
|
|
5488
5636
|
iterations: 1,
|
|
5489
5637
|
composite: "add",
|
|
5490
|
-
easing: "linear",
|
|
5491
5638
|
fill: "both"
|
|
5492
5639
|
});
|
|
5493
|
-
return
|
|
5494
|
-
|
|
5495
|
-
},
|
|
5640
|
+
return b.onfinish = () => {
|
|
5641
|
+
b.pause();
|
|
5642
|
+
}, b.pause(), T.push(b), T;
|
|
5496
5643
|
}), c;
|
|
5497
5644
|
}
|
|
5498
5645
|
get totalDuration() {
|
|
@@ -5510,16 +5657,16 @@ class cs extends EventTarget {
|
|
|
5510
5657
|
}
|
|
5511
5658
|
async updateMaskImage() {
|
|
5512
5659
|
const e = this.markImageDirtyPromises;
|
|
5513
|
-
this.markImageDirtyPromises = [], this.maskImageDirty = !1, this._hide && await
|
|
5660
|
+
this.markImageDirtyPromises = [], this.maskImageDirty = !1, this._hide && await jt(() => {
|
|
5514
5661
|
this._prevParentEl && this._prevParentEl.appendChild(this.element), this.element.style.display = "", this.element.style.visibility = "hidden";
|
|
5515
5662
|
});
|
|
5516
5663
|
for (const s of this.splittedWords) {
|
|
5517
5664
|
const i = s.mainElement;
|
|
5518
|
-
i ? await
|
|
5665
|
+
i ? await Ms(() => {
|
|
5519
5666
|
s.padding = Number.parseFloat(getComputedStyle(i).paddingLeft), s.width = i.clientWidth - s.padding * 2, s.height = i.clientHeight - s.padding * 2;
|
|
5520
5667
|
}) : (s.width = 0, s.height = 0, s.padding = 0);
|
|
5521
5668
|
}
|
|
5522
|
-
this.lyricPlayer.supportMaskImage ? this.generateWebAnimationBasedMaskImage() : this.generateCalcBasedMaskImage(), this._hide && await
|
|
5669
|
+
this.lyricPlayer.supportMaskImage ? this.generateWebAnimationBasedMaskImage() : this.generateCalcBasedMaskImage(), this._hide && await jt(() => {
|
|
5523
5670
|
this._prevParentEl && this.element.remove(), this.element.style.display = "none", this.element.style.visibility = "";
|
|
5524
5671
|
});
|
|
5525
5672
|
for (const s of e)
|
|
@@ -5530,12 +5677,12 @@ class cs extends EventTarget {
|
|
|
5530
5677
|
const s = e.mainElement;
|
|
5531
5678
|
if (s) {
|
|
5532
5679
|
e.width = s.clientWidth, e.height = s.clientHeight;
|
|
5533
|
-
const i = e.height * this.lyricPlayer.wordFadeWidth, [n, r] =
|
|
5680
|
+
const i = e.height * this.lyricPlayer.wordFadeWidth, [n, r] = Zt(
|
|
5534
5681
|
i / e.width
|
|
5535
5682
|
), a = `${r * 100}% 100%`;
|
|
5536
5683
|
this.lyricPlayer.supportMaskImage ? (s.style.maskImage = n, s.style.maskRepeat = "no-repeat", s.style.maskOrigin = "left", s.style.maskSize = a) : (s.style.webkitMaskImage = n, s.style.webkitMaskRepeat = "no-repeat", s.style.webkitMaskOrigin = "left", s.style.webkitMaskSize = a);
|
|
5537
|
-
const c = e.width + i,
|
|
5538
|
-
s.style.maskPosition =
|
|
5684
|
+
const c = e.width + i, h = `clamp(${-c}px,calc(${-c}px + (var(--amll-player-time) - ${e.startTime})*${c / Math.abs(e.endTime - e.startTime)}px),0px) 0px, left top`;
|
|
5685
|
+
s.style.maskPosition = h, s.style.webkitMaskPosition = h;
|
|
5539
5686
|
}
|
|
5540
5687
|
}
|
|
5541
5688
|
}
|
|
@@ -5547,63 +5694,59 @@ class cs extends EventTarget {
|
|
|
5547
5694
|
this.splittedWords.forEach((s, i) => {
|
|
5548
5695
|
const n = s.mainElement;
|
|
5549
5696
|
if (n) {
|
|
5550
|
-
const r = s.height * this.lyricPlayer.wordFadeWidth, [a, c] =
|
|
5697
|
+
const r = s.height * this.lyricPlayer.wordFadeWidth, [a, c] = Zt(
|
|
5551
5698
|
r / (s.width + s.padding * 2)
|
|
5552
|
-
),
|
|
5553
|
-
this.lyricPlayer.supportMaskImage ? (n.style.maskImage = a, n.style.maskRepeat = "no-repeat", n.style.maskOrigin = "left", n.style.maskSize =
|
|
5554
|
-
const
|
|
5555
|
-
let g = -
|
|
5699
|
+
), h = `${c * 100}% 100%`;
|
|
5700
|
+
this.lyricPlayer.supportMaskImage ? (n.style.maskImage = a, n.style.maskRepeat = "no-repeat", n.style.maskOrigin = "left", n.style.maskSize = h) : (n.style.webkitMaskImage = a, n.style.webkitMaskRepeat = "no-repeat", n.style.webkitMaskOrigin = "left", n.style.webkitMaskSize = h);
|
|
5701
|
+
const o = this.splittedWords.slice(0, i).reduce((E, b) => E + b.width, 0) + (this.splittedWords[0] ? r : 0), l = -(s.width + s.padding * 2 + r), m = (E) => Math.max(l, Math.min(0, E));
|
|
5702
|
+
let g = -o - s.width - s.padding - r, u = 0;
|
|
5556
5703
|
const M = [];
|
|
5557
5704
|
let p = g, T = 0;
|
|
5558
5705
|
const x = () => {
|
|
5559
|
-
const
|
|
5706
|
+
const E = g - p, b = Math.max(0, Math.min(1, u)), w = b - T, S = Math.abs(w / E);
|
|
5560
5707
|
if (g > l && p < l) {
|
|
5561
|
-
const
|
|
5562
|
-
offset: T +
|
|
5563
|
-
maskPosition:
|
|
5564
|
-
easing: b
|
|
5708
|
+
const z = Math.abs(p - l) * S, P = `${m(p)}px 0`, A = {
|
|
5709
|
+
offset: T + z,
|
|
5710
|
+
maskPosition: P
|
|
5565
5711
|
};
|
|
5566
5712
|
M.push(A);
|
|
5567
5713
|
}
|
|
5568
5714
|
if (g > 0 && p < 0) {
|
|
5569
|
-
const
|
|
5570
|
-
offset: T +
|
|
5571
|
-
maskPosition:
|
|
5572
|
-
easing: b
|
|
5715
|
+
const z = Math.abs(p) * S, P = `${m(g)}px 0`, A = {
|
|
5716
|
+
offset: T + z,
|
|
5717
|
+
maskPosition: P
|
|
5573
5718
|
};
|
|
5574
5719
|
M.push(A);
|
|
5575
5720
|
}
|
|
5576
|
-
const
|
|
5577
|
-
offset:
|
|
5578
|
-
maskPosition:
|
|
5579
|
-
easing: b
|
|
5721
|
+
const _ = `${m(g)}px 0`, v = {
|
|
5722
|
+
offset: b,
|
|
5723
|
+
maskPosition: _
|
|
5580
5724
|
};
|
|
5581
|
-
M.push(
|
|
5725
|
+
M.push(v), p = g, T = b;
|
|
5582
5726
|
};
|
|
5583
5727
|
x();
|
|
5584
5728
|
let L = 0;
|
|
5585
|
-
this.splittedWords.forEach((
|
|
5729
|
+
this.splittedWords.forEach((E, b) => {
|
|
5586
5730
|
{
|
|
5587
|
-
const w =
|
|
5731
|
+
const w = E.startTime - this.lyricLine.startTime, S = w - L;
|
|
5588
5732
|
u += S / e, S > 0 && x(), L = w;
|
|
5589
5733
|
}
|
|
5590
5734
|
{
|
|
5591
|
-
const w =
|
|
5592
|
-
u += w / e, g +=
|
|
5735
|
+
const w = E.endTime - E.startTime;
|
|
5736
|
+
u += w / e, g += E.width, b === 0 && (g += r * 1.5), b === this.splittedWords.length - 1 && (g += r * 0.5), w > 0 && x(), L += w;
|
|
5593
5737
|
}
|
|
5594
5738
|
});
|
|
5595
|
-
for (const
|
|
5596
|
-
|
|
5739
|
+
for (const E of s.maskAnimations)
|
|
5740
|
+
E.cancel();
|
|
5597
5741
|
try {
|
|
5598
|
-
const
|
|
5742
|
+
const E = n.animate(M, {
|
|
5599
5743
|
duration: e || 1,
|
|
5600
5744
|
id: `fade-word-${s.word}-${i}`,
|
|
5601
|
-
fill: "both"
|
|
5602
|
-
easing: "cubic-bezier(1,1,.66,.99)"
|
|
5745
|
+
fill: "both"
|
|
5603
5746
|
});
|
|
5604
|
-
|
|
5605
|
-
} catch (
|
|
5606
|
-
console.warn("应用渐变动画发生错误", M, e,
|
|
5747
|
+
E.pause(), s.maskAnimations = [E];
|
|
5748
|
+
} catch (E) {
|
|
5749
|
+
console.warn("应用渐变动画发生错误", M, e, E);
|
|
5607
5750
|
}
|
|
5608
5751
|
}
|
|
5609
5752
|
});
|
|
@@ -5611,21 +5754,21 @@ class cs extends EventTarget {
|
|
|
5611
5754
|
getElement() {
|
|
5612
5755
|
return this.element;
|
|
5613
5756
|
}
|
|
5614
|
-
setTransform(e = this.left, s = this.top, i = this.scale, n = 1, r = 0.4, a = 0, c = !1,
|
|
5615
|
-
const
|
|
5616
|
-
this.left = e, this.top = s, this.scale = i, this.delay =
|
|
5617
|
-
const
|
|
5618
|
-
if (
|
|
5757
|
+
setTransform(e = this.left, s = this.top, i = this.scale, n = 1, r = 0.4, a = 0, c = !1, h = 0) {
|
|
5758
|
+
const o = this.isInSight, l = this.lyricPlayer.getEnableSpring();
|
|
5759
|
+
this.left = e, this.top = s, this.scale = i, this.delay = h * 1e3 | 0;
|
|
5760
|
+
const m = this.element.children[0], g = this.element.children[1], u = this.element.children[2];
|
|
5761
|
+
if (m.style.opacity = `${n}`, g.style.opacity = `${r}`, u.style.opacity = `${r}`, c || !l) {
|
|
5619
5762
|
if (this.blur = Math.min(32, a), c && this.element.classList.add(N.tmpDisableTransition), this.lineTransforms.posX.setPosition(e), this.lineTransforms.posY.setPosition(s), this.lineTransforms.scale.setPosition(i), l)
|
|
5620
5763
|
this.rebuildStyle();
|
|
5621
5764
|
else {
|
|
5622
5765
|
const M = this.isInSight;
|
|
5623
|
-
|
|
5766
|
+
o || M ? this.show() : this.hide();
|
|
5624
5767
|
}
|
|
5625
5768
|
c && requestAnimationFrame(() => {
|
|
5626
5769
|
this.element.classList.remove(N.tmpDisableTransition);
|
|
5627
5770
|
});
|
|
5628
|
-
} else if (this.lineTransforms.posX.setTargetPosition(e,
|
|
5771
|
+
} else if (this.lineTransforms.posX.setTargetPosition(e, h), this.lineTransforms.posY.setTargetPosition(s, h), this.lineTransforms.scale.setTargetPosition(i), this.blur !== Math.min(32, a)) {
|
|
5629
5772
|
this.blur = Math.min(32, a);
|
|
5630
5773
|
const M = a.toFixed(3);
|
|
5631
5774
|
this.element.style.filter = `blur(${M}px)`;
|
|
@@ -5654,7 +5797,7 @@ class cs extends EventTarget {
|
|
|
5654
5797
|
) * 0.2 + 0.2}`
|
|
5655
5798
|
);
|
|
5656
5799
|
else {
|
|
5657
|
-
const i = window.getComputedStyle(this.element).transform, n =
|
|
5800
|
+
const i = window.getComputedStyle(this.element).transform, n = vs(i);
|
|
5658
5801
|
this.element.style.setProperty(
|
|
5659
5802
|
"--bright-mask-alpha",
|
|
5660
5803
|
`${Math.max(0, Math.min(1, (n - 0.97) / 0.03)) * 0.8 + 0.2}`
|
|
@@ -5668,8 +5811,8 @@ class cs extends EventTarget {
|
|
|
5668
5811
|
return `[位移: ${this.left}, ${this.top}; 缩放: ${this.scale}; 延时: ${this.delay}]`;
|
|
5669
5812
|
}
|
|
5670
5813
|
get isInSight() {
|
|
5671
|
-
const e = this.lineTransforms.posX.getCurrentPosition(), s = this.lineTransforms.posY.getCurrentPosition(), i = this.lineSize[0], n = this.lineSize[1], r = e + i, a = s + n, c = this.lyricPlayer.size[0],
|
|
5672
|
-
return !(e > c + i || r < -i || s >
|
|
5814
|
+
const e = this.lineTransforms.posX.getCurrentPosition(), s = this.lineTransforms.posY.getCurrentPosition(), i = this.lineSize[0], n = this.lineSize[1], r = e + i, a = s + n, c = this.lyricPlayer.size[0], h = this.lyricPlayer.size[1];
|
|
5815
|
+
return !(e > c + i || r < -i || s > h + n || a < -n);
|
|
5673
5816
|
}
|
|
5674
5817
|
disposeElements() {
|
|
5675
5818
|
var e, s;
|
|
@@ -5688,43 +5831,43 @@ class cs extends EventTarget {
|
|
|
5688
5831
|
this.disposeElements(), this.element.remove();
|
|
5689
5832
|
}
|
|
5690
5833
|
}
|
|
5691
|
-
class
|
|
5834
|
+
class _s extends MouseEvent {
|
|
5692
5835
|
constructor(t, e, s) {
|
|
5693
5836
|
super(`line-${s.type}`, s), this.lineIndex = t, this.line = e;
|
|
5694
5837
|
}
|
|
5695
5838
|
}
|
|
5696
|
-
class
|
|
5839
|
+
class qs extends EventTarget {
|
|
5697
5840
|
constructor() {
|
|
5698
5841
|
super();
|
|
5699
|
-
|
|
5700
|
-
|
|
5701
|
-
|
|
5702
|
-
|
|
5703
|
-
|
|
5704
|
-
|
|
5705
|
-
|
|
5706
|
-
|
|
5707
|
-
|
|
5708
|
-
|
|
5709
|
-
|
|
5710
|
-
|
|
5711
|
-
|
|
5712
|
-
|
|
5713
|
-
|
|
5714
|
-
|
|
5715
|
-
|
|
5716
|
-
|
|
5717
|
-
|
|
5718
|
-
|
|
5719
|
-
|
|
5842
|
+
f(this, "element", document.createElement("div"));
|
|
5843
|
+
f(this, "currentTime", 0);
|
|
5844
|
+
f(this, "lastCurrentTime", 0);
|
|
5845
|
+
f(this, "lyricLines", []);
|
|
5846
|
+
f(this, "processedLines", []);
|
|
5847
|
+
f(this, "lyricLinesEl", []);
|
|
5848
|
+
f(this, "lyricLinesSize", /* @__PURE__ */ new WeakMap());
|
|
5849
|
+
f(this, "lyricLinesIndexes", /* @__PURE__ */ new WeakMap());
|
|
5850
|
+
f(this, "hotLines", /* @__PURE__ */ new Set());
|
|
5851
|
+
f(this, "bufferedLines", /* @__PURE__ */ new Set());
|
|
5852
|
+
f(this, "scrollToIndex", 0);
|
|
5853
|
+
f(this, "_wordFadeWidth", 0.5);
|
|
5854
|
+
f(this, "allowScroll", !0);
|
|
5855
|
+
f(this, "scrolledHandler", 0);
|
|
5856
|
+
f(this, "isScrolled", !1);
|
|
5857
|
+
f(this, "isSeeking", !1);
|
|
5858
|
+
f(this, "initializeSeeking", !1);
|
|
5859
|
+
f(this, "invokedByScrollEvent", !1);
|
|
5860
|
+
f(this, "scrollOffset", 0);
|
|
5861
|
+
f(this, "hidePassedLines", !1);
|
|
5862
|
+
f(this, "debounceCalcLayout", Xt(async () => {
|
|
5720
5863
|
this.calcLayout(!0, !0), this.lyricLinesEl.forEach((e, s) => {
|
|
5721
5864
|
e.markMaskImageDirty().then(() => {
|
|
5722
5865
|
this.hotLines.has(s) && e.enable(this.currentTime);
|
|
5723
5866
|
});
|
|
5724
5867
|
});
|
|
5725
5868
|
}, 5));
|
|
5726
|
-
|
|
5727
|
-
|
|
5869
|
+
f(this, "resizeObserver", new ResizeObserver(
|
|
5870
|
+
Xt(
|
|
5728
5871
|
(e) => {
|
|
5729
5872
|
const s = e[0].contentRect;
|
|
5730
5873
|
this.size[0] = s.width, this.size[1] = s.height;
|
|
@@ -5741,17 +5884,17 @@ class Ts extends EventTarget {
|
|
|
5741
5884
|
5
|
|
5742
5885
|
)
|
|
5743
5886
|
));
|
|
5744
|
-
|
|
5887
|
+
f(this, "posXSpringParams", {
|
|
5745
5888
|
mass: 1,
|
|
5746
5889
|
damping: 10,
|
|
5747
5890
|
stiffness: 100
|
|
5748
5891
|
});
|
|
5749
|
-
|
|
5892
|
+
f(this, "posYSpringParams", {
|
|
5750
5893
|
mass: 0.9,
|
|
5751
5894
|
damping: 15,
|
|
5752
5895
|
stiffness: 90
|
|
5753
5896
|
});
|
|
5754
|
-
|
|
5897
|
+
f(this, "scaleSpringParams", {
|
|
5755
5898
|
mass: 2,
|
|
5756
5899
|
damping: 25,
|
|
5757
5900
|
stiffness: 100
|
|
@@ -5761,61 +5904,61 @@ class Ts extends EventTarget {
|
|
|
5761
5904
|
// damping: 25,
|
|
5762
5905
|
// stiffness: 40,
|
|
5763
5906
|
// };
|
|
5764
|
-
|
|
5907
|
+
f(this, "scaleForBGSpringParams", {
|
|
5765
5908
|
mass: 1,
|
|
5766
5909
|
damping: 20,
|
|
5767
5910
|
stiffness: 50
|
|
5768
5911
|
});
|
|
5769
|
-
|
|
5770
|
-
|
|
5771
|
-
|
|
5772
|
-
|
|
5773
|
-
|
|
5774
|
-
|
|
5775
|
-
|
|
5776
|
-
|
|
5777
|
-
|
|
5778
|
-
|
|
5779
|
-
|
|
5780
|
-
|
|
5781
|
-
|
|
5782
|
-
|
|
5783
|
-
|
|
5784
|
-
|
|
5785
|
-
const s = new
|
|
5912
|
+
f(this, "enableBlur", !0);
|
|
5913
|
+
f(this, "enableScale", !0);
|
|
5914
|
+
f(this, "interludeDots");
|
|
5915
|
+
f(this, "interludeDotsSize", [0, 0]);
|
|
5916
|
+
f(this, "bottomLine");
|
|
5917
|
+
f(this, "supportPlusLighter", CSS.supports("mix-blend-mode", "plus-lighter"));
|
|
5918
|
+
f(this, "supportMaskImage", CSS.supports("mask-image", "none"));
|
|
5919
|
+
f(this, "disableSpring", !1);
|
|
5920
|
+
f(this, "alignAnchor", "center");
|
|
5921
|
+
f(this, "alignPosition", 0.35);
|
|
5922
|
+
f(this, "isNonDynamic", !1);
|
|
5923
|
+
f(this, "isNonDuet", !1);
|
|
5924
|
+
f(this, "scrollBoundary", [0, 0]);
|
|
5925
|
+
f(this, "size", [0, 0]);
|
|
5926
|
+
f(this, "innerSize", [0, 0]);
|
|
5927
|
+
f(this, "onLineClickedHandler", (e) => {
|
|
5928
|
+
const s = new _s(
|
|
5786
5929
|
this.lyricLinesIndexes.get(e.line) ?? -1,
|
|
5787
5930
|
e.line,
|
|
5788
5931
|
e
|
|
5789
5932
|
);
|
|
5790
5933
|
this.dispatchEvent(s) || (e.preventDefault(), e.stopPropagation(), e.stopImmediatePropagation());
|
|
5791
5934
|
});
|
|
5792
|
-
|
|
5935
|
+
f(this, "_baseFontSize", Number.parseFloat(
|
|
5793
5936
|
getComputedStyle(this.element).fontSize
|
|
5794
5937
|
));
|
|
5795
|
-
|
|
5796
|
-
|
|
5938
|
+
f(this, "isPageVisible", !0);
|
|
5939
|
+
f(this, "onPageShow", () => {
|
|
5797
5940
|
this.isPageVisible = !0, this.setCurrentTime(this.currentTime, !0);
|
|
5798
5941
|
});
|
|
5799
|
-
|
|
5942
|
+
f(this, "onPageHide", () => {
|
|
5800
5943
|
this.isPageVisible = !1;
|
|
5801
5944
|
});
|
|
5802
|
-
this.interludeDots = new
|
|
5803
|
-
let e = 0, s = "none", i = 0, n = 0, r = 0, a = Symbol("amll-scroll"), c = 0,
|
|
5804
|
-
this.element.addEventListener("touchstart", (
|
|
5805
|
-
this.beginScrollHandler() && (
|
|
5806
|
-
}), this.element.addEventListener("touchmove", (
|
|
5945
|
+
this.interludeDots = new is(), this.bottomLine = new ts(this), this.element.classList.add("amll-lyric-player", "dom"), this.disableSpring && this.element.classList.add(N.disableSpring), this.rebuildStyle(), this.resizeObserver.observe(this.element), this.element.appendChild(this.interludeDots.getElement()), this.element.appendChild(this.bottomLine.getElement()), this.interludeDots.setTransform(0, 200), window.addEventListener("pageshow", this.onPageShow), window.addEventListener("pagehide", this.onPageHide);
|
|
5946
|
+
let e = 0, s = "none", i = 0, n = 0, r = 0, a = Symbol("amll-scroll"), c = 0, h = 0;
|
|
5947
|
+
this.element.addEventListener("touchstart", (o) => {
|
|
5948
|
+
this.beginScrollHandler() && (o.preventDefault(), e = this.scrollOffset, i = o.touches[0].screenY, c = i, n = Date.now(), r = 0);
|
|
5949
|
+
}), this.element.addEventListener("touchmove", (o) => {
|
|
5807
5950
|
if (this.beginScrollHandler()) {
|
|
5808
|
-
|
|
5809
|
-
const l =
|
|
5810
|
-
s !== u ? (s = u, e = this.scrollOffset, i = l, n = Date.now()) : this.scrollOffset = e -
|
|
5951
|
+
o.preventDefault();
|
|
5952
|
+
const l = o.touches[0].screenY, m = l - i, g = l - c, u = g > 0 ? "down" : g < 0 ? "up" : "none";
|
|
5953
|
+
s !== u ? (s = u, e = this.scrollOffset, i = l, n = Date.now()) : this.scrollOffset = e - m, c = l, h = Date.now(), this.limitScrollOffset(), this.calcLayout(!0);
|
|
5811
5954
|
}
|
|
5812
|
-
}), this.element.addEventListener("touchend", (
|
|
5955
|
+
}), this.element.addEventListener("touchend", (o) => {
|
|
5813
5956
|
if (this.beginScrollHandler()) {
|
|
5814
|
-
|
|
5957
|
+
o.preventDefault(), i = 0;
|
|
5815
5958
|
const l = Date.now();
|
|
5816
|
-
if (l -
|
|
5817
|
-
const
|
|
5818
|
-
r = (this.scrollOffset - e) /
|
|
5959
|
+
if (l - h > 100) return this.endScrollHandler();
|
|
5960
|
+
const m = l - n;
|
|
5961
|
+
r = (this.scrollOffset - e) / m * 1e3;
|
|
5819
5962
|
let g = 0;
|
|
5820
5963
|
const u = Symbol("amll-scroll");
|
|
5821
5964
|
a = u;
|
|
@@ -5824,8 +5967,8 @@ class Ts extends EventTarget {
|
|
|
5824
5967
|
};
|
|
5825
5968
|
requestAnimationFrame(M), this.endScrollHandler();
|
|
5826
5969
|
}
|
|
5827
|
-
}), this.element.addEventListener("wheel", (
|
|
5828
|
-
this.beginScrollHandler() && (
|
|
5970
|
+
}), this.element.addEventListener("wheel", (o) => {
|
|
5971
|
+
this.beginScrollHandler() && (o.deltaMode === o.DOM_DELTA_PIXEL ? (this.scrollOffset += o.deltaY, this.limitScrollOffset(), this.calcLayout(!0)) : (this.scrollOffset += o.deltaY * 50, this.limitScrollOffset(), this.calcLayout(!1)), this.endScrollHandler());
|
|
5829
5972
|
});
|
|
5830
5973
|
}
|
|
5831
5974
|
/**
|
|
@@ -5992,64 +6135,35 @@ class Ts extends EventTarget {
|
|
|
5992
6135
|
* @param initialTime 初始时间,默认为 0
|
|
5993
6136
|
*/
|
|
5994
6137
|
setLyricLines(e, s = 0) {
|
|
5995
|
-
for (const
|
|
5996
|
-
for (const
|
|
5997
|
-
|
|
5998
|
-
this.lastCurrentTime = s, this.currentTime = s, this.lyricLines = e;
|
|
5999
|
-
const i
|
|
6000
|
-
|
|
6001
|
-
(n) => n.words.reduce((r, a) => r + a.word.trim().length, 0) > 0
|
|
6002
|
-
).map((n, r, a) => {
|
|
6003
|
-
if (n.isBG)
|
|
6004
|
-
return {
|
|
6005
|
-
...n
|
|
6006
|
-
};
|
|
6007
|
-
if (r === 0)
|
|
6008
|
-
return {
|
|
6009
|
-
...n,
|
|
6010
|
-
startTime: Math.max(n.startTime - i, 0)
|
|
6011
|
-
};
|
|
6012
|
-
const c = a[r - 1], o = a[r - 2];
|
|
6013
|
-
if (c != null && c.isBG && o) {
|
|
6014
|
-
if (o.endTime < n.startTime)
|
|
6015
|
-
return {
|
|
6016
|
-
...n,
|
|
6017
|
-
startTime: Math.max(o.endTime, n.startTime - i) || n.startTime
|
|
6018
|
-
};
|
|
6019
|
-
} else if (c != null && c.endTime && c.endTime < n.startTime)
|
|
6020
|
-
return {
|
|
6021
|
-
...n,
|
|
6022
|
-
startTime: Math.max(c == null ? void 0 : c.endTime, n.startTime - i) || n.startTime
|
|
6023
|
-
};
|
|
6024
|
-
return {
|
|
6025
|
-
...n
|
|
6026
|
-
};
|
|
6027
|
-
}), this.isNonDynamic = !0, this.isNonDuet = !0;
|
|
6028
|
-
for (const n of this.processedLines)
|
|
6029
|
-
if (n.words.length > 1) {
|
|
6138
|
+
for (const i of e)
|
|
6139
|
+
for (const n of i.words)
|
|
6140
|
+
n.word = n.word.replace(/\s+/g, " ");
|
|
6141
|
+
this.lastCurrentTime = s, this.currentTime = s, this.lyricLines = e, this.processedLines = Ze(e), this.isNonDynamic = !0, this.isNonDuet = !0;
|
|
6142
|
+
for (const i of this.processedLines)
|
|
6143
|
+
if (i.words.length > 1) {
|
|
6030
6144
|
this.isNonDynamic = !1;
|
|
6031
6145
|
break;
|
|
6032
6146
|
}
|
|
6033
|
-
for (const
|
|
6034
|
-
if (
|
|
6147
|
+
for (const i of this.processedLines)
|
|
6148
|
+
if (i.isDuet) {
|
|
6035
6149
|
this.isNonDuet = !1;
|
|
6036
6150
|
break;
|
|
6037
6151
|
}
|
|
6038
|
-
this.rebuildStyle(), this.processedLines.forEach((n, r
|
|
6039
|
-
const
|
|
6040
|
-
|
|
6041
|
-
}), this.processedLines.forEach((n, r
|
|
6042
|
-
if (
|
|
6043
|
-
const
|
|
6044
|
-
|
|
6152
|
+
this.rebuildStyle(), this.processedLines.forEach((i, n, r) => {
|
|
6153
|
+
const a = r[n + 1];
|
|
6154
|
+
i.words[i.words.length - 1] && (a ? a.startTime > i.endTime && (i.endTime = Math.min(i.endTime + 1500, a.startTime)) : i.endTime = i.endTime + 1500);
|
|
6155
|
+
}), this.processedLines.forEach((i, n, r) => {
|
|
6156
|
+
if (i.isBG) return;
|
|
6157
|
+
const a = r[n + 1];
|
|
6158
|
+
a != null && a.isBG && (a.startTime = Math.min(a.startTime, i.startTime));
|
|
6045
6159
|
});
|
|
6046
|
-
for (const
|
|
6047
|
-
|
|
6048
|
-
this.lyricLinesEl = this.processedLines.map((
|
|
6049
|
-
const
|
|
6050
|
-
return
|
|
6051
|
-
}), this.lyricLinesEl.forEach((
|
|
6052
|
-
this.element.appendChild(
|
|
6160
|
+
for (const i of this.lyricLinesEl)
|
|
6161
|
+
i.removeMouseEventListener("click", this.onLineClickedHandler), i.removeMouseEventListener("contextmenu", this.onLineClickedHandler), i.dispose();
|
|
6162
|
+
this.lyricLinesEl = this.processedLines.map((i) => {
|
|
6163
|
+
const n = new zs(this, i);
|
|
6164
|
+
return n.addMouseEventListener("click", this.onLineClickedHandler), n.addMouseEventListener("contextmenu", this.onLineClickedHandler), n;
|
|
6165
|
+
}), this.lyricLinesEl.forEach((i, n) => {
|
|
6166
|
+
this.element.appendChild(i.getElement()), this.lyricLinesIndexes.set(i, n), i.markMaskImageDirty();
|
|
6053
6167
|
}), this.interludeDots.setInterlude(void 0), this.hotLines.clear(), this.bufferedLines.clear(), this.setLinePosXSpringParams({}), this.setLinePosYSpringParams({}), this.setLineScaleSpringParams({}), this.resetScroll(), this.setCurrentTime(0, !0), this.calcLayout(!0, !0);
|
|
6054
6168
|
}
|
|
6055
6169
|
/**
|
|
@@ -6080,7 +6194,6 @@ class Ts extends EventTarget {
|
|
|
6080
6194
|
calcLayout(e = !1, s = !1) {
|
|
6081
6195
|
var u;
|
|
6082
6196
|
if (s) {
|
|
6083
|
-
this.emUnit = Number.parseFloat(getComputedStyle(this.element).fontSize);
|
|
6084
6197
|
for (const M of this.lyricLinesEl) {
|
|
6085
6198
|
const p = M.measureSize();
|
|
6086
6199
|
this.lyricLinesSize.set(M, p), M.lineSize = p;
|
|
@@ -6098,9 +6211,9 @@ class Ts extends EventTarget {
|
|
|
6098
6211
|
0
|
|
6099
6212
|
);
|
|
6100
6213
|
this.scrollBoundary[0] = -c, n -= c, n += this.size[1] * this.alignPosition;
|
|
6101
|
-
const
|
|
6102
|
-
if (
|
|
6103
|
-
const M = ((u = this.lyricLinesSize.get(
|
|
6214
|
+
const h = this.lyricLinesEl[r];
|
|
6215
|
+
if (h) {
|
|
6216
|
+
const M = ((u = this.lyricLinesSize.get(h)) == null ? void 0 : u[1]) ?? 0;
|
|
6104
6217
|
switch (this.alignAnchor) {
|
|
6105
6218
|
case "bottom":
|
|
6106
6219
|
n -= M;
|
|
@@ -6110,31 +6223,30 @@ class Ts extends EventTarget {
|
|
|
6110
6223
|
break;
|
|
6111
6224
|
}
|
|
6112
6225
|
}
|
|
6113
|
-
const
|
|
6114
|
-
let l = 0,
|
|
6226
|
+
const o = Math.max(...this.bufferedLines);
|
|
6227
|
+
let l = 0, m = 0.05, g = !1;
|
|
6115
6228
|
this.lyricLinesEl.forEach((M, p) => {
|
|
6116
|
-
var
|
|
6117
|
-
const T = this.bufferedLines.has(p), x = T || p >= this.scrollToIndex && p <
|
|
6118
|
-
let
|
|
6119
|
-
L.isDuet && (
|
|
6120
|
-
let
|
|
6121
|
-
this.hidePassedLines ? p < (i ? i[2] + 1 : this.scrollToIndex) ? (
|
|
6229
|
+
var v, z, P;
|
|
6230
|
+
const T = this.bufferedLines.has(p), x = T || p >= this.scrollToIndex && p < o, L = M.getLine();
|
|
6231
|
+
let E = 24;
|
|
6232
|
+
L.isDuet && (E = this.size[0] - (((v = this.lyricLinesSize.get(M)) == null ? void 0 : v[0]) ?? 0)), !g && a >= 4e3 && (p === this.scrollToIndex && (i == null ? void 0 : i[2]) === -2 || p === this.scrollToIndex + 1) && (g = !0, this.interludeDots.setTransform(24, n + 10), i && this.interludeDots.setInterlude([i[0], i[1]]), n += this.interludeDotsSize[1] + 40);
|
|
6233
|
+
let b, w;
|
|
6234
|
+
this.hidePassedLines ? p < (i ? i[2] + 1 : this.scrollToIndex) ? (b = 0, w = 0) : T ? (b = 0.85, w = 0.4) : (b = this.isNonDynamic ? 0.2 : 1, w = 0.2) : T ? (b = 0.85, w = 0.4) : (b = this.isNonDynamic ? 0.2 : 1, w = 0.2);
|
|
6122
6235
|
let S = 0;
|
|
6123
6236
|
this.enableBlur && (x ? S = 0 : (S = 1, p < this.scrollToIndex ? S += Math.abs(this.scrollToIndex - p) + 1 : S += Math.abs(
|
|
6124
|
-
p - Math.max(this.scrollToIndex,
|
|
6237
|
+
p - Math.max(this.scrollToIndex, o)
|
|
6125
6238
|
))), this.invokedByScrollEvent && (S = 0);
|
|
6126
|
-
const
|
|
6239
|
+
const _ = this.enableScale ? 97 : 100;
|
|
6127
6240
|
M.setTransform(
|
|
6128
|
-
b,
|
|
6129
|
-
n,
|
|
6130
|
-
x ? 100 : L.isBG ? 75 : P,
|
|
6131
6241
|
E,
|
|
6242
|
+
n,
|
|
6243
|
+
x ? 100 : L.isBG ? 75 : _,
|
|
6244
|
+
b,
|
|
6132
6245
|
w,
|
|
6133
6246
|
window.innerWidth <= 1024 ? S * 0.8 : S,
|
|
6134
6247
|
e,
|
|
6135
|
-
l
|
|
6136
|
-
|
|
6137
|
-
), L.isBG && x ? n += ((v = this.lyricLinesSize.get(M)) == null ? void 0 : v[1]) ?? 0 : L.isBG || (n += ((I = this.lyricLinesSize.get(M)) == null ? void 0 : I[1]) ?? 0), n >= 0 && !this.isSeeking && (L.isBG || (l += f), p >= this.scrollToIndex && (f /= 1.05));
|
|
6248
|
+
l
|
|
6249
|
+
), L.isBG && x ? n += ((z = this.lyricLinesSize.get(M)) == null ? void 0 : z[1]) ?? 0 : L.isBG || (n += ((P = this.lyricLinesSize.get(M)) == null ? void 0 : P[1]) ?? 0), n >= 0 && !this.isSeeking && (L.isBG || (l += m), p >= this.scrollToIndex && (m /= 1.05));
|
|
6138
6250
|
}), this.scrollBoundary[1] = n + this.scrollOffset - this.size[1] / 2, this.bottomLine.setTransform(24, n, e, l);
|
|
6139
6251
|
}
|
|
6140
6252
|
/**
|
|
@@ -6205,20 +6317,20 @@ class Ts extends EventTarget {
|
|
|
6205
6317
|
const c = this.processedLines[a];
|
|
6206
6318
|
if (c) {
|
|
6207
6319
|
if (c.isBG) return;
|
|
6208
|
-
const
|
|
6209
|
-
if (
|
|
6210
|
-
const
|
|
6211
|
-
Math.max(c.endTime, (
|
|
6212
|
-
Math.max(c.endTime,
|
|
6320
|
+
const h = this.processedLines[a + 1];
|
|
6321
|
+
if (h != null && h.isBG) {
|
|
6322
|
+
const o = this.processedLines[a + 2], l = Math.min(c.startTime, h == null ? void 0 : h.startTime), m = Math.min(
|
|
6323
|
+
Math.max(c.endTime, (o == null ? void 0 : o.startTime) ?? Number.MAX_VALUE),
|
|
6324
|
+
Math.max(c.endTime, h == null ? void 0 : h.endTime)
|
|
6213
6325
|
);
|
|
6214
|
-
(l > e ||
|
|
6326
|
+
(l > e || m <= e) && (this.hotLines.delete(a), i.add(a), this.hotLines.delete(a + 1), i.add(a + 1), s && (this.lyricLinesEl[a].disable(e), this.lyricLinesEl[a + 1].disable(e)));
|
|
6215
6327
|
} else (c.startTime > e || c.endTime <= e) && (this.hotLines.delete(a), i.add(a), s && this.lyricLinesEl[a].disable(e));
|
|
6216
6328
|
} else
|
|
6217
6329
|
this.hotLines.delete(a), i.add(a), s && this.lyricLinesEl[a].disable(e);
|
|
6218
6330
|
}
|
|
6219
|
-
this.processedLines.forEach((a, c,
|
|
6220
|
-
var
|
|
6221
|
-
!a.isBG && a.startTime <= e && a.endTime > e && (this.hotLines.has(c) || (this.hotLines.add(c), r.add(c), s && this.lyricLinesEl[c].enable(e), (
|
|
6331
|
+
this.processedLines.forEach((a, c, h) => {
|
|
6332
|
+
var o;
|
|
6333
|
+
!a.isBG && a.startTime <= e && a.endTime > e && (this.hotLines.has(c) || (this.hotLines.add(c), r.add(c), s && this.lyricLinesEl[c].enable(e), (o = h[c + 1]) != null && o.isBG && (this.hotLines.add(c + 1), r.add(c + 1), s && this.lyricLinesEl[c + 1].enable(e))));
|
|
6222
6334
|
});
|
|
6223
6335
|
for (const a of this.bufferedLines)
|
|
6224
6336
|
this.hotLines.has(a) || (n.add(a), s && this.lyricLinesEl[a].disable(e));
|
|
@@ -6235,7 +6347,7 @@ class Ts extends EventTarget {
|
|
|
6235
6347
|
this.bufferedLines.add(a), this.lyricLinesEl[a].enable(e);
|
|
6236
6348
|
this.scrollToIndex = Math.min(...this.bufferedLines), this.calcLayout();
|
|
6237
6349
|
} else if (r.size === 0 && n.size > 0) {
|
|
6238
|
-
if (
|
|
6350
|
+
if (Je(n, this.bufferedLines)) {
|
|
6239
6351
|
for (const a of this.bufferedLines)
|
|
6240
6352
|
this.hotLines.has(a) || (this.bufferedLines.delete(a), this.lyricLinesEl[a].disable(e));
|
|
6241
6353
|
this.calcLayout();
|
|
@@ -6328,11 +6440,11 @@ class Ts extends EventTarget {
|
|
|
6328
6440
|
}
|
|
6329
6441
|
}
|
|
6330
6442
|
export {
|
|
6331
|
-
|
|
6332
|
-
|
|
6333
|
-
|
|
6334
|
-
|
|
6335
|
-
|
|
6336
|
-
|
|
6443
|
+
ye as AbstractBaseRenderer,
|
|
6444
|
+
ee as BackgroundRender,
|
|
6445
|
+
Jt as BaseRenderer,
|
|
6446
|
+
qs as LyricPlayer,
|
|
6447
|
+
Ns as MeshGradientRenderer,
|
|
6448
|
+
Os as PixiRenderer
|
|
6337
6449
|
};
|
|
6338
6450
|
//# sourceMappingURL=amll-core.js.map
|