modern-canvas 0.23.11 → 0.23.12
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/index.js +164 -100
- package/dist/scene/animation/Animation.d.ts +15 -13
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -8008,8 +8008,7 @@ function sa(e) {
|
|
|
8008
8008
|
let t = e.trim(), n = /^path\((.*)\)$/s.exec(t);
|
|
8009
8009
|
return n && (t = n[1].trim()), t.length >= 2 && (t[0] === "\"" || t[0] === "'") && t[t.length - 1] === t[0] && (t = t.slice(1, -1)), t.trim();
|
|
8010
8010
|
}
|
|
8011
|
-
|
|
8012
|
-
function pa(e, t, n, r) {
|
|
8011
|
+
function ca(e, t, n, r) {
|
|
8013
8012
|
let i = 1e-6, a = 3 * e - 3 * n + 1, o = 3 * n - 6 * e, s = 3 * e, c = 3 * t - 3 * r + 1, l = 3 * r - 6 * t, u = 3 * t, d = (e) => (3 * a * e + 2 * o) * e + s, f = (e) => ((a * e + o) * e + s) * e, p = (e) => ((c * e + l) * e + u) * e;
|
|
8014
8013
|
function m(e) {
|
|
8015
8014
|
let t = e, n, r;
|
|
@@ -8029,13 +8028,74 @@ function pa(e, t, n, r) {
|
|
|
8029
8028
|
}
|
|
8030
8029
|
return (e) => p(m(e));
|
|
8031
8030
|
}
|
|
8032
|
-
var
|
|
8033
|
-
linear:
|
|
8034
|
-
|
|
8035
|
-
|
|
8036
|
-
|
|
8037
|
-
|
|
8038
|
-
|
|
8031
|
+
var la = {
|
|
8032
|
+
linear: [
|
|
8033
|
+
0,
|
|
8034
|
+
0,
|
|
8035
|
+
1,
|
|
8036
|
+
1
|
|
8037
|
+
],
|
|
8038
|
+
ease: [
|
|
8039
|
+
.25,
|
|
8040
|
+
.1,
|
|
8041
|
+
.25,
|
|
8042
|
+
1
|
|
8043
|
+
],
|
|
8044
|
+
"ease-in": [
|
|
8045
|
+
.42,
|
|
8046
|
+
0,
|
|
8047
|
+
1,
|
|
8048
|
+
1
|
|
8049
|
+
],
|
|
8050
|
+
"ease-out": [
|
|
8051
|
+
0,
|
|
8052
|
+
0,
|
|
8053
|
+
.58,
|
|
8054
|
+
1
|
|
8055
|
+
],
|
|
8056
|
+
"ease-in-out": [
|
|
8057
|
+
.42,
|
|
8058
|
+
0,
|
|
8059
|
+
.58,
|
|
8060
|
+
1
|
|
8061
|
+
],
|
|
8062
|
+
"ease-in-quad": [
|
|
8063
|
+
.55,
|
|
8064
|
+
.085,
|
|
8065
|
+
.68,
|
|
8066
|
+
.53
|
|
8067
|
+
],
|
|
8068
|
+
"ease-out-quad": [
|
|
8069
|
+
.25,
|
|
8070
|
+
.46,
|
|
8071
|
+
.45,
|
|
8072
|
+
.94
|
|
8073
|
+
],
|
|
8074
|
+
"ease-in-out-quad": [
|
|
8075
|
+
.455,
|
|
8076
|
+
.03,
|
|
8077
|
+
.515,
|
|
8078
|
+
.955
|
|
8079
|
+
],
|
|
8080
|
+
"ease-in-cubic": [
|
|
8081
|
+
.55,
|
|
8082
|
+
.055,
|
|
8083
|
+
.675,
|
|
8084
|
+
.19
|
|
8085
|
+
],
|
|
8086
|
+
"ease-out-cubic": [
|
|
8087
|
+
.215,
|
|
8088
|
+
.61,
|
|
8089
|
+
.355,
|
|
8090
|
+
1
|
|
8091
|
+
],
|
|
8092
|
+
"ease-in-out-cubic": [
|
|
8093
|
+
.645,
|
|
8094
|
+
.045,
|
|
8095
|
+
.355,
|
|
8096
|
+
1
|
|
8097
|
+
]
|
|
8098
|
+
}, ua = Object.fromEntries(Object.entries(la).map(([e, [t, n, r, i]]) => [e, ca(t, n, r, i)])), da = class extends V {
|
|
8039
8099
|
_keyframes = [];
|
|
8040
8100
|
_isFirstUpdatePosition = !1;
|
|
8041
8101
|
_cachedProps = new t();
|
|
@@ -8122,10 +8182,14 @@ var ma = {
|
|
|
8122
8182
|
});
|
|
8123
8183
|
}
|
|
8124
8184
|
_parseEasing(e) {
|
|
8125
|
-
if (!e) return
|
|
8126
|
-
if (e in
|
|
8127
|
-
let t =
|
|
8128
|
-
|
|
8185
|
+
if (!e) return ua.linear;
|
|
8186
|
+
if (e in ua) return ua[e];
|
|
8187
|
+
let t = /cubic-bezier\((.+)\)/.exec(e);
|
|
8188
|
+
if (t) {
|
|
8189
|
+
let e = t[1].split(",").map((e) => Number(e));
|
|
8190
|
+
if (e.length === 4 && e.every((e) => !Number.isNaN(e))) return ca(e[0], e[1], e[2], e[3]);
|
|
8191
|
+
}
|
|
8192
|
+
return ua.linear;
|
|
8129
8193
|
}
|
|
8130
8194
|
_parseKeyframes(e, t) {
|
|
8131
8195
|
let n, r = this._keyframes;
|
|
@@ -8218,14 +8282,14 @@ var ma = {
|
|
|
8218
8282
|
});
|
|
8219
8283
|
}
|
|
8220
8284
|
};
|
|
8221
|
-
k([_({ fallback: "parent" }), O("design:type", Object)],
|
|
8285
|
+
k([_({ fallback: "parent" }), O("design:type", Object)], da.prototype, "effectMode", void 0), k([_({ default: () => [] }), O("design:type", Array)], da.prototype, "keyframes", void 0), k([_(), O("design:type", Object)], da.prototype, "easing", void 0), da = k([b("Animation", {
|
|
8222
8286
|
renderMode: "disabled",
|
|
8223
8287
|
processSortMode: "parent-before",
|
|
8224
8288
|
duration: 2e3
|
|
8225
|
-
}), O("design:paramtypes", [typeof Partial > "u" ? Object : Partial, Array])],
|
|
8289
|
+
}), O("design:paramtypes", [typeof Partial > "u" ? Object : Partial, Array])], da);
|
|
8226
8290
|
//#endregion
|
|
8227
8291
|
//#region src/scene/audio/html/HTMLAudioContext.ts
|
|
8228
|
-
var
|
|
8292
|
+
var fa = class t extends e {
|
|
8229
8293
|
static _instance;
|
|
8230
8294
|
static get instance() {
|
|
8231
8295
|
return this._instance ||= new t(), this._instance;
|
|
@@ -8255,7 +8319,7 @@ var ga = class t extends e {
|
|
|
8255
8319
|
togglePause() {
|
|
8256
8320
|
return this.paused = !this.paused, this.refreshPaused(), this.paused;
|
|
8257
8321
|
}
|
|
8258
|
-
},
|
|
8322
|
+
}, pa = class t extends e {
|
|
8259
8323
|
static PADDING = .1;
|
|
8260
8324
|
_source = null;
|
|
8261
8325
|
_audio = null;
|
|
@@ -8382,7 +8446,7 @@ var ga = class t extends e {
|
|
|
8382
8446
|
let e = this._source;
|
|
8383
8447
|
e && (e.onended = null, e.onplay = null, e.onpause = null, this._stop()), this._source = null, this._playbackRate = 1, this._volume = 1, this._loop = !1, this._end = 0, this._start = 0, this._duration = 0, this._playing = !1, this._pausedReal = !1, this._paused = !1, this._muted = !1, this._audio &&= (this._audio.context.off("refresh", this.refresh), this._audio.context.off("refreshPaused", this.refreshPaused), null);
|
|
8384
8448
|
}
|
|
8385
|
-
},
|
|
8449
|
+
}, ma = class {
|
|
8386
8450
|
parent;
|
|
8387
8451
|
source = new globalThis.Audio();
|
|
8388
8452
|
_src = "";
|
|
@@ -8399,7 +8463,7 @@ var ga = class t extends e {
|
|
|
8399
8463
|
return !!this.source && this.source.readyState === 4;
|
|
8400
8464
|
}
|
|
8401
8465
|
get context() {
|
|
8402
|
-
return
|
|
8466
|
+
return fa.instance;
|
|
8403
8467
|
}
|
|
8404
8468
|
constructor(e) {
|
|
8405
8469
|
this.parent = e;
|
|
@@ -8410,9 +8474,9 @@ var ga = class t extends e {
|
|
|
8410
8474
|
});
|
|
8411
8475
|
}
|
|
8412
8476
|
createSound() {
|
|
8413
|
-
return new
|
|
8477
|
+
return new pa();
|
|
8414
8478
|
}
|
|
8415
|
-
},
|
|
8479
|
+
}, ha = class extends e {
|
|
8416
8480
|
_input;
|
|
8417
8481
|
_output;
|
|
8418
8482
|
_processers = [];
|
|
@@ -8434,7 +8498,7 @@ var ga = class t extends e {
|
|
|
8434
8498
|
get destination() {
|
|
8435
8499
|
return this._input;
|
|
8436
8500
|
}
|
|
8437
|
-
},
|
|
8501
|
+
}, ga = class {
|
|
8438
8502
|
destination;
|
|
8439
8503
|
source;
|
|
8440
8504
|
constructor(e, t = null) {
|
|
@@ -8449,21 +8513,21 @@ var ga = class t extends e {
|
|
|
8449
8513
|
};
|
|
8450
8514
|
//#endregion
|
|
8451
8515
|
//#region src/scene/audio/web/WebAudioContext.ts
|
|
8452
|
-
function
|
|
8516
|
+
function _a() {
|
|
8453
8517
|
if (He) return new AudioContext();
|
|
8454
8518
|
if (Ue) {
|
|
8455
8519
|
let e = globalThis.webkitAudioContext;
|
|
8456
8520
|
return new e();
|
|
8457
8521
|
} else throw Error("Failed to createAudioContext");
|
|
8458
8522
|
}
|
|
8459
|
-
function
|
|
8523
|
+
function va(e, t, n) {
|
|
8460
8524
|
if (We) return new OfflineAudioContext(e, t, n);
|
|
8461
8525
|
if (Ge) {
|
|
8462
8526
|
let r = globalThis.webkitOfflineAudioContext;
|
|
8463
8527
|
return new r(e, t, n);
|
|
8464
8528
|
} else throw Error("Failed to createOfflineAudioContext");
|
|
8465
8529
|
}
|
|
8466
|
-
var
|
|
8530
|
+
var ya = class e extends ha {
|
|
8467
8531
|
static _instance;
|
|
8468
8532
|
static get instance() {
|
|
8469
8533
|
return this._instance ||= new e(), this._instance;
|
|
@@ -8504,7 +8568,7 @@ var Ca = class e extends ya {
|
|
|
8504
8568
|
_compressor;
|
|
8505
8569
|
_analyser;
|
|
8506
8570
|
constructor() {
|
|
8507
|
-
let e =
|
|
8571
|
+
let e = _a(), t = va(1, 2, We ? Math.max(8e3, Math.min(96e3, e.sampleRate)) : 44100), n = e.createDynamicsCompressor(), r = e.createAnalyser();
|
|
8508
8572
|
r.connect(n), n.connect(e.destination), super(r, n), this._context = e, this._offlineContext = t, this._compressor = n, this._analyser = r, this._locked = e.state === "suspended" && (ze || Be), qe && (this._locked && (this._unlock(), document.addEventListener("mousedown", this._unlock, !0), document.addEventListener("touchstart", this._unlock, !0), document.addEventListener("touchend", this._unlock, !0)), globalThis.addEventListener("focus", this._onFocus), globalThis.addEventListener("blur", this._onBlur));
|
|
8509
8573
|
}
|
|
8510
8574
|
_onFocus() {
|
|
@@ -8545,7 +8609,7 @@ var Ca = class e extends ya {
|
|
|
8545
8609
|
setParamValue(e, t) {
|
|
8546
8610
|
e.setValueAtTime ? e.setValueAtTime(t, this._context.currentTime) : e.value = t;
|
|
8547
8611
|
}
|
|
8548
|
-
},
|
|
8612
|
+
}, ba = class extends e {
|
|
8549
8613
|
_audio = null;
|
|
8550
8614
|
_sourceNode = null;
|
|
8551
8615
|
_gain = null;
|
|
@@ -8678,7 +8742,7 @@ var Ca = class e extends ya {
|
|
|
8678
8742
|
destroy() {
|
|
8679
8743
|
super.destroy(), this._stop(), this._gain?.disconnect(), this._gain = null, this._audio?.context.off("refresh", this.refresh), this._audio?.context.off("refreshPaused", this.refreshPaused), this._audio = null, this._processors.forEach((e) => e.disconnect()), this._processors.length = 0, this._end = 0, this._playbackRate = 1, this._volume = 1, this._loop = !1, this._elapsed = 0, this._duration = 0, this._paused = !1, this._muted = !1, this._pausedReal = !1;
|
|
8680
8744
|
}
|
|
8681
|
-
},
|
|
8745
|
+
}, xa = class extends ha {
|
|
8682
8746
|
parent;
|
|
8683
8747
|
_sourceBuffer;
|
|
8684
8748
|
_sourceNode;
|
|
@@ -8686,7 +8750,7 @@ var Ca = class e extends ya {
|
|
|
8686
8750
|
gain;
|
|
8687
8751
|
analyser;
|
|
8688
8752
|
get context() {
|
|
8689
|
-
return
|
|
8753
|
+
return ya.instance;
|
|
8690
8754
|
}
|
|
8691
8755
|
get isPlayable() {
|
|
8692
8756
|
return !!this._sourceNode.buffer;
|
|
@@ -8701,8 +8765,8 @@ var Ca = class e extends ya {
|
|
|
8701
8765
|
this._sourceNode.buffer = e;
|
|
8702
8766
|
}
|
|
8703
8767
|
constructor(e) {
|
|
8704
|
-
let t =
|
|
8705
|
-
n.connect(i), i.connect(r), r.connect(
|
|
8768
|
+
let t = ya.audioContext, n = t.createBufferSource(), r = t.createGain(), i = t.createAnalyser();
|
|
8769
|
+
n.connect(i), i.connect(r), r.connect(ya.instance.destination), super(i, r), this.parent = e, this._sourceNode = n, this.gain = r, this.analyser = i;
|
|
8706
8770
|
}
|
|
8707
8771
|
async load() {
|
|
8708
8772
|
return this._sourceLoad ||= new Promise((e) => {
|
|
@@ -8715,7 +8779,7 @@ var Ca = class e extends ya {
|
|
|
8715
8779
|
});
|
|
8716
8780
|
}
|
|
8717
8781
|
_decode(e) {
|
|
8718
|
-
return Promise.resolve(e instanceof AudioBuffer ? e :
|
|
8782
|
+
return Promise.resolve(e instanceof AudioBuffer ? e : ya.decode(e)).then((e) => (this.parent.isLoaded = !0, this.buffer = e, e));
|
|
8719
8783
|
}
|
|
8720
8784
|
cloneSource() {
|
|
8721
8785
|
let e = this.context, t = this._sourceNode, n = e.audioContext.createBufferSource(), r = e.audioContext.createGain();
|
|
@@ -8725,15 +8789,15 @@ var Ca = class e extends ya {
|
|
|
8725
8789
|
};
|
|
8726
8790
|
}
|
|
8727
8791
|
createSound() {
|
|
8728
|
-
return new
|
|
8792
|
+
return new ba();
|
|
8729
8793
|
}
|
|
8730
|
-
},
|
|
8794
|
+
}, Sa, Ca = class extends V {
|
|
8731
8795
|
static {
|
|
8732
|
-
|
|
8796
|
+
Sa = this;
|
|
8733
8797
|
}
|
|
8734
8798
|
static _soundPool = [];
|
|
8735
8799
|
_sounds = [];
|
|
8736
|
-
_platformAudio = Ke ? new
|
|
8800
|
+
_platformAudio = Ke ? new xa(this) : new ma(this);
|
|
8737
8801
|
get platformAudio() {
|
|
8738
8802
|
return this._platformAudio;
|
|
8739
8803
|
}
|
|
@@ -8826,7 +8890,7 @@ var Ca = class e extends ya {
|
|
|
8826
8890
|
this._sounds.length = 0;
|
|
8827
8891
|
}
|
|
8828
8892
|
_createSound() {
|
|
8829
|
-
return
|
|
8893
|
+
return Sa._soundPool.length > 0 ? Sa._soundPool.pop().init(this._platformAudio) : this._platformAudio.createSound().init(this._platformAudio);
|
|
8830
8894
|
}
|
|
8831
8895
|
refresh() {
|
|
8832
8896
|
for (let e = this._sounds.length, t = 0; t < e; t++) this._sounds[t].refresh();
|
|
@@ -8842,7 +8906,7 @@ var Ca = class e extends ya {
|
|
|
8842
8906
|
this._recycleSound(e);
|
|
8843
8907
|
};
|
|
8844
8908
|
_recycleSound(e) {
|
|
8845
|
-
e.destroy(),
|
|
8909
|
+
e.destroy(), Sa._soundPool.includes(e) || Sa._soundPool.push(e);
|
|
8846
8910
|
}
|
|
8847
8911
|
_prevTime = 0;
|
|
8848
8912
|
_timer = 0;
|
|
@@ -8858,10 +8922,10 @@ var Ca = class e extends ya {
|
|
|
8858
8922
|
}, 100);
|
|
8859
8923
|
}
|
|
8860
8924
|
};
|
|
8861
|
-
|
|
8925
|
+
Ca = Sa = k([b("Audio"), O("design:paramtypes", [Object])], Ca);
|
|
8862
8926
|
//#endregion
|
|
8863
8927
|
//#region src/scene/audio/AudioSpectrum.ts
|
|
8864
|
-
var
|
|
8928
|
+
var wa = class extends wr {}, Ta = class extends ea {
|
|
8865
8929
|
_audioBuffer;
|
|
8866
8930
|
_src = (() => {
|
|
8867
8931
|
let e = S();
|
|
@@ -8885,7 +8949,7 @@ var Oa = class extends wr {}, ka = class extends ea {
|
|
|
8885
8949
|
}
|
|
8886
8950
|
}
|
|
8887
8951
|
async _loadSrc(e) {
|
|
8888
|
-
await globalThis.fetch(e).then((e) => e.arrayBuffer()).then((e) =>
|
|
8952
|
+
await globalThis.fetch(e).then((e) => e.arrayBuffer()).then((e) => ya.decode(e)).then((e) => {
|
|
8889
8953
|
this._audioBuffer = e, this.syncTexture(!0);
|
|
8890
8954
|
});
|
|
8891
8955
|
}
|
|
@@ -8920,12 +8984,12 @@ var Oa = class extends wr {}, ka = class extends ea {
|
|
|
8920
8984
|
this.syncTexture(), super._process(e);
|
|
8921
8985
|
}
|
|
8922
8986
|
};
|
|
8923
|
-
k([_(), O("design:type", Object)],
|
|
8987
|
+
k([_(), O("design:type", Object)], Ta.prototype, "src", void 0), k([_({ fallback: 0 }), O("design:type", Number)], Ta.prototype, "gap", void 0), k([_({ fallback: "#000000" }), O("design:type", String)], Ta.prototype, "color", void 0), Ta = k([b("AudioWaveform"), O("design:paramtypes", [typeof Partial > "u" ? Object : Partial])], Ta);
|
|
8924
8988
|
//#endregion
|
|
8925
8989
|
//#region src/scene/transitions/KawaseTransition.ts
|
|
8926
|
-
var
|
|
8990
|
+
var Ea, Da = class extends Cr {
|
|
8927
8991
|
static {
|
|
8928
|
-
|
|
8992
|
+
Ea = this;
|
|
8929
8993
|
}
|
|
8930
8994
|
blur = 10;
|
|
8931
8995
|
quality = 10;
|
|
@@ -8944,7 +9008,7 @@ var Aa, ja = class extends Cr {
|
|
|
8944
9008
|
let d = 1 / s, f = 1 / c, p = [], m, h = o - 1;
|
|
8945
9009
|
for (let e = 0; e < h; e++) m = u[e] + .5, p[0] = m * d, p[1] = m * f, l.push({ offset: p });
|
|
8946
9010
|
m = u[h] + .5, p[0] = m * d, p[1] = m * f, l.push({ offset: p }), l.forEach((t) => {
|
|
8947
|
-
L.draw(e,
|
|
9011
|
+
L.draw(e, Ea.material, {
|
|
8948
9012
|
sampler: r,
|
|
8949
9013
|
progress: i,
|
|
8950
9014
|
...t
|
|
@@ -8952,31 +9016,31 @@ var Aa, ja = class extends Cr {
|
|
|
8952
9016
|
});
|
|
8953
9017
|
}
|
|
8954
9018
|
};
|
|
8955
|
-
|
|
9019
|
+
Da = Ea = k([b("KawaseTransition")], Da);
|
|
8956
9020
|
//#endregion
|
|
8957
9021
|
//#region src/scene/transitions/LeftEraseTransition.ts
|
|
8958
|
-
var
|
|
9022
|
+
var Oa, ka = class extends Cr {
|
|
8959
9023
|
static {
|
|
8960
|
-
|
|
9024
|
+
Oa = this;
|
|
8961
9025
|
}
|
|
8962
9026
|
static material = new I({ gl: {
|
|
8963
9027
|
vertex: "attribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUv;\nvoid main() {\n gl_Position = vec4(position, 0.0, 1.0);\n vUv = uv;\n}",
|
|
8964
9028
|
fragment: "precision highp float;\nvarying vec2 vUv;\nuniform float progress;\nuniform sampler2D previous;\nuniform sampler2D next;\n\nfloat easeInOutQuint(float t) {\n return t < 0.5 ? 16.0*t*t*t*t*t : 1.0+16.0*(--t)*t*t*t*t;\n}\n\nvoid main() {\n vec4 src1Color = texture2D(previous, vUv);\n vec4 src2Color = texture2D(next, vUv);\n float mProgress = 1.0 - progress;\n float mixPercent = 0.0;\n if (vUv.x <= mProgress) {\n mixPercent = 1.0;\n }\n gl_FragColor = mix(src2Color, src1Color, mixPercent);\n}"
|
|
8965
9029
|
} });
|
|
8966
9030
|
apply(e) {
|
|
8967
|
-
L.draw(e,
|
|
9031
|
+
L.draw(e, Oa.material, {
|
|
8968
9032
|
previous: 0,
|
|
8969
9033
|
next: 1,
|
|
8970
9034
|
progress: this.currentTimeProgress
|
|
8971
9035
|
});
|
|
8972
9036
|
}
|
|
8973
9037
|
};
|
|
8974
|
-
|
|
9038
|
+
ka = Oa = k([b("LeftEraseTransition")], ka);
|
|
8975
9039
|
//#endregion
|
|
8976
9040
|
//#region src/scene/transitions/TiltShiftTransition.ts
|
|
8977
|
-
var
|
|
9041
|
+
var Aa, ja = class extends Cr {
|
|
8978
9042
|
static {
|
|
8979
|
-
|
|
9043
|
+
Aa = this;
|
|
8980
9044
|
}
|
|
8981
9045
|
blur = 100;
|
|
8982
9046
|
gradientBlur = 600;
|
|
@@ -8988,7 +9052,7 @@ var Pa, Fa = class extends Cr {
|
|
|
8988
9052
|
let n = this.currentTimeProgress, r, i;
|
|
8989
9053
|
n < .5 ? (r = 0, i = (.5 - n) / .5) : (r = 1, i = (n - .5) / .5);
|
|
8990
9054
|
let a = t.width, o = t.height, s = [0, o / 2], c = [600, o / 2], l = [a, o], u = c[0] - s[0], d = c[1] - s[1], f = Math.sqrt(u * u + d * d);
|
|
8991
|
-
L.draw(e,
|
|
9055
|
+
L.draw(e, Aa.material, {
|
|
8992
9056
|
sampler: r,
|
|
8993
9057
|
progress: i,
|
|
8994
9058
|
blur: this.blur,
|
|
@@ -8997,7 +9061,7 @@ var Pa, Fa = class extends Cr {
|
|
|
8997
9061
|
end: c,
|
|
8998
9062
|
delta: [u / f, d / f],
|
|
8999
9063
|
texSize: l
|
|
9000
|
-
}), L.draw(e,
|
|
9064
|
+
}), L.draw(e, Aa.material, {
|
|
9001
9065
|
sampler: r,
|
|
9002
9066
|
progress: i,
|
|
9003
9067
|
blur: this.blur,
|
|
@@ -9009,12 +9073,12 @@ var Pa, Fa = class extends Cr {
|
|
|
9009
9073
|
});
|
|
9010
9074
|
}
|
|
9011
9075
|
};
|
|
9012
|
-
|
|
9076
|
+
ja = Aa = k([b("TiltShiftTransition")], ja);
|
|
9013
9077
|
//#endregion
|
|
9014
9078
|
//#region src/scene/transitions/TwistTransition.ts
|
|
9015
|
-
var
|
|
9079
|
+
var Ma, Na = class extends Cr {
|
|
9016
9080
|
static {
|
|
9017
|
-
|
|
9081
|
+
Ma = this;
|
|
9018
9082
|
}
|
|
9019
9083
|
radius;
|
|
9020
9084
|
angle = 4;
|
|
@@ -9028,7 +9092,7 @@ var Ia, La = class extends Cr {
|
|
|
9028
9092
|
let n = this.currentTimeProgress, r, i;
|
|
9029
9093
|
n < .5 ? (r = 0, i = (.5 - n) / .5) : (r = 1, i = (n - .5) / .5);
|
|
9030
9094
|
let a = t.width, o = t.height;
|
|
9031
|
-
L.draw(e,
|
|
9095
|
+
L.draw(e, Ma.material, {
|
|
9032
9096
|
sampler: r,
|
|
9033
9097
|
progress: i,
|
|
9034
9098
|
filterArea: [
|
|
@@ -9044,10 +9108,10 @@ var Ia, La = class extends Cr {
|
|
|
9044
9108
|
});
|
|
9045
9109
|
}
|
|
9046
9110
|
};
|
|
9047
|
-
|
|
9111
|
+
Na = Ma = k([b("TwistTransition")], Na);
|
|
9048
9112
|
//#endregion
|
|
9049
9113
|
//#region src/asset/loaders/GifLoader.ts
|
|
9050
|
-
var
|
|
9114
|
+
var Pa = class extends Vn {
|
|
9051
9115
|
install(e) {
|
|
9052
9116
|
let t = async (t) => {
|
|
9053
9117
|
let { decodeFrames: n } = await import("modern-gif");
|
|
@@ -9064,14 +9128,14 @@ var Ra = class extends Vn {
|
|
|
9064
9128
|
e.register(n, t);
|
|
9065
9129
|
}), e.gif = this, this;
|
|
9066
9130
|
}
|
|
9067
|
-
},
|
|
9131
|
+
}, Fa = class extends Vn {
|
|
9068
9132
|
install(e) {
|
|
9069
9133
|
let t = async (e) => JSON.parse(await e.text());
|
|
9070
9134
|
return this.load = (n) => typeof n == "string" ? e.loadBy(n).then(t) : t(n), ["application/json"].forEach((n) => {
|
|
9071
9135
|
e.register(n, t);
|
|
9072
9136
|
}), e.json = this, this;
|
|
9073
9137
|
}
|
|
9074
|
-
},
|
|
9138
|
+
}, Ia = class extends Vn {
|
|
9075
9139
|
install(e) {
|
|
9076
9140
|
return this.load = async (t, n) => (await import("lottie-web").then((e) => e.default)).loadAnimation({
|
|
9077
9141
|
container: null,
|
|
@@ -9082,12 +9146,12 @@ var Ra = class extends Vn {
|
|
|
9082
9146
|
animationData: await e.loadBy(t, () => e.fetch(t).then((e) => e.json()))
|
|
9083
9147
|
}), e.lottie = this, this;
|
|
9084
9148
|
}
|
|
9085
|
-
},
|
|
9149
|
+
}, La = class extends Vn {
|
|
9086
9150
|
install(e) {
|
|
9087
9151
|
let t = async (e) => e.text();
|
|
9088
9152
|
return this.load = (n) => typeof n == "string" ? e.loadBy(n).then(t) : t(n), e.text = this, this;
|
|
9089
9153
|
}
|
|
9090
|
-
},
|
|
9154
|
+
}, Ra = class extends Vn {
|
|
9091
9155
|
install(e) {
|
|
9092
9156
|
let t = (t) => e.fetchImageBitmap(t, { premultiplyAlpha: "premultiply" }).then((e) => new z({
|
|
9093
9157
|
source: e,
|
|
@@ -9111,11 +9175,11 @@ var Ra = class extends Vn {
|
|
|
9111
9175
|
e.register(n, t);
|
|
9112
9176
|
}), e.texture = this, this;
|
|
9113
9177
|
}
|
|
9114
|
-
},
|
|
9178
|
+
}, za = class extends Vn {
|
|
9115
9179
|
install(e) {
|
|
9116
9180
|
return this.load = (t) => e.awaitBy(() => new ar(t).load()), e.video = this, this;
|
|
9117
9181
|
}
|
|
9118
|
-
},
|
|
9182
|
+
}, Ba = Object.entries({
|
|
9119
9183
|
"font/woff": ["woff"],
|
|
9120
9184
|
"font/ttf": ["ttf"],
|
|
9121
9185
|
"font/otf": ["otf"],
|
|
@@ -9131,31 +9195,31 @@ var Ra = class extends Vn {
|
|
|
9131
9195
|
"image/webp": ["webp"],
|
|
9132
9196
|
"application/json": ["json"]
|
|
9133
9197
|
});
|
|
9134
|
-
function
|
|
9135
|
-
for (let [t, n] of
|
|
9198
|
+
function Va(e) {
|
|
9199
|
+
for (let [t, n] of Ba) if (n.includes(e)) return t;
|
|
9136
9200
|
}
|
|
9137
|
-
function
|
|
9201
|
+
function Ha(e) {
|
|
9138
9202
|
let t;
|
|
9139
9203
|
if (e.startsWith("data:")) t = e.match(/^data:(.+?);/)?.[1];
|
|
9140
9204
|
else if (e.startsWith("http")) {
|
|
9141
9205
|
let n = e.split(/[#?]/)[0].split(".").pop()?.trim();
|
|
9142
|
-
n && (t =
|
|
9206
|
+
n && (t = Va(n));
|
|
9143
9207
|
}
|
|
9144
9208
|
return t;
|
|
9145
9209
|
}
|
|
9146
9210
|
//#endregion
|
|
9147
9211
|
//#region src/asset/Assets.ts
|
|
9148
|
-
var
|
|
9212
|
+
var Ua = "WeakRef" in globalThis, Wa = class extends e {
|
|
9149
9213
|
defaultHandler = (e) => e;
|
|
9150
9214
|
_handlers = /* @__PURE__ */ new Map();
|
|
9151
9215
|
_handleing = /* @__PURE__ */ new Map();
|
|
9152
9216
|
_handled = /* @__PURE__ */ new Map();
|
|
9153
|
-
_gc =
|
|
9217
|
+
_gc = Ua ? new FinalizationRegistry((e) => {
|
|
9154
9218
|
let t = this.get(e);
|
|
9155
9219
|
t && "destroy" in t && t.destroy(), this._handled.delete(e);
|
|
9156
9220
|
}) : void 0;
|
|
9157
9221
|
constructor() {
|
|
9158
|
-
super(),
|
|
9222
|
+
super(), Ua || x.on(this.gc.bind(this), { sort: 2 });
|
|
9159
9223
|
}
|
|
9160
9224
|
use(e) {
|
|
9161
9225
|
return e.install(this), this;
|
|
@@ -9204,11 +9268,11 @@ var qa = "WeakRef" in globalThis, Ja = class extends e {
|
|
|
9204
9268
|
}
|
|
9205
9269
|
get(e) {
|
|
9206
9270
|
let t = this._handled.get(e);
|
|
9207
|
-
return
|
|
9271
|
+
return Ua && t instanceof WeakRef && (t = t.deref(), t || this._handleing.delete(e)), t;
|
|
9208
9272
|
}
|
|
9209
9273
|
set(e, t) {
|
|
9210
9274
|
let n = t;
|
|
9211
|
-
|
|
9275
|
+
Ua && typeof t == "object" && (this._gc.register(t, e), n = new WeakRef(t)), this._handled.set(e, n);
|
|
9212
9276
|
}
|
|
9213
9277
|
async awaitBy(e) {
|
|
9214
9278
|
let t = e(), n = c();
|
|
@@ -9223,7 +9287,7 @@ var qa = "WeakRef" in globalThis, Ja = class extends e {
|
|
|
9223
9287
|
return this._handleing.set(e, r), r;
|
|
9224
9288
|
}
|
|
9225
9289
|
async load(e, t) {
|
|
9226
|
-
let n = await this.loadBy(e), r =
|
|
9290
|
+
let n = await this.loadBy(e), r = Ha(e);
|
|
9227
9291
|
return r === void 0 && (r = n.type?.split(";")[0] ?? void 0), ((r ? this._handlers.get(r) : void 0) ?? this.defaultHandler)(n, t);
|
|
9228
9292
|
}
|
|
9229
9293
|
async waitUntilLoad() {
|
|
@@ -9237,14 +9301,14 @@ var qa = "WeakRef" in globalThis, Ja = class extends e {
|
|
|
9237
9301
|
n && "destroy" in n && n.destroy();
|
|
9238
9302
|
}), this._handled.clear();
|
|
9239
9303
|
}
|
|
9240
|
-
}, $ = new
|
|
9304
|
+
}, $ = new Wa().use(new Hn()).use(new Pa()).use(new Fa()).use(new Ia()).use(new La()).use(new Ra()).use(new za()), Ga = {
|
|
9241
9305
|
alpha: !0,
|
|
9242
9306
|
stencil: !0,
|
|
9243
9307
|
antialias: !1,
|
|
9244
9308
|
premultipliedAlpha: !0,
|
|
9245
9309
|
preserveDrawingBuffer: !1,
|
|
9246
9310
|
powerPreference: "default"
|
|
9247
|
-
},
|
|
9311
|
+
}, Ka = class extends Sr {
|
|
9248
9312
|
renderer;
|
|
9249
9313
|
get view() {
|
|
9250
9314
|
return this.renderer.view;
|
|
@@ -9277,12 +9341,12 @@ var qa = "WeakRef" in globalThis, Ja = class extends e {
|
|
|
9277
9341
|
constructor(e = {}) {
|
|
9278
9342
|
let { view: t, width: n, height: r, pixelRatio: i = Ye, autoResize: a, data: o } = e;
|
|
9279
9343
|
super(), this.renderer = new Bn(t, {
|
|
9280
|
-
alpha:
|
|
9281
|
-
stencil:
|
|
9282
|
-
antialias:
|
|
9283
|
-
premultipliedAlpha:
|
|
9284
|
-
preserveDrawingBuffer:
|
|
9285
|
-
powerPreference:
|
|
9344
|
+
alpha: Ga.alpha ?? e.alpha,
|
|
9345
|
+
stencil: Ga.stencil ?? e.stencil,
|
|
9346
|
+
antialias: Ga.antialias ?? e.antialias,
|
|
9347
|
+
premultipliedAlpha: Ga.premultipliedAlpha ?? e.premultipliedAlpha,
|
|
9348
|
+
preserveDrawingBuffer: Ga.preserveDrawingBuffer ?? e.preserveDrawingBuffer,
|
|
9349
|
+
powerPreference: Ga.powerPreference ?? e.powerPreference
|
|
9286
9350
|
}), this._setupInput(), this.pixelRatio = i, a ? !t && this.renderer.view && (this.renderer.view.style.width = "100%", this.renderer.view.style.height = "100%") : this.resize(n || this.gl.drawingBufferWidth || this.view?.clientWidth || 200, r || this.gl.drawingBufferHeight || this.view?.clientHeight || 200, !t), this.setProperties(e), o && this.root.append(o);
|
|
9287
9351
|
}
|
|
9288
9352
|
_updateProperty(e, t, n) {
|
|
@@ -9365,22 +9429,22 @@ var qa = "WeakRef" in globalThis, Ja = class extends e {
|
|
|
9365
9429
|
super._destroy(), this._resizeObserver?.disconnect(), this.renderer.destroy();
|
|
9366
9430
|
}
|
|
9367
9431
|
};
|
|
9368
|
-
k([_({ fallback: !1 }), O("design:type", Boolean)],
|
|
9432
|
+
k([_({ fallback: !1 }), O("design:type", Boolean)], Ka.prototype, "autoResize", void 0), k([_({ fallback: !1 }), O("design:type", Boolean)], Ka.prototype, "autoStart", void 0);
|
|
9369
9433
|
//#endregion
|
|
9370
9434
|
//#region src/render.ts
|
|
9371
|
-
var
|
|
9372
|
-
function
|
|
9373
|
-
return
|
|
9435
|
+
var qa, Ja = [], Ya = !1;
|
|
9436
|
+
function Xa() {
|
|
9437
|
+
return qa ??= new Ka({
|
|
9374
9438
|
pixelRatio: 1,
|
|
9375
9439
|
width: 1,
|
|
9376
9440
|
height: 1,
|
|
9377
9441
|
preserveDrawingBuffer: !0
|
|
9378
9442
|
});
|
|
9379
9443
|
}
|
|
9380
|
-
async function
|
|
9381
|
-
if (
|
|
9382
|
-
for (
|
|
9383
|
-
let t =
|
|
9444
|
+
async function Za(e = 100) {
|
|
9445
|
+
if (!Ya) {
|
|
9446
|
+
for (Ya = !0; Ja.length;) {
|
|
9447
|
+
let t = Ja.shift();
|
|
9384
9448
|
if (t) try {
|
|
9385
9449
|
await t();
|
|
9386
9450
|
} catch (e) {
|
|
@@ -9388,11 +9452,11 @@ async function to(e = 100) {
|
|
|
9388
9452
|
}
|
|
9389
9453
|
else await new Promise((t) => setTimeout(t, e));
|
|
9390
9454
|
}
|
|
9391
|
-
|
|
9455
|
+
Ya = !1;
|
|
9392
9456
|
}
|
|
9393
9457
|
}
|
|
9394
|
-
async function
|
|
9395
|
-
let { debug: t = !1, fonts: n, width: r, height: i, data: a, keyframes: o = [], onBefore: s, onKeyframe: c, ...l } = e, u = Math.floor(r), d = Math.floor(i), f =
|
|
9458
|
+
async function Qa(e) {
|
|
9459
|
+
let { debug: t = !1, fonts: n, width: r, height: i, data: a, keyframes: o = [], onBefore: s, onKeyframe: c, ...l } = e, u = Math.floor(r), d = Math.floor(i), f = Xa();
|
|
9396
9460
|
if (f.resetProperties(), f.setProperties(l), f.debug = t, f.fonts = n, f.timeline.currentTime = 0, f.resize(u, d, !0), f.root.removeChildren(!0), f.root.append(a), await s?.(f), await f.waitAndRender(), o.length) {
|
|
9397
9461
|
let e = o.length, t = o[e - 1];
|
|
9398
9462
|
for (let n = 0; n < e; n++) {
|
|
@@ -9410,15 +9474,15 @@ async function no(e) {
|
|
|
9410
9474
|
toCanvas2D: () => f.toCanvas2D(new ImageData(p, u, d))
|
|
9411
9475
|
};
|
|
9412
9476
|
}
|
|
9413
|
-
async function
|
|
9477
|
+
async function $a(e) {
|
|
9414
9478
|
return new Promise((t) => {
|
|
9415
|
-
|
|
9479
|
+
Ja.push(async () => t(await Qa(e).then((e) => e.toCanvas2D()))), Za();
|
|
9416
9480
|
});
|
|
9417
9481
|
}
|
|
9418
|
-
async function
|
|
9482
|
+
async function eo(e) {
|
|
9419
9483
|
return new Promise((t) => {
|
|
9420
|
-
|
|
9484
|
+
Ja.push(async () => t(await Qa(e).then((e) => e.pixels))), Za();
|
|
9421
9485
|
});
|
|
9422
9486
|
}
|
|
9423
9487
|
//#endregion
|
|
9424
|
-
export { yt as Aabb2D, $n as AnimatedTexture,
|
|
9488
|
+
export { yt as Aabb2D, $n as AnimatedTexture, da as Animation, Wa as Assets, Ca as Audio, ha as AudioPipeline, ga as AudioProcessor, wa as AudioSpectrum, Ta as AudioWaveform, A as BufferUsage, Tr as Camera2D, sr as CanvasContext, _r as CanvasItem, er as CanvasTexture, T as Color, W as ColorAdjustEffect, Rr as ColorFilterEffect, St as ColorMatrix, Vr as ColorOverlayEffect, Ur as ColorRemoveEffect, Kr as ColorReplaceEffect, tr as ColorTexture, C as CoreObject, bt as DEG_TO_RAD, Ye as DEVICE_PIXEL_RATIO, G as DrawboardEffect, $r as DropShadowEffect, U as Effect, Xn as EffectMaterial, ea as Element2D, _i as Element2DBackground, X as Element2DChart, xi as Element2DConnection, Y as Element2DFill, ki as Element2DForeground, ji as Element2DOutline, Mi as Element2DShadow, Ni as Element2DShape, Pi as Element2DStyle, Ri as Element2DTable, Z as Element2DText, ti as EmbossEffect, Ka as Engine, Yi as Flexbox, Hn as FontLoader, Zr as GaussianBlurEffect, Wn as Geometry, Pa as GifLoader, ln as GlBatch2DSystem, an as GlBlendMode, Dt as GlBuffer, Pt as GlBufferSystem, Et as GlBufferTarget, pn as GlMaskSystem, Kt as GlProgram, _n as GlRenderTarget, vn as GlRenderTargetSystem, tn as GlShaderSystem, sn as GlState, cn as GlStateSystem, hn as GlStencilSystem, j as GlSystem, gn as GlViewportSystem, K as GlitchEffect, q as GodrayEffect, nr as GradientTexture, ma as HTMLAudio, fa as HTMLAudioContext, pa as HTMLSound, qe as IN_BROWSER, Je as IN_MAC_OS, Un as IndexBuffer, _t as Input, dt as InputEvent, Fa as JsonLoader, si as KawaseBlurEffect, Da as KawaseTransition, ft as KeyboardInputEvent, ka as LeftEraseTransition, Vn as Loader, na as Lottie2D, Ia as LottieLoader, Tt as MainLoop, li as MaskEffect, I as Material, lr as Meta, pt as MouseInputEvent, B as Node, wr as Node2D, Ct as Obb2D, J as OutlineEffect, Se as PI, Ce as PI_2, pi as PixelateEffect, rr as PixelsTexture, mt as PointerInputEvent, wt as Projection2D, Gn as QuadGeometry, L as QuadUvGeometry, xt as RAD_TO_DEG, vt as RefCounted, R as RenderTarget, Ot as Renderer, w as Resource, He as SUPPORTS_AUDIO_CONTEXT, Be as SUPPORTS_CLICK_EVENTS, Ve as SUPPORTS_CREATE_IMAGE_BITMAP, Pe as SUPPORTS_IMAGE_BITMAP, Re as SUPPORTS_MOUSE_EVENTS, We as SUPPORTS_OFFLINE_AUDIO_CONTEXT, Ie as SUPPORTS_POINTER_EVENTS, Fe as SUPPORTS_RESIZE_OBSERVER, ze as SUPPORTS_TOUCH_EVENTS, Ne as SUPPORTS_WEBGL2, Ue as SUPPORTS_WEBKIT_AUDIO_CONTEXT, Ge as SUPPORTS_WEBKIT_OFFLINE_AUDIO_CONTEXT, Ke as SUPPORTS_WEB_AUDIO, Le as SUPPORTS_WHEEL_EVENTS, Sr as SceneTree, La as TextLoader, z as Texture2D, Ra as TextureLoader, ta as TextureRect2D, x as Ticker, ja as TiltShiftTransition, br as Timeline, V as TimelineNode, ra as TransformRect2D, Cr as Transition, Na as TwistTransition, At as UniformGroup, Qn as UvGeometry, Zn as UvMaterial, F as VertexAttribute, P as VertexBuffer, ia as Video2D, za as VideoLoader, ar as VideoTexture, H as Viewport, or as ViewportTexture, xa as WebAudio, ya as WebAudioContext, Bn as WebGLRenderer, ba as WebSound, ht as WheelInputEvent, xr as Window, hi as ZoomBlurEffect, Bi as alignMap, $ as assets, Er as axisDir, Ji as boxSizingMap, E as clamp, oi as clampFrag, S as createHTMLCanvas, Nt as createIdFromString, be as createNode, ct as crossOrigin, la as cssEasingPresets, ca as cubicBezier, b as customNode, ye as customNodes, Ga as defaultOptions, st as determineCrossOrigin, Hi as directionMap, Vi as displayMap, Q as edgeMap, Ui as flexDirectionMap, Wi as flexWrapMap, ai as frag, rt as getCanvasFactory, Oe as getDefaultCssPropertyValue, ot as getGlContextProvider, Xa as getRenderEngine, zi as gutterMap, ut as instanceId, $e as isCanvasElement, Xe as isElementNode, Qe as isImageElement, we as isPow2, Ze as isVideoElement, et as isWebgl2, Gi as justifyMap, D as lerp, dn as log2, on as mapGlBlendModes, un as nextPow2, xe as nextTick, Ki as overflowMap, Pr as parseCssFilter, Ae as parseCssFunctions, ke as parseCssProperty, Fr as parseCssTransformOrigin, qi as positionTypeMap, $a as render, eo as renderPixels, hr as resetBatchPool, Dr as routeConnection, nt as setCanvasFactory, at as setGlContextProvider, mn as stencilModeMap };
|
|
@@ -3,21 +3,23 @@ import { RawWeakMap } from 'modern-idoc';
|
|
|
3
3
|
import { PathMeasure } from 'modern-path2d';
|
|
4
4
|
import { Element2D } from '../2d';
|
|
5
5
|
import { TimelineNode } from '../main';
|
|
6
|
-
export declare const linear: (amount: number) => number;
|
|
7
|
-
export declare const ease: (amount: number) => number;
|
|
8
|
-
export declare const easeIn: (amount: number) => number;
|
|
9
|
-
export declare const easeOut: (amount: number) => number;
|
|
10
|
-
export declare const easeInOut: (amount: number) => number;
|
|
11
6
|
export declare function cubicBezier(x1: number, y1: number, x2: number, y2: number): (amount: number) => number;
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
7
|
+
/** CSS 缓动预设:name → cubic-bezier 控制点 [x1, y1, x2, y2] */
|
|
8
|
+
export declare const cssEasingPresets: {
|
|
9
|
+
readonly linear: readonly [0, 0, 1, 1];
|
|
10
|
+
readonly ease: readonly [0.25, 0.1, 0.25, 1];
|
|
11
|
+
readonly 'ease-in': readonly [0.42, 0, 1, 1];
|
|
12
|
+
readonly 'ease-out': readonly [0, 0, 0.58, 1];
|
|
13
|
+
readonly 'ease-in-out': readonly [0.42, 0, 0.58, 1];
|
|
14
|
+
readonly 'ease-in-quad': readonly [0.55, 0.085, 0.68, 0.53];
|
|
15
|
+
readonly 'ease-out-quad': readonly [0.25, 0.46, 0.45, 0.94];
|
|
16
|
+
readonly 'ease-in-out-quad': readonly [0.455, 0.03, 0.515, 0.955];
|
|
17
|
+
readonly 'ease-in-cubic': readonly [0.55, 0.055, 0.675, 0.19];
|
|
18
|
+
readonly 'ease-out-cubic': readonly [0.215, 0.61, 0.355, 1];
|
|
19
|
+
readonly 'ease-in-out-cubic': readonly [0.645, 0.045, 0.355, 1];
|
|
18
20
|
};
|
|
19
|
-
export type
|
|
20
|
-
export type Easing =
|
|
21
|
+
export type CssEasing = keyof typeof cssEasingPresets;
|
|
22
|
+
export type Easing = CssEasing | `cubic-bezier(${string})`;
|
|
21
23
|
export interface Keyframe {
|
|
22
24
|
easing?: Easing;
|
|
23
25
|
offset?: number;
|