modern-canvas 0.27.4 → 0.27.6
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
CHANGED
|
@@ -3338,29 +3338,29 @@ var ar = class extends Ct {
|
|
|
3338
3338
|
k([_({ fallback: "triangle-list" }), O("design:type", Object)], ar.prototype, "topology", void 0), k([_({ default: () => ({}) }), O("design:type", typeof Record > "u" ? Object : Record)], ar.prototype, "attributes", void 0), k([_({ default: () => new ir() }), O("design:type", ir === void 0 ? Object : ir)], ar.prototype, "indexBuffer", void 0), k([_({ fallback: 1 }), O("design:type", Number)], ar.prototype, "instanceCount", void 0);
|
|
3339
3339
|
//#endregion
|
|
3340
3340
|
//#region src/scene/resources/geometries/VertexBuffer.ts
|
|
3341
|
-
var
|
|
3341
|
+
var or = class extends Ct {
|
|
3342
3342
|
constructor(e) {
|
|
3343
3343
|
super(), this.setProperties(e);
|
|
3344
3344
|
}
|
|
3345
3345
|
};
|
|
3346
|
-
k([_({ fallback: A.vertex }), O("design:type", A === void 0 ? Object : A)],
|
|
3346
|
+
k([_({ fallback: A.vertex }), O("design:type", A === void 0 ? Object : A)], or.prototype, "usage", void 0), k([_({ default: () => /* @__PURE__ */ new Float32Array() }), O("design:type", Object)], or.prototype, "data", void 0);
|
|
3347
3347
|
//#endregion
|
|
3348
3348
|
//#region src/scene/resources/geometries/VertexAttribute.ts
|
|
3349
|
-
var
|
|
3349
|
+
var P = class extends Ct {
|
|
3350
3350
|
constructor(e) {
|
|
3351
3351
|
super(), this.setProperties(e);
|
|
3352
3352
|
}
|
|
3353
3353
|
};
|
|
3354
|
-
k([_({ default: () => new
|
|
3354
|
+
k([_({ default: () => new or() }), O("design:type", or === void 0 ? Object : or)], P.prototype, "buffer", void 0), k([_({ fallback: "float32" }), O("design:type", Object)], P.prototype, "format", void 0), k([_(), O("design:type", Boolean)], P.prototype, "instance", void 0), k([_(), O("design:type", Number)], P.prototype, "stride", void 0), k([_(), O("design:type", Number)], P.prototype, "offset", void 0), k([_(), O("design:type", Number)], P.prototype, "start", void 0), k([_(), O("design:type", Number)], P.prototype, "divisor", void 0);
|
|
3355
3355
|
//#endregion
|
|
3356
3356
|
//#region src/scene/resources/geometries/QuadGeometry.ts
|
|
3357
|
-
var
|
|
3357
|
+
var sr = class extends ar {
|
|
3358
3358
|
constructor() {
|
|
3359
3359
|
super({
|
|
3360
3360
|
topology: "triangle-strip",
|
|
3361
|
-
attributes: { position: new
|
|
3361
|
+
attributes: { position: new P({
|
|
3362
3362
|
format: "float32x2",
|
|
3363
|
-
buffer: new
|
|
3363
|
+
buffer: new or({ data: new Float32Array([
|
|
3364
3364
|
0,
|
|
3365
3365
|
0,
|
|
3366
3366
|
1,
|
|
@@ -3382,7 +3382,7 @@ var or = class extends ar {
|
|
|
3382
3382
|
};
|
|
3383
3383
|
//#endregion
|
|
3384
3384
|
//#region src/scene/resources/materials/Material.ts
|
|
3385
|
-
function
|
|
3385
|
+
function cr() {
|
|
3386
3386
|
return {
|
|
3387
3387
|
projectionMatrix: new Float32Array([
|
|
3388
3388
|
1,
|
|
@@ -3414,7 +3414,7 @@ function sr() {
|
|
|
3414
3414
|
])
|
|
3415
3415
|
};
|
|
3416
3416
|
}
|
|
3417
|
-
var
|
|
3417
|
+
var F = class extends Ct {
|
|
3418
3418
|
static instance = new this();
|
|
3419
3419
|
glProgram;
|
|
3420
3420
|
constructor(e = {}) {
|
|
@@ -3433,13 +3433,13 @@ var I = class extends Ct {
|
|
|
3433
3433
|
}, e.shader.updateUniforms(this);
|
|
3434
3434
|
}
|
|
3435
3435
|
};
|
|
3436
|
-
k([_({ default:
|
|
3436
|
+
k([_({ default: cr }), O("design:type", typeof Record > "u" ? Object : Record)], F.prototype, "uniforms", void 0);
|
|
3437
3437
|
//#endregion
|
|
3438
3438
|
//#region src/scene/resources/materials/EffectMaterial.ts
|
|
3439
|
-
var
|
|
3440
|
-
function
|
|
3439
|
+
var lr = /^uniform \w+ (.+?);\s*\/\/\s*=\s*([^;]+?)[\s;]*$/gm, ur = /vec(\d)\((.*)\)/;
|
|
3440
|
+
function dr(e) {
|
|
3441
3441
|
e = e.trim();
|
|
3442
|
-
let t = e.match(
|
|
3442
|
+
let t = e.match(ur);
|
|
3443
3443
|
if (t) {
|
|
3444
3444
|
let e = Array.from({ length: Number(t[1]) }, () => 0);
|
|
3445
3445
|
return t[2].split(",").forEach((t, n) => {
|
|
@@ -3448,7 +3448,7 @@ function ur(e) {
|
|
|
3448
3448
|
}
|
|
3449
3449
|
return Number(e);
|
|
3450
3450
|
}
|
|
3451
|
-
var
|
|
3451
|
+
var fr = class e extends F {
|
|
3452
3452
|
static RE = {
|
|
3453
3453
|
getColor: /\sgetColor\s*\(/,
|
|
3454
3454
|
getFromColor: /\sgetFromColor\s*\(/,
|
|
@@ -3484,12 +3484,12 @@ ${t}${n.transform ? "\nvoid main(void) { gl_FragColor = transform(vUv); }" : n.t
|
|
|
3484
3484
|
progress: 0
|
|
3485
3485
|
}
|
|
3486
3486
|
}), this.has = n;
|
|
3487
|
-
let r = t.matchAll(
|
|
3487
|
+
let r = t.matchAll(lr);
|
|
3488
3488
|
for (let e of r) e[1] && e[2] && e[1].split(",").forEach((t) => {
|
|
3489
|
-
this.uniforms[t.trim()] =
|
|
3489
|
+
this.uniforms[t.trim()] = dr(e[2]);
|
|
3490
3490
|
});
|
|
3491
3491
|
}
|
|
3492
|
-
},
|
|
3492
|
+
}, pr = class extends F {
|
|
3493
3493
|
static _instance;
|
|
3494
3494
|
static get instance() {
|
|
3495
3495
|
return this._instance ??= new this();
|
|
@@ -3528,7 +3528,7 @@ ${t}${n.transform ? "\nvoid main(void) { gl_FragColor = transform(vUv); }" : n.t
|
|
|
3528
3528
|
}
|
|
3529
3529
|
});
|
|
3530
3530
|
}
|
|
3531
|
-
},
|
|
3531
|
+
}, mr = class extends F {
|
|
3532
3532
|
static _instance;
|
|
3533
3533
|
static get instance() {
|
|
3534
3534
|
return this._instance ??= new this();
|
|
@@ -3572,20 +3572,20 @@ ${t}${n.transform ? "\nvoid main(void) { gl_FragColor = transform(vUv); }" : n.t
|
|
|
3572
3572
|
}
|
|
3573
3573
|
});
|
|
3574
3574
|
}
|
|
3575
|
-
},
|
|
3575
|
+
}, I = class extends ar {
|
|
3576
3576
|
static _instance;
|
|
3577
3577
|
static get instance() {
|
|
3578
3578
|
return this._instance ??= new this();
|
|
3579
3579
|
}
|
|
3580
|
-
static draw(e, t =
|
|
3580
|
+
static draw(e, t = mr.instance, n) {
|
|
3581
3581
|
this.instance.draw(e, t, n);
|
|
3582
3582
|
}
|
|
3583
3583
|
constructor() {
|
|
3584
3584
|
super({
|
|
3585
3585
|
attributes: {
|
|
3586
|
-
position: new
|
|
3586
|
+
position: new P({
|
|
3587
3587
|
format: "float32x2",
|
|
3588
|
-
buffer: new
|
|
3588
|
+
buffer: new or({ data: new Float32Array([
|
|
3589
3589
|
-1,
|
|
3590
3590
|
-1,
|
|
3591
3591
|
1,
|
|
@@ -3596,9 +3596,9 @@ ${t}${n.transform ? "\nvoid main(void) { gl_FragColor = transform(vUv); }" : n.t
|
|
|
3596
3596
|
1
|
|
3597
3597
|
]) })
|
|
3598
3598
|
}),
|
|
3599
|
-
uv: new
|
|
3599
|
+
uv: new P({
|
|
3600
3600
|
format: "float32x2",
|
|
3601
|
-
buffer: new
|
|
3601
|
+
buffer: new or({ data: new Float32Array([
|
|
3602
3602
|
0,
|
|
3603
3603
|
0,
|
|
3604
3604
|
1,
|
|
@@ -3620,19 +3620,19 @@ ${t}${n.transform ? "\nvoid main(void) { gl_FragColor = transform(vUv); }" : n.t
|
|
|
3620
3620
|
]) })
|
|
3621
3621
|
});
|
|
3622
3622
|
}
|
|
3623
|
-
},
|
|
3623
|
+
}, hr = class extends ar {
|
|
3624
3624
|
positionBuffer;
|
|
3625
3625
|
uvBuffer;
|
|
3626
3626
|
constructor(e) {
|
|
3627
|
-
let t = new
|
|
3627
|
+
let t = new or({ data: /* @__PURE__ */ new Float32Array() }), n = new or({ data: /* @__PURE__ */ new Float32Array() });
|
|
3628
3628
|
super({
|
|
3629
3629
|
...e,
|
|
3630
3630
|
attributes: {
|
|
3631
|
-
position: new
|
|
3631
|
+
position: new P({
|
|
3632
3632
|
format: "float32x2",
|
|
3633
3633
|
buffer: t
|
|
3634
3634
|
}),
|
|
3635
|
-
uv: new
|
|
3635
|
+
uv: new P({
|
|
3636
3636
|
format: "float32x2",
|
|
3637
3637
|
buffer: n
|
|
3638
3638
|
})
|
|
@@ -3640,7 +3640,7 @@ ${t}${n.transform ? "\nvoid main(void) { gl_FragColor = transform(vUv); }" : n.t
|
|
|
3640
3640
|
indexBuffer: new ir({ data: /* @__PURE__ */ new Uint32Array() })
|
|
3641
3641
|
}), this.positionBuffer = t, this.uvBuffer = n;
|
|
3642
3642
|
}
|
|
3643
|
-
},
|
|
3643
|
+
}, gr = class extends Ct {
|
|
3644
3644
|
get valid() {
|
|
3645
3645
|
return !!(this.width && this.height);
|
|
3646
3646
|
}
|
|
@@ -3654,10 +3654,10 @@ ${t}${n.transform ? "\nvoid main(void) { gl_FragColor = transform(vUv); }" : n.t
|
|
|
3654
3654
|
super._destroy(), this.colorTextures.forEach((e) => e.destroy());
|
|
3655
3655
|
}
|
|
3656
3656
|
};
|
|
3657
|
-
k([_({ fallback: !1 }), O("design:type", Boolean)],
|
|
3657
|
+
k([_({ fallback: !1 }), O("design:type", Boolean)], gr.prototype, "isRoot", void 0), k([_({ fallback: 0 }), O("design:type", Number)], gr.prototype, "x", void 0), k([_({ fallback: 0 }), O("design:type", Number)], gr.prototype, "y", void 0), k([_({ fallback: 0 }), O("design:type", Number)], gr.prototype, "width", void 0), k([_({ fallback: 0 }), O("design:type", Number)], gr.prototype, "height", void 0), k([_({ fallback: 0 }), O("design:type", Number)], gr.prototype, "mipLevel", void 0), k([_({ fallback: !1 }), O("design:type", Boolean)], gr.prototype, "msaa", void 0), k([_({ default: () => [new L()] }), O("design:type", Array)], gr.prototype, "colorTextures", void 0);
|
|
3658
3658
|
//#endregion
|
|
3659
3659
|
//#region src/scene/resources/textures/Texture2D.ts
|
|
3660
|
-
var
|
|
3660
|
+
var L = class extends Ct {
|
|
3661
3661
|
static get EMPTY() {
|
|
3662
3662
|
return new this({
|
|
3663
3663
|
width: 1,
|
|
@@ -3768,10 +3768,10 @@ var R = class extends Ct {
|
|
|
3768
3768
|
super._destroy(), Fe && this.source instanceof ImageBitmap && this.source.close();
|
|
3769
3769
|
}
|
|
3770
3770
|
};
|
|
3771
|
-
k([_({ fallback: "unknown" }), O("design:type", String)],
|
|
3771
|
+
k([_({ fallback: "unknown" }), O("design:type", String)], L.prototype, "uploadMethodId", void 0), k([_({ internal: !0 }), O("design:type", Object)], L.prototype, "source", void 0), k([_({ fallback: 0 }), O("design:type", Number)], L.prototype, "width", void 0), k([_({ fallback: 0 }), O("design:type", Number)], L.prototype, "height", void 0), k([_({ fallback: 1 }), O("design:type", Number)], L.prototype, "pixelRatio", void 0), k([_({ fallback: "bgra8unorm" }), O("design:type", Object)], L.prototype, "format", void 0), k([_({ fallback: "premultiply-alpha-on-upload" }), O("design:type", Object)], L.prototype, "alphaMode", void 0), k([_({ fallback: 1 }), O("design:type", Number)], L.prototype, "mipLevelCount", void 0), k([_({ fallback: !1 }), O("design:type", Boolean)], L.prototype, "mipmap", void 0), k([_({ fallback: "clamp-to-edge" }), O("design:type", Object)], L.prototype, "addressModeU", void 0), k([_({ fallback: "clamp-to-edge" }), O("design:type", Object)], L.prototype, "addressModeV", void 0), k([_({ fallback: "clamp-to-edge" }), O("design:type", Object)], L.prototype, "addressModeW", void 0), k([_({ fallback: "linear" }), O("design:type", Object)], L.prototype, "magFilter", void 0), k([_({ fallback: "linear" }), O("design:type", Object)], L.prototype, "minFilter", void 0), k([_({ fallback: "linear" }), O("design:type", Object)], L.prototype, "mipmapFilter", void 0), k([_({ fallback: !1 }), O("design:type", Boolean)], L.prototype, "isPowerOfTwo", void 0);
|
|
3772
3772
|
//#endregion
|
|
3773
3773
|
//#region src/scene/resources/textures/AnimatedTexture.ts
|
|
3774
|
-
var
|
|
3774
|
+
var _r = class extends Ct {
|
|
3775
3775
|
frames;
|
|
3776
3776
|
frameIndex = 0;
|
|
3777
3777
|
get currentFrame() {
|
|
@@ -3781,7 +3781,7 @@ var gr = class extends Ct {
|
|
|
3781
3781
|
super();
|
|
3782
3782
|
let t;
|
|
3783
3783
|
if (Array.isArray(e)) t = e;
|
|
3784
|
-
else if (e instanceof
|
|
3784
|
+
else if (e instanceof L) t = [{
|
|
3785
3785
|
texture: e,
|
|
3786
3786
|
duration: 0
|
|
3787
3787
|
}];
|
|
@@ -3796,7 +3796,7 @@ var gr = class extends Ct {
|
|
|
3796
3796
|
e.texture.destroy();
|
|
3797
3797
|
});
|
|
3798
3798
|
}
|
|
3799
|
-
},
|
|
3799
|
+
}, vr = class extends L {
|
|
3800
3800
|
constructor(e = {}) {
|
|
3801
3801
|
super({
|
|
3802
3802
|
pixelRatio: 2,
|
|
@@ -3816,7 +3816,7 @@ var gr = class extends Ct {
|
|
|
3816
3816
|
}
|
|
3817
3817
|
super._updateProperty(e, t, n);
|
|
3818
3818
|
}
|
|
3819
|
-
},
|
|
3819
|
+
}, yr = class e extends L {
|
|
3820
3820
|
static _cached = /* @__PURE__ */ new Map();
|
|
3821
3821
|
static get(t) {
|
|
3822
3822
|
let n = new T(t), r = n.toHex(), i = this._cached.get(r);
|
|
@@ -3837,23 +3837,23 @@ var gr = class extends Ct {
|
|
|
3837
3837
|
mipmap: !0
|
|
3838
3838
|
});
|
|
3839
3839
|
}
|
|
3840
|
-
},
|
|
3840
|
+
}, R = 2048, br = 2, xr = class {
|
|
3841
3841
|
superSample = 2;
|
|
3842
3842
|
_pages = [];
|
|
3843
3843
|
_slots = /* @__PURE__ */ new Map();
|
|
3844
3844
|
_newPage() {
|
|
3845
|
-
let e = new
|
|
3845
|
+
let e = new vr({
|
|
3846
3846
|
pixelRatio: 1,
|
|
3847
3847
|
mipmap: !0
|
|
3848
3848
|
});
|
|
3849
|
-
e.width =
|
|
3850
|
-
let t = e.source ?? C(
|
|
3851
|
-
t.width =
|
|
3849
|
+
e.width = R, e.height = R;
|
|
3850
|
+
let t = e.source ?? C(R, R);
|
|
3851
|
+
t.width = R, t.height = R;
|
|
3852
3852
|
let n = {
|
|
3853
3853
|
texture: e,
|
|
3854
3854
|
ctx: t.getContext("2d"),
|
|
3855
|
-
penX:
|
|
3856
|
-
penY:
|
|
3855
|
+
penX: br,
|
|
3856
|
+
penY: br,
|
|
3857
3857
|
rowH: 0
|
|
3858
3858
|
};
|
|
3859
3859
|
return this._pages.push(n), n;
|
|
@@ -3861,18 +3861,18 @@ var gr = class extends Ct {
|
|
|
3861
3861
|
acquire(e, t, n, r) {
|
|
3862
3862
|
let i = this._slots.get(e);
|
|
3863
3863
|
if (i !== void 0) return i;
|
|
3864
|
-
let a = this.superSample, o = Math.ceil(t * a), s = Math.ceil(n * a), c = o +
|
|
3865
|
-
if (c >
|
|
3864
|
+
let a = this.superSample, o = Math.ceil(t * a), s = Math.ceil(n * a), c = o + br * 2, l = s + br * 2;
|
|
3865
|
+
if (c > R || l > R) return this._slots.set(e, null), null;
|
|
3866
3866
|
let u = this._pages[this._pages.length - 1] ?? this._newPage();
|
|
3867
|
-
u.penX + c >
|
|
3868
|
-
let d = u.penX +
|
|
3867
|
+
u.penX + c > R && (u.penX = br, u.penY += u.rowH + br, u.rowH = 0), u.penY + l > R && (u = this._newPage());
|
|
3868
|
+
let d = u.penX + br, f = u.penY + br, p = u.ctx;
|
|
3869
3869
|
p.save(), p.setTransform(a, 0, 0, a, d, f), p.beginPath(), r(p), p.restore(), u.texture.requestUpdate("source"), u.penX += c, u.rowH = Math.max(u.rowH, l);
|
|
3870
3870
|
let m = {
|
|
3871
3871
|
texture: u.texture,
|
|
3872
|
-
u0: d /
|
|
3873
|
-
v0: f /
|
|
3874
|
-
u1: (d + t * a) /
|
|
3875
|
-
v1: (f + n * a) /
|
|
3872
|
+
u0: d / R,
|
|
3873
|
+
v0: f / R,
|
|
3874
|
+
u1: (d + t * a) / R,
|
|
3875
|
+
v1: (f + n * a) / R
|
|
3876
3876
|
};
|
|
3877
3877
|
return this._slots.set(e, m), m;
|
|
3878
3878
|
}
|
|
@@ -3880,7 +3880,7 @@ var gr = class extends Ct {
|
|
|
3880
3880
|
for (let e of this._pages) e.texture.destroy();
|
|
3881
3881
|
this._pages.length = 0, this._slots.clear();
|
|
3882
3882
|
}
|
|
3883
|
-
},
|
|
3883
|
+
}, Sr = new xr(), Cr = class e extends L {
|
|
3884
3884
|
static test(e) {
|
|
3885
3885
|
return u(e);
|
|
3886
3886
|
}
|
|
@@ -3914,7 +3914,7 @@ var gr = class extends Ct {
|
|
|
3914
3914
|
constructor(t, n, r) {
|
|
3915
3915
|
super(e.linearGradient(t, n, r));
|
|
3916
3916
|
}
|
|
3917
|
-
},
|
|
3917
|
+
}, wr = class extends L {
|
|
3918
3918
|
constructor(e = {}) {
|
|
3919
3919
|
super({
|
|
3920
3920
|
...e,
|
|
@@ -3924,7 +3924,7 @@ var gr = class extends Ct {
|
|
|
3924
3924
|
};
|
|
3925
3925
|
//#endregion
|
|
3926
3926
|
//#region src/scene/resources/textures/VideoTexture.ts
|
|
3927
|
-
function
|
|
3927
|
+
function Tr(e) {
|
|
3928
3928
|
return {
|
|
3929
3929
|
autoLoad: !!(e?.autoLoad ?? !0),
|
|
3930
3930
|
autoPlay: !!(e?.autoPlay ?? !1),
|
|
@@ -3935,7 +3935,7 @@ function wr(e) {
|
|
|
3935
3935
|
playsinline: !!(e?.playsinline ?? !0)
|
|
3936
3936
|
};
|
|
3937
3937
|
}
|
|
3938
|
-
var
|
|
3938
|
+
var Er = class e extends L {
|
|
3939
3939
|
static mimeTypes = new Map(Object.entries({
|
|
3940
3940
|
ogv: "video/ogg",
|
|
3941
3941
|
mov: "video/quicktime",
|
|
@@ -3997,7 +3997,7 @@ var Tr = class e extends R {
|
|
|
3997
3997
|
_reject;
|
|
3998
3998
|
_seekResolves = [];
|
|
3999
3999
|
constructor(t, n) {
|
|
4000
|
-
let r =
|
|
4000
|
+
let r = Tr(n);
|
|
4001
4001
|
if (!Qe(t)) {
|
|
4002
4002
|
typeof t == "string" && (t = [t]);
|
|
4003
4003
|
let n = t[0].src || t[0];
|
|
@@ -4093,13 +4093,13 @@ var Tr = class e extends R {
|
|
|
4093
4093
|
k([_({
|
|
4094
4094
|
internal: !0,
|
|
4095
4095
|
fallback: !0
|
|
4096
|
-
}), O("design:type", Boolean)],
|
|
4096
|
+
}), O("design:type", Boolean)], Er.prototype, "autoUpdate", void 0), k([_({
|
|
4097
4097
|
internal: !0,
|
|
4098
4098
|
fallback: 0
|
|
4099
|
-
}), O("design:type", Number)],
|
|
4099
|
+
}), O("design:type", Number)], Er.prototype, "fps", void 0);
|
|
4100
4100
|
//#endregion
|
|
4101
4101
|
//#region src/scene/resources/textures/ViewportTexture.ts
|
|
4102
|
-
var
|
|
4102
|
+
var Dr = class extends L {}, Or = class extends ue {
|
|
4103
4103
|
fillStyle;
|
|
4104
4104
|
fillRule;
|
|
4105
4105
|
strokeStyle;
|
|
@@ -4114,7 +4114,7 @@ var Er = class extends R {}, Dr = class extends ue {
|
|
|
4114
4114
|
_draws = [];
|
|
4115
4115
|
_triCache = [];
|
|
4116
4116
|
_parseDrawStyle(e) {
|
|
4117
|
-
return e ? e instanceof
|
|
4117
|
+
return e ? e instanceof L ? { texture: e } : { texture: yr.get(e) } : {};
|
|
4118
4118
|
}
|
|
4119
4119
|
stroke(e) {
|
|
4120
4120
|
if (!this.curves.length) return;
|
|
@@ -4203,7 +4203,7 @@ var Er = class extends R {}, Dr = class extends ue {
|
|
|
4203
4203
|
});
|
|
4204
4204
|
continue;
|
|
4205
4205
|
}
|
|
4206
|
-
let { path: r, ...i } = t, a = i.type === "stroke" ? i.lineStyle : void 0, o = i.type === "stroke", s = o ? i.flow : void 0, c = o && (!i.texture || i.texture instanceof
|
|
4206
|
+
let { path: r, ...i } = t, a = i.type === "stroke" ? i.lineStyle : void 0, o = i.type === "stroke", s = o ? i.flow : void 0, c = o && (!i.texture || i.texture instanceof yr), l = o && (!!s || c), u = `${i.type}|${r.toData()}|${a ? `${a.width},${a.cap},${a.join},${a.alignment},${a.miterLimit}` : ""}${l ? "|uv" : ""}`, d = this._triCache[n];
|
|
4207
4207
|
if (!d || d.sig !== u) {
|
|
4208
4208
|
let e = [], t = [], a = l ? [] : void 0;
|
|
4209
4209
|
i.type === "fill" ? r.fillTriangulate({
|
|
@@ -4237,7 +4237,7 @@ var Er = class extends R {}, Dr = class extends ue {
|
|
|
4237
4237
|
destroy() {
|
|
4238
4238
|
this.reset(), this._triCache.length = 0;
|
|
4239
4239
|
}
|
|
4240
|
-
},
|
|
4240
|
+
}, kr = class {
|
|
4241
4241
|
front = [];
|
|
4242
4242
|
default = [];
|
|
4243
4243
|
back = [];
|
|
@@ -4280,7 +4280,7 @@ var Er = class extends R {}, Dr = class extends ue {
|
|
|
4280
4280
|
toJSON() {
|
|
4281
4281
|
return [...this.default];
|
|
4282
4282
|
}
|
|
4283
|
-
},
|
|
4283
|
+
}, Ar = class extends w {
|
|
4284
4284
|
parent;
|
|
4285
4285
|
getPropertyDeclarations() {
|
|
4286
4286
|
super.getPropertyDeclarations();
|
|
@@ -4299,22 +4299,22 @@ var Er = class extends R {}, Dr = class extends ue {
|
|
|
4299
4299
|
deleteProperty: (e, t) => Reflect.has(e, t) || String(t).startsWith("_") ? Reflect.deleteProperty(e, t) : (e.setProperty(String(t), void 0), !0)
|
|
4300
4300
|
});
|
|
4301
4301
|
}
|
|
4302
|
-
},
|
|
4303
|
-
function
|
|
4304
|
-
let t =
|
|
4305
|
-
return t++,
|
|
4302
|
+
}, jr, Mr = {};
|
|
4303
|
+
function Nr(e) {
|
|
4304
|
+
let t = Mr[e] ?? 0;
|
|
4305
|
+
return t++, Mr[e] = t, t;
|
|
4306
4306
|
}
|
|
4307
|
-
var
|
|
4307
|
+
var z = jr = class extends w {
|
|
4308
4308
|
static parse(e, t = "Node") {
|
|
4309
4309
|
if (Array.isArray(e)) return e.map((e) => this.parse(e));
|
|
4310
|
-
let { is: n, meta: r = {}, children: i, ...a } = e, o = new ((ye.get(n ?? r.inCanvasIs ?? t)) ??
|
|
4310
|
+
let { is: n, meta: r = {}, children: i, ...a } = e, o = new ((ye.get(n ?? r.inCanvasIs ?? t)) ?? jr)({
|
|
4311
4311
|
...a,
|
|
4312
4312
|
meta: r
|
|
4313
4313
|
});
|
|
4314
4314
|
return i?.forEach((e) => o.appendChild(this.parse(e))), o;
|
|
4315
4315
|
}
|
|
4316
4316
|
_mask;
|
|
4317
|
-
_meta = new
|
|
4317
|
+
_meta = new Ar(this);
|
|
4318
4318
|
get meta() {
|
|
4319
4319
|
return this._meta;
|
|
4320
4320
|
}
|
|
@@ -4337,7 +4337,7 @@ var B = Ar = class extends w {
|
|
|
4337
4337
|
}).append(t), this.on("treeEnter", this._onTreeEnter).on("treeExit", this._onTreeExit).on("parented", this._onParented).on("unparented", this._onUnparented).on("ready", this._onReady).on("process", this._onProcess), this.updateProcessable(), this.updateRenderable();
|
|
4338
4338
|
}
|
|
4339
4339
|
_defaultName() {
|
|
4340
|
-
return `@${this.is}@${
|
|
4340
|
+
return `@${this.is}@${Nr(this.is)}`;
|
|
4341
4341
|
}
|
|
4342
4342
|
setProperties(e) {
|
|
4343
4343
|
if (e) {
|
|
@@ -4404,7 +4404,7 @@ var B = Ar = class extends w {
|
|
|
4404
4404
|
}
|
|
4405
4405
|
return this;
|
|
4406
4406
|
}
|
|
4407
|
-
_children = new
|
|
4407
|
+
_children = new kr();
|
|
4408
4408
|
get children() {
|
|
4409
4409
|
return this._children.default;
|
|
4410
4410
|
}
|
|
@@ -4564,7 +4564,7 @@ var B = Ar = class extends w {
|
|
|
4564
4564
|
append(...e) {
|
|
4565
4565
|
let t;
|
|
4566
4566
|
t = Array.isArray(e[0]) ? e[0] : e, t.forEach((e) => {
|
|
4567
|
-
e instanceof
|
|
4567
|
+
e instanceof jr ? this.appendChild(e) : this.appendChild(jr.parse(e));
|
|
4568
4568
|
});
|
|
4569
4569
|
}
|
|
4570
4570
|
before(...e) {
|
|
@@ -4667,13 +4667,13 @@ var B = Ar = class extends w {
|
|
|
4667
4667
|
});
|
|
4668
4668
|
}
|
|
4669
4669
|
};
|
|
4670
|
-
k([_({ default: () => c() }), O("design:type", String)],
|
|
4670
|
+
k([_({ default: () => c() }), O("design:type", String)], z.prototype, "id", void 0), k([_({ default: () => c() }), O("design:type", String)], z.prototype, "name", void 0), k([_({ fallback: "inherit" }), O("design:type", Object)], z.prototype, "processMode", void 0), k([_({ fallback: "default" }), O("design:type", Object)], z.prototype, "processSortMode", void 0), k([_({ fallback: "inherit" }), O("design:type", Object)], z.prototype, "renderMode", void 0), k([_({ fallback: "inherit" }), O("design:type", Object)], z.prototype, "inputMode", void 0), k([_({ fallback: "default" }), O("design:type", Object)], z.prototype, "internalMode", void 0), k([_({
|
|
4671
4671
|
internal: !0,
|
|
4672
4672
|
default: !0
|
|
4673
|
-
}), O("design:type", Boolean)],
|
|
4673
|
+
}), O("design:type", Boolean)], z.prototype, "needsRender", void 0), z = jr = k([x("Node"), O("design:paramtypes", [typeof Partial > "u" ? Object : Partial, Array])], z);
|
|
4674
4674
|
//#endregion
|
|
4675
4675
|
//#region src/scene/main/TimelineNode.ts
|
|
4676
|
-
var
|
|
4676
|
+
var B = class extends z {
|
|
4677
4677
|
insideTimeRange = !1;
|
|
4678
4678
|
get _timeline() {
|
|
4679
4679
|
return this._tree?.timeline;
|
|
@@ -4755,7 +4755,7 @@ var Nr = class extends B {
|
|
|
4755
4755
|
super._process(e), this._updateCurrentTime();
|
|
4756
4756
|
}
|
|
4757
4757
|
};
|
|
4758
|
-
k([_({ fallback: !1 }), O("design:type", Boolean)],
|
|
4758
|
+
k([_({ fallback: !1 }), O("design:type", Boolean)], B.prototype, "loop", void 0), k([_({ fallback: 0 }), O("design:type", Number)], B.prototype, "delay", void 0), k([_({ fallback: 0 }), O("design:type", Number)], B.prototype, "duration", void 0), k([_({ fallback: !1 }), O("design:type", Boolean)], B.prototype, "paused", void 0), B = k([x("TimelineNode"), O("design:paramtypes", [typeof Partial > "u" ? Object : Partial, Array])], B);
|
|
4759
4759
|
//#endregion
|
|
4760
4760
|
//#region src/scene/main/CanvasItem.ts
|
|
4761
4761
|
var Pr = [], Fr = 0;
|
|
@@ -4766,7 +4766,7 @@ function Lr(e, t, n, r) {
|
|
|
4766
4766
|
let i = Pr[Fr];
|
|
4767
4767
|
return i || (i = {}, Pr[Fr] = i), Fr++, Object.assign(i, e), i.roundPixels = t, i.size = n, i.texture = r, i.__source = e, i;
|
|
4768
4768
|
}
|
|
4769
|
-
var Rr = class extends
|
|
4769
|
+
var Rr = class extends B {
|
|
4770
4770
|
_blendMode;
|
|
4771
4771
|
_parentGlobalVisible;
|
|
4772
4772
|
_globalVisible;
|
|
@@ -4784,7 +4784,7 @@ var Rr = class extends Nr {
|
|
|
4784
4784
|
255,
|
|
4785
4785
|
255
|
|
4786
4786
|
];
|
|
4787
|
-
context = new
|
|
4787
|
+
context = new Or();
|
|
4788
4788
|
_resetContext = !0;
|
|
4789
4789
|
needsDraw = !0;
|
|
4790
4790
|
needsLayout = !1;
|
|
@@ -4915,7 +4915,7 @@ var Rr = class extends Nr {
|
|
|
4915
4915
|
return;
|
|
4916
4916
|
}
|
|
4917
4917
|
let t = this._tree?.pixelate, n = this._tree?.roundPixels, r = this._batchables;
|
|
4918
|
-
for (let i, a, o = r.length, s = 0; s < o; s++) i = r[s], a = i.texture, a instanceof
|
|
4918
|
+
for (let i, a, o = r.length, s = 0; s < o; s++) i = r[s], a = i.texture, a instanceof Dr && (a = this._handleViewportTexture(i)), e.batch2D.render(Lr(i, n, t ? i.size : void 0, a));
|
|
4919
4919
|
super._render(e);
|
|
4920
4920
|
}
|
|
4921
4921
|
_cullsRender() {
|
|
@@ -4934,10 +4934,10 @@ k([_(), O("design:type", Object)], Rr.prototype, "blendMode", void 0), k([_({
|
|
|
4934
4934
|
}), O("design:type", Number)], Rr.prototype, "opacity", void 0), Rr = k([x("CanvasItem"), O("design:paramtypes", [typeof Partial > "u" ? Object : Partial, Array])], Rr);
|
|
4935
4935
|
//#endregion
|
|
4936
4936
|
//#region src/scene/main/Viewport.ts
|
|
4937
|
-
var V = class extends
|
|
4937
|
+
var V = class extends z {
|
|
4938
4938
|
canvasTransform = new v();
|
|
4939
4939
|
renderTargetIndex = 0;
|
|
4940
|
-
renderTargets = [new
|
|
4940
|
+
renderTargets = [new gr(), new gr()];
|
|
4941
4941
|
get valid() {
|
|
4942
4942
|
return !!(this.width && this.height);
|
|
4943
4943
|
}
|
|
@@ -4984,7 +4984,7 @@ var V = class extends B {
|
|
|
4984
4984
|
return !1;
|
|
4985
4985
|
}
|
|
4986
4986
|
activateWithCopy(e, t) {
|
|
4987
|
-
this.resize(t.width, t.height), this.activate(e) && (e.clear(), t.texture.activate(e, 0),
|
|
4987
|
+
this.resize(t.width, t.height), this.activate(e) && (e.clear(), t.texture.activate(e, 0), I.draw(e, mr.instance, { sampler: 0 }));
|
|
4988
4988
|
}
|
|
4989
4989
|
renderStart(e, t) {
|
|
4990
4990
|
this.activate(e, t) && e.clear();
|
|
@@ -5012,7 +5012,7 @@ var V = class extends B {
|
|
|
5012
5012
|
k([_({ fallback: 0 }), O("design:type", Number)], V.prototype, "x", void 0), k([_({ fallback: 0 }), O("design:type", Number)], V.prototype, "y", void 0), k([_({ fallback: 0 }), O("design:type", Number)], V.prototype, "width", void 0), k([_({ fallback: 0 }), O("design:type", Number)], V.prototype, "height", void 0), k([_({ fallback: 0 }), O("design:type", Number)], V.prototype, "mipLevel", void 0), k([_({ fallback: !1 }), O("design:type", Boolean)], V.prototype, "msaa", void 0), V = k([x("Viewport")], V);
|
|
5013
5013
|
//#endregion
|
|
5014
5014
|
//#region src/scene/main/Effect.ts
|
|
5015
|
-
var H = class extends
|
|
5015
|
+
var H = class extends B {
|
|
5016
5016
|
material;
|
|
5017
5017
|
get _effectMode() {
|
|
5018
5018
|
return this.effectMode ?? "parent";
|
|
@@ -5035,7 +5035,7 @@ var H = class extends Nr {
|
|
|
5035
5035
|
_updateProperty(e, t, n) {
|
|
5036
5036
|
switch (super._updateProperty(e, t, n), e) {
|
|
5037
5037
|
case "glsl": {
|
|
5038
|
-
let e = new
|
|
5038
|
+
let e = new fr(t);
|
|
5039
5039
|
!this.effectMode && e.has.transition && (this.effectMode = "transition"), this.material = e;
|
|
5040
5040
|
break;
|
|
5041
5041
|
}
|
|
@@ -5223,13 +5223,13 @@ var H = class extends Nr {
|
|
|
5223
5223
|
}
|
|
5224
5224
|
apply(e, t, n) {
|
|
5225
5225
|
this.material && (n?.redraw ? t.redraw(e, () => {
|
|
5226
|
-
|
|
5226
|
+
I.draw(e, this.material, {
|
|
5227
5227
|
from: 0,
|
|
5228
5228
|
to: 1,
|
|
5229
5229
|
progress: this.currentTimeProgress,
|
|
5230
5230
|
ratio: t.width / t.height
|
|
5231
5231
|
});
|
|
5232
|
-
}) :
|
|
5232
|
+
}) : I.draw(e, this.material, {
|
|
5233
5233
|
from: 0,
|
|
5234
5234
|
to: 1,
|
|
5235
5235
|
progress: this.currentTimeProgress,
|
|
@@ -5268,7 +5268,7 @@ var zr = class {
|
|
|
5268
5268
|
});
|
|
5269
5269
|
}), this.reset();
|
|
5270
5270
|
}
|
|
5271
|
-
}, Br, Vr = Br = class extends
|
|
5271
|
+
}, Br, Vr = Br = class extends z {
|
|
5272
5272
|
currentTime = 0;
|
|
5273
5273
|
playing = !1;
|
|
5274
5274
|
playbackRate = 1;
|
|
@@ -5382,9 +5382,19 @@ var U = class extends At {
|
|
|
5382
5382
|
getNodeById(e) {
|
|
5383
5383
|
return this.nodeMap.get(e);
|
|
5384
5384
|
}
|
|
5385
|
+
resolveThemeColor(e) {
|
|
5386
|
+
if (typeof e != "string" || e[0] !== "@") return e;
|
|
5387
|
+
let t = e.slice(1);
|
|
5388
|
+
return this.themeTokens?.[t]?.[this.theme] ?? e;
|
|
5389
|
+
}
|
|
5390
|
+
_applyThemeToTree() {
|
|
5391
|
+
this.nodeMap.forEach((e) => {
|
|
5392
|
+
e.applyThemeColors?.();
|
|
5393
|
+
});
|
|
5394
|
+
}
|
|
5385
5395
|
constructor(e) {
|
|
5386
5396
|
super(), this.on("nodeEnter", (e) => {
|
|
5387
|
-
this.nodeMap.set(e.id, e), ft();
|
|
5397
|
+
this.nodeMap.set(e.id, e), e.applyThemeColors?.(), ft();
|
|
5388
5398
|
}), this.on("nodeExit", (e) => {
|
|
5389
5399
|
this.nodeMap.delete(e.id), ft();
|
|
5390
5400
|
}), this.setProperties(e), this._bindFonts(this.fonts);
|
|
@@ -5411,6 +5421,10 @@ var U = class extends At {
|
|
|
5411
5421
|
case "fonts":
|
|
5412
5422
|
this._bindFonts(t), this._scheduleTextRemeasure();
|
|
5413
5423
|
break;
|
|
5424
|
+
case "theme":
|
|
5425
|
+
case "themeTokens":
|
|
5426
|
+
this._applyThemeToTree();
|
|
5427
|
+
break;
|
|
5414
5428
|
}
|
|
5415
5429
|
}
|
|
5416
5430
|
setProperties(e) {
|
|
@@ -5432,16 +5446,16 @@ var U = class extends At {
|
|
|
5432
5446
|
_renderScreen(e) {
|
|
5433
5447
|
this.root.finish(e), e.state.reset(), e.renderTarget.unbind(), this.backgroundColor && e.gl.clearColor(...this._backgroundColor.toArray()), e.clear(), this.backgroundColor && e.gl.clearColor(0, 0, 0, 0);
|
|
5434
5448
|
let t = this.root.texture;
|
|
5435
|
-
t.activate(e, 0), this.fxaa ?
|
|
5449
|
+
t.activate(e, 0), this.fxaa ? I.draw(e, pr.instance, {
|
|
5436
5450
|
sampler: 0,
|
|
5437
5451
|
texelSize: [1 / (t.pixelWidth || t.width || 1), 1 / (t.pixelHeight || t.height || 1)]
|
|
5438
|
-
}) :
|
|
5452
|
+
}) : I.draw(e), t.inactivate(e);
|
|
5439
5453
|
}
|
|
5440
5454
|
_destroy() {
|
|
5441
5455
|
super._destroy(), this._bindFonts(void 0), this.root.destroy(), this.input.destroy(), this.nodeMap.clear();
|
|
5442
5456
|
}
|
|
5443
5457
|
};
|
|
5444
|
-
k([_({ alias: "root.msaa" }), O("design:type", Boolean)], U.prototype, "msaa", void 0), k([_({ fallback: !1 }), O("design:type", Boolean)], U.prototype, "fxaa", void 0), k([_(), O("design:type", Object)], U.prototype, "flowColor", void 0), k([_(), O("design:type", Number)], U.prototype, "flowPeriod", void 0), k([_({ fallback: !1 }), O("design:type", Boolean)], U.prototype, "pixelate", void 0), k([_({ fallback: !1 }), O("design:type", Boolean)], U.prototype, "roundPixels", void 0), k([_(), O("design:type", Object)], U.prototype, "backgroundColor", void 0), k([_({
|
|
5458
|
+
k([_({ alias: "root.msaa" }), O("design:type", Boolean)], U.prototype, "msaa", void 0), k([_({ fallback: !1 }), O("design:type", Boolean)], U.prototype, "fxaa", void 0), k([_(), O("design:type", Object)], U.prototype, "flowColor", void 0), k([_(), O("design:type", Number)], U.prototype, "flowPeriod", void 0), k([_({ fallback: !1 }), O("design:type", Boolean)], U.prototype, "pixelate", void 0), k([_({ fallback: !1 }), O("design:type", Boolean)], U.prototype, "roundPixels", void 0), k([_(), O("design:type", Object)], U.prototype, "backgroundColor", void 0), k([_({ fallback: "light" }), O("design:type", String)], U.prototype, "theme", void 0), k([_(), O("design:type", Object)], U.prototype, "themeTokens", void 0), k([_({
|
|
5445
5459
|
internal: !0,
|
|
5446
5460
|
fallback: !1
|
|
5447
5461
|
}), O("design:type", Boolean)], U.prototype, "debug", void 0), k([_({
|
|
@@ -5884,7 +5898,7 @@ var ri, W = class extends H {
|
|
|
5884
5898
|
static {
|
|
5885
5899
|
ri = this;
|
|
5886
5900
|
}
|
|
5887
|
-
static material = new
|
|
5901
|
+
static material = new F({ gl: {
|
|
5888
5902
|
vertex: "precision mediump float;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUv;\nvoid main() {\n gl_Position = vec4(position, 0.0, 1.0);\n vUv = uv;\n}",
|
|
5889
5903
|
fragment: "varying vec2 vUv;\nuniform sampler2D sampler;\nuniform float gamma;\nuniform float contrast;\nuniform float saturation;\nuniform float brightness;\nuniform float red;\nuniform float green;\nuniform float blue;\nuniform float alpha;\n\nvoid main(void) {\n vec4 c = texture2D(sampler, vUv);\n if (c.a > 0.0) {\n c.rgb /= c.a;\n vec3 rgb = pow(c.rgb, vec3(1. / gamma));\n rgb = mix(vec3(.5), mix(vec3(dot(vec3(.2125, .7154, .0721), rgb)), rgb, saturation), contrast);\n rgb.r *= red;\n rgb.g *= green;\n rgb.b *= blue;\n c.rgb = rgb * brightness;\n c.rgb *= c.a;\n }\n gl_FragColor = c * alpha;\n}"
|
|
5890
5904
|
} });
|
|
@@ -5893,7 +5907,7 @@ var ri, W = class extends H {
|
|
|
5893
5907
|
}
|
|
5894
5908
|
apply(e, t) {
|
|
5895
5909
|
t.redraw(e, () => {
|
|
5896
|
-
|
|
5910
|
+
I.draw(e, ri.material, {
|
|
5897
5911
|
sampler: 0,
|
|
5898
5912
|
saturation: this.saturation,
|
|
5899
5913
|
contrast: this.contrast,
|
|
@@ -5914,7 +5928,7 @@ var ii, ai = class extends H {
|
|
|
5914
5928
|
static {
|
|
5915
5929
|
ii = this;
|
|
5916
5930
|
}
|
|
5917
|
-
static material = new
|
|
5931
|
+
static material = new F({ gl: {
|
|
5918
5932
|
vertex: "attribute vec2 position;\nattribute vec2 uv;\nout vec2 vUv;\nvoid main() {\n gl_Position = vec4(position, 0.0, 1.0);\n vUv = uv;\n}",
|
|
5919
5933
|
fragment: "in vec2 vUv;\nuniform sampler2D sampler;\nuniform float m[20];\n\nvoid main(void) {\n vec4 c = texture2D(sampler, vUv);\n if (c.a > 0.0) {\n c.rgb /= c.a;\n }\n gl_FragColor = vec4(\n m[0] * c.r + m[1] * c.g + m[2] * c.b + m[3] * c.a + m[4] / 255.0,\n m[5] * c.r + m[6] * c.g + m[7] * c.b + m[8] * c.a + m[9] / 255.0,\n m[10] * c.r + m[11] * c.g + m[12] * c.b + m[13] * c.a + m[14] / 255.0,\n m[15] * c.r + m[16] * c.g + m[17] * c.b + m[18] * c.a + m[19] / 255.0\n );\n}"
|
|
5920
5934
|
} });
|
|
@@ -5962,7 +5976,7 @@ var ii, ai = class extends H {
|
|
|
5962
5976
|
break;
|
|
5963
5977
|
}
|
|
5964
5978
|
}), t.redraw(e, () => {
|
|
5965
|
-
|
|
5979
|
+
I.draw(e, ii.material, {
|
|
5966
5980
|
sampler: 0,
|
|
5967
5981
|
m: r.toArray()
|
|
5968
5982
|
});
|
|
@@ -5976,7 +5990,7 @@ var oi, si = 50, ci = class extends H {
|
|
|
5976
5990
|
static {
|
|
5977
5991
|
oi = this;
|
|
5978
5992
|
}
|
|
5979
|
-
static material = new
|
|
5993
|
+
static material = new F({ gl: {
|
|
5980
5994
|
vertex: "precision mediump float;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUv;\nvoid main() {\n gl_Position = vec4(position, 0.0, 1.0);\n vUv = uv;\n}",
|
|
5981
5995
|
fragment: `precision mediump float;
|
|
5982
5996
|
uniform sampler2D sampler;
|
|
@@ -6033,7 +6047,7 @@ void main(void) {
|
|
|
6033
6047
|
0,
|
|
6034
6048
|
0
|
|
6035
6049
|
]);
|
|
6036
|
-
|
|
6050
|
+
I.draw(e, oi.material, {
|
|
6037
6051
|
sampler: 0,
|
|
6038
6052
|
colors: t.slice(0, si).flatMap((e) => e)
|
|
6039
6053
|
});
|
|
@@ -6047,7 +6061,7 @@ var li, ui = class extends H {
|
|
|
6047
6061
|
static {
|
|
6048
6062
|
li = this;
|
|
6049
6063
|
}
|
|
6050
|
-
static material = new
|
|
6064
|
+
static material = new F({ gl: {
|
|
6051
6065
|
vertex: "precision mediump float;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUv;\nvoid main() {\n gl_Position = vec4(position, 0.0, 1.0);\n vUv = uv;\n}",
|
|
6052
6066
|
fragment: "varying vec2 vUv;\nuniform sampler2D sampler;\nuniform float epsilon;\nconst int MAX_COLORS = 50;\nuniform vec3 originalColors[MAX_COLORS];\n\nvoid main(void) {\n vec4 color = texture2D(sampler, vUv);\n\n for (int i = 0; i < MAX_COLORS; i++) {\n vec3 origColor = originalColors[i];\n if (origColor.r < 0.0) {\n break;\n }\n vec3 colorDiff = origColor - color.rgb;\n if (length(colorDiff) < epsilon) {\n gl_FragColor = vec4(0, 0, 0, 0);\n return;\n }\n }\n\n gl_FragColor = color;\n}"
|
|
6053
6067
|
} });
|
|
@@ -6065,7 +6079,7 @@ var li, ui = class extends H {
|
|
|
6065
6079
|
r.slice(0, 50).forEach((e, t) => {
|
|
6066
6080
|
n[t * 3] = e[0], n[t * 3 + 1] = e[1], n[t * 3 + 2] = e[2];
|
|
6067
6081
|
}), t.redraw(e, () => {
|
|
6068
|
-
|
|
6082
|
+
I.draw(e, li.material, {
|
|
6069
6083
|
sampler: 0,
|
|
6070
6084
|
epsilon: this.epsilon,
|
|
6071
6085
|
originalColors: n
|
|
@@ -6080,7 +6094,7 @@ var di, fi = 50, pi = class extends H {
|
|
|
6080
6094
|
static {
|
|
6081
6095
|
di = this;
|
|
6082
6096
|
}
|
|
6083
|
-
static material = new
|
|
6097
|
+
static material = new F({ gl: {
|
|
6084
6098
|
vertex: "precision mediump float;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUv;\nvoid main() {\n gl_Position = vec4(position, 0.0, 1.0);\n vUv = uv;\n}",
|
|
6085
6099
|
fragment: `varying vec2 vUv;
|
|
6086
6100
|
uniform sampler2D sampler;
|
|
@@ -6136,7 +6150,7 @@ void main(void) {
|
|
|
6136
6150
|
n.slice(0, fi).forEach(([e, t], n) => {
|
|
6137
6151
|
i[n * 3] = e[0], i[n * 3 + 1] = e[1], i[n * 3 + 2] = e[2], a[n * 3] = t[0], a[n * 3 + 1] = t[1], a[n * 3 + 2] = t[2];
|
|
6138
6152
|
}), t.redraw(e, () => {
|
|
6139
|
-
|
|
6153
|
+
I.draw(e, di.material, {
|
|
6140
6154
|
sampler: 0,
|
|
6141
6155
|
epsilon: r,
|
|
6142
6156
|
originalColors: i,
|
|
@@ -6148,12 +6162,14 @@ void main(void) {
|
|
|
6148
6162
|
k([_({ default: () => [] }), O("design:type", Array)], pi.prototype, "colors", void 0), k([_({ fallback: .05 }), O("design:type", Number)], pi.prototype, "epsilon", void 0), pi = di = k([x("ColorReplaceEffect"), O("design:paramtypes", [typeof Partial > "u" ? Object : Partial, Array])], pi);
|
|
6149
6163
|
//#endregion
|
|
6150
6164
|
//#region src/scene/effects/DrawboardEffect.frag?raw
|
|
6151
|
-
var mi = "precision highp float;\n\nin vec2 vUv;\nuniform sampler2D uTexture;\nuniform vec2 inputSize;\nuniform vec2 zoom;\nuniform vec2 translate;\nuniform float gridScale;\nuniform vec2 gridSize;\nuniform int checkerboard;\nuniform int checkerboardStyle;\nuniform
|
|
6165
|
+
var mi = "precision highp float;\n\nin vec2 vUv;\nuniform sampler2D uTexture;\nuniform vec2 inputSize;\nuniform vec2 zoom;\nuniform vec2 translate;\nuniform float gridScale;\nuniform vec2 gridSize;\nuniform int checkerboard;\nuniform int checkerboardStyle;\n// 背景底纹颜色(明暗由主题解析后传入,引擎不再区分 dark 变体):\n// checkerboardColor —— 底色(网格底格 / 点阵底)\n// checkerboardDotColor —— 点色(点阵的圆点)\nuniform vec3 checkerboardColor;\nuniform vec3 checkerboardDotColor;\nuniform float dotColorDiff;\nuniform int pixelGrid;\nuniform int watermark;\nuniform sampler2D watermarkTexture;\nuniform vec2 watermarkSize;\nuniform vec2 watermarkOffset;\nuniform vec2 watermarkSpacing;\nuniform float watermarkRotation;\nuniform float watermarkAlpha;\n\nconst float VIEWPORT_SPACE_MIN_DOT_RADIUS = 0.5;\nconst float CANVAS_SPACE_DOT_RADIUS = 1.;\nconst float CANVAS_SPACE_DOT_GRID_SIZE_PX = 16.;\n\n// 远距淡出:缩放低于 DOT_FADE_END 起点阵开始渐隐,到 DOT_FADE_START 完全隐藏\n// (避免缩得很远时点糊成一片,Figma/FigJam/Miro 同法:点的可见度随 zoom 衰减)。\nconst float DOT_FADE_START = 0.04;\nconst float DOT_FADE_END = 0.10;\n\nconst int CHECKERBOARD_STYLE_NONE = 0;\nconst int CHECKERBOARD_STYLE_GRID = 1;\nconst int CHECKERBOARD_STYLE_DOTS = 2;\n\nfloat _round(float val) {\n return floor(val + .5);\n}\n\nvec2 _round(vec2 pt) {\n return floor(pt + .5);\n}\n\nfloat scaledGridSize(float zoomScale) {\n if (zoomScale < 0.03125) {\n return 32.0 * CANVAS_SPACE_DOT_GRID_SIZE_PX;\n }\n else if (zoomScale < 0.0625) {\n return 16.0 * CANVAS_SPACE_DOT_GRID_SIZE_PX;\n }\n else if (zoomScale < 0.125) {\n return 8.0 * CANVAS_SPACE_DOT_GRID_SIZE_PX;\n }\n else if (zoomScale < 0.25) {\n return 4.0 * CANVAS_SPACE_DOT_GRID_SIZE_PX;\n }\n else if (zoomScale < 0.5) {\n return 2.0 * CANVAS_SPACE_DOT_GRID_SIZE_PX;\n }\n else {\n return CANVAS_SPACE_DOT_GRID_SIZE_PX;\n }\n}\n\nvec4 renderCheckerboard(vec2 coord, vec4 color) {\n vec3 bg;\n if (checkerboardStyle == CHECKERBOARD_STYLE_GRID) {\n // 棋盘:两格用底色与其轻微压暗,保持细腻网格感(明暗全由 checkerboardColor 决定)。\n vec2 fractValue = fract(coord * vec2(gridScale) * zoom) - 0.5;\n bg = fractValue.x * fractValue.y < 0.0 ? checkerboardColor : checkerboardColor * 0.96;\n }\n else if (checkerboardStyle == CHECKERBOARD_STYLE_DOTS) {\n // 点阵:底色 checkerboardColor + 圆点 checkerboardDotColor(放大时按 dotColorDiff 提亮)。\n float zoomScale = zoom.x;\n float gridPixelSize = scaledGridSize(zoomScale);\n float zoomInterpolationFactor = smoothstep(0.5, 1.0, zoomScale);\n vec3 dotColor = checkerboardDotColor + vec3(dotColorDiff * zoomInterpolationFactor);\n vec2 nearestGridPoint = _round(coord / gridPixelSize) * gridPixelSize;\n float canvasSpaceDist = length(coord - nearestGridPoint);\n float viewportSpaceDist = canvasSpaceDist * zoomScale;\n float viewportSpaceDotRadius = max(VIEWPORT_SPACE_MIN_DOT_RADIUS, CANVAS_SPACE_DOT_RADIUS * zoomScale);\n float dist = 1.0 - smoothstep(0., 1., (viewportSpaceDist - viewportSpaceDotRadius + .5));\n // 远距淡出:zoomScale 越低点越淡,低于 DOT_FADE_START 完全隐去(回落到纯底色)。\n dist *= smoothstep(DOT_FADE_START, DOT_FADE_END, zoomScale);\n bg = mix(checkerboardColor, dotColor, dist);\n }\n else {\n bg = checkerboardColor;\n }\n return vec4(bg * (1.0 - color.a) + color.rgb, 1);\n}\n\nvec4 renderPixelGrid(vec2 coord, vec4 color) {\n vec3 rgb = color.rgb;\n vec2 corner = fract(coord);\n float gridWeight = max(float(corner.x < gridSize.x), float(corner.y < gridSize.y));\n vec3 gridColor;\n vec3 weights = vec3(0.299, 0.587, 0.114);\n float c2 = dot(rgb * rgb, weights);\n float luminance = sqrt(c2);\n if (luminance > 0.5) {\n float target = (luminance - 0.05) / luminance;\n gridColor = rgb * target;\n }\n else {\n float target = luminance * 0.8 + 0.15;\n float c1 = dot(rgb, weights);\n float a = 1.0 - 2.0 * c1 + c2;\n float b = c2 - c1;\n gridColor = mix(rgb, vec3(1), (b + sqrt(b * b - a * (c2 - target * target))) / a);\n }\n return vec4(mix(rgb, gridColor, gridWeight), color.a);\n}\n\nvec4 renderWatermark(vec2 coord, vec4 color) {\n float hw = watermarkSize.x * 0.5;\n float hh = watermarkSize.y * 0.5;\n float c = cos(-watermarkRotation);\n float s = sin(-watermarkRotation);\n vec2 blockSize = watermarkSize + watermarkSpacing;\n vec2 tiles = max(floor(inputSize / blockSize), vec2(1.0));\n vec2 gridCoverage = tiles * blockSize;\n vec2 startPos = watermarkOffset;\n vec2 localPix = coord - startPos;\n vec2 blockIndex = floor(localPix / blockSize);\n vec2 wmCenter = startPos + blockIndex * blockSize + watermarkSize * 0.5 + watermarkSpacing / 2.0;\n vec2 local = coord - wmCenter;\n vec2 inv = vec2(\n local.x * c + local.y * s,\n -local.x * s + local.y * c\n );\n if (inv.x >= -hw && inv.x <= hw && inv.y >= -hh && inv.y <= hh) {\n vec2 wmUV = (inv + vec2(hw, hh)) / watermarkSize;\n vec4 wmColor = texture(watermarkTexture, wmUV);\n float alpha = wmColor.a * watermarkAlpha;\n return mix(color, wmColor, alpha);\n } else {\n return color;\n }\n}\n\nvoid main(void) {\n vec4 color = texture(uTexture, vUv);\n vec2 coord = vec2(vUv.x, 1.0 - vUv.y);\n coord = (coord * inputSize - translate) / zoom;\n if (checkerboard > 0) {\n color = renderCheckerboard(coord, color);\n }\n if (watermark > 0) {\n color = renderWatermark(coord, color);\n }\n if (pixelGrid > 0) {\n color = renderPixelGrid(coord, color);\n }\n gl_FragColor = color;\n}\n", hi, G = class extends H {
|
|
6152
6166
|
static {
|
|
6153
6167
|
hi = this;
|
|
6154
6168
|
}
|
|
6155
6169
|
_watermark;
|
|
6156
|
-
|
|
6170
|
+
_color = new T("#f2f3f5");
|
|
6171
|
+
_dotColor = new T("#c8ccd4");
|
|
6172
|
+
static material = new F({ gl: {
|
|
6157
6173
|
vertex: "attribute vec2 position;\nin vec2 uv;\nuniform mat3 projectionMatrix;\nuniform mat3 viewMatrix;\nout vec2 vUv;\nvoid main() {\n gl_Position = vec4(position.xy, 0.0, 1.0);\n vUv = uv;\n}",
|
|
6158
6174
|
fragment: mi
|
|
6159
6175
|
} });
|
|
@@ -6165,12 +6181,16 @@ var mi = "precision highp float;\n\nin vec2 vUv;\nuniform sampler2D uTexture;\nu
|
|
|
6165
6181
|
case "watermark":
|
|
6166
6182
|
this._loadWatermark(t);
|
|
6167
6183
|
break;
|
|
6184
|
+
case "checkerboardColor":
|
|
6185
|
+
this._color.value = t, this.requestRender();
|
|
6186
|
+
break;
|
|
6187
|
+
case "checkerboardDotColor":
|
|
6188
|
+
this._dotColor.value = t, this.requestRender();
|
|
6189
|
+
break;
|
|
6168
6190
|
case "checkerboard":
|
|
6169
6191
|
case "checkerboardStyle":
|
|
6170
6192
|
case "pixelGrid":
|
|
6171
|
-
case "
|
|
6172
|
-
case "dotColor":
|
|
6173
|
-
case "dotZoomDiff":
|
|
6193
|
+
case "dotColorDiff":
|
|
6174
6194
|
this.requestRender();
|
|
6175
6195
|
break;
|
|
6176
6196
|
}
|
|
@@ -6180,31 +6200,13 @@ var mi = "precision highp float;\n\nin vec2 vUv;\nuniform sampler2D uTexture;\nu
|
|
|
6180
6200
|
}
|
|
6181
6201
|
_checkerboardStyleMap = {
|
|
6182
6202
|
grid: 1,
|
|
6183
|
-
|
|
6184
|
-
dot: 3,
|
|
6185
|
-
dotDark: 4
|
|
6186
|
-
};
|
|
6187
|
-
_dotColors = {
|
|
6188
|
-
light: {
|
|
6189
|
-
base: .9608,
|
|
6190
|
-
zoomedOut: .6667,
|
|
6191
|
-
diff: .102
|
|
6192
|
-
},
|
|
6193
|
-
dark: {
|
|
6194
|
-
base: .1216,
|
|
6195
|
-
zoomedOut: .3137,
|
|
6196
|
-
diff: .102
|
|
6197
|
-
}
|
|
6203
|
+
dot: 2
|
|
6198
6204
|
};
|
|
6199
6205
|
apply(e, t) {
|
|
6200
6206
|
t.redraw(e, () => {
|
|
6201
6207
|
this._watermark ? this._watermark.activate(e, 1) : e.texture.unbind(1);
|
|
6202
|
-
let n = e.shader.uniforms.viewMatrix, r = this._watermark ? [this.watermarkWidth, this.watermarkWidth * this._watermark.height / this._watermark.width] : [0, 0], i = Math.max(r[0], r[1]), a
|
|
6203
|
-
|
|
6204
|
-
zoomedOut: this.dotColor ?? a.zoomedOut,
|
|
6205
|
-
diff: this.dotZoomDiff ?? a.diff
|
|
6206
|
-
};
|
|
6207
|
-
L.draw(e, hi.material, {
|
|
6208
|
+
let n = e.shader.uniforms.viewMatrix, r = this._watermark ? [this.watermarkWidth, this.watermarkWidth * this._watermark.height / this._watermark.width] : [0, 0], i = Math.max(r[0], r[1]), [a, o, s] = this._color.toArray(), [c, l, u] = this._dotColor.toArray();
|
|
6209
|
+
I.draw(e, hi.material, {
|
|
6208
6210
|
uTexture: 0,
|
|
6209
6211
|
inputSize: [t.width, t.height],
|
|
6210
6212
|
zoom: [n[0], n[4]],
|
|
@@ -6213,9 +6215,17 @@ var mi = "precision highp float;\n\nin vec2 vUv;\nuniform sampler2D uTexture;\nu
|
|
|
6213
6215
|
gridSize: [n[0] > 4 ? Math.ceil(.5 / n[0] * 1e4) / 1e4 : 0, n[4] > 4 ? Math.ceil(.5 / n[4] * 1e4) / 1e4 : 0],
|
|
6214
6216
|
checkerboard: +!!this.checkerboard,
|
|
6215
6217
|
checkerboardStyle: this._checkerboardStyleMap[this.checkerboardStyle] ?? 0,
|
|
6216
|
-
|
|
6217
|
-
|
|
6218
|
-
|
|
6218
|
+
checkerboardColor: [
|
|
6219
|
+
a,
|
|
6220
|
+
o,
|
|
6221
|
+
s
|
|
6222
|
+
],
|
|
6223
|
+
checkerboardDotColor: [
|
|
6224
|
+
c,
|
|
6225
|
+
l,
|
|
6226
|
+
u
|
|
6227
|
+
],
|
|
6228
|
+
dotColorDiff: this.dotColorDiff,
|
|
6219
6229
|
pixelGrid: +!!this.pixelGrid,
|
|
6220
6230
|
watermark: +!!this._watermark,
|
|
6221
6231
|
watermarkTexture: 1,
|
|
@@ -6228,18 +6238,18 @@ var mi = "precision highp float;\n\nin vec2 vUv;\nuniform sampler2D uTexture;\nu
|
|
|
6228
6238
|
});
|
|
6229
6239
|
}
|
|
6230
6240
|
};
|
|
6231
|
-
k([_({ fallback: !1 }), O("design:type", Boolean)], G.prototype, "checkerboard", void 0), k([_({ fallback: "grid" }), O("design:type", Object)], G.prototype, "checkerboardStyle", void 0), k([_({ fallback: !1 }), O("design:type", Boolean)], G.prototype, "pixelGrid", void 0), k([_(), O("design:type",
|
|
6241
|
+
k([_({ fallback: !1 }), O("design:type", Boolean)], G.prototype, "checkerboard", void 0), k([_({ fallback: "grid" }), O("design:type", Object)], G.prototype, "checkerboardStyle", void 0), k([_({ fallback: !1 }), O("design:type", Boolean)], G.prototype, "pixelGrid", void 0), k([_({ fallback: "#f2f3f5" }), O("design:type", String)], G.prototype, "checkerboardColor", void 0), k([_({ fallback: "#c8ccd4" }), O("design:type", String)], G.prototype, "checkerboardDotColor", void 0), k([_({ fallback: .06 }), O("design:type", Number)], G.prototype, "dotColorDiff", void 0), k([_(), O("design:type", String)], G.prototype, "watermark", void 0), k([_({ fallback: 100 }), O("design:type", Number)], G.prototype, "watermarkWidth", void 0), k([_({ fallback: .05 }), O("design:type", Number)], G.prototype, "watermarkAlpha", void 0), k([_({ fallback: .5236 }), O("design:type", Number)], G.prototype, "watermarkRotation", void 0), G = hi = k([x("DrawboardEffect"), O("design:paramtypes", [typeof Partial > "u" ? Object : Partial, Array])], G);
|
|
6232
6242
|
//#endregion
|
|
6233
6243
|
//#region src/scene/effects/GaussianBlurEffect.ts
|
|
6234
6244
|
var gi, _i = "varying vec2 vUv[9];\nuniform sampler2D sampler;\n\nvoid main(void) {\n gl_FragColor = vec4(0.0);\n float flag = 0.0;\n for (int i = 0; i < 9; i++) {\n vec2 uv = vUv[i];\n if (uv.x < 0.0 || uv.x > 1.0 || uv.y < 0.0 || uv.y > 1.0) {\n flag = 1.0;\n break;\n }\n }\n if (flag == 1.0) {\n gl_FragColor += texture2D(sampler, vUv[4]) * 0.028532;\n gl_FragColor += texture2D(sampler, vUv[4]) * 0.067234;\n gl_FragColor += texture2D(sampler, vUv[4]) * 0.124009;\n gl_FragColor += texture2D(sampler, vUv[4]) * 0.179044;\n gl_FragColor += texture2D(sampler, vUv[4]) * 0.20236;\n gl_FragColor += texture2D(sampler, vUv[4]) * 0.179044;\n gl_FragColor += texture2D(sampler, vUv[4]) * 0.124009;\n gl_FragColor += texture2D(sampler, vUv[4]) * 0.067234;\n gl_FragColor += texture2D(sampler, vUv[4]) * 0.028532;\n } else {\n gl_FragColor += texture2D(sampler, vUv[0]) * 0.028532;\n gl_FragColor += texture2D(sampler, vUv[1]) * 0.067234;\n gl_FragColor += texture2D(sampler, vUv[2]) * 0.124009;\n gl_FragColor += texture2D(sampler, vUv[3]) * 0.179044;\n gl_FragColor += texture2D(sampler, vUv[4]) * 0.20236;\n gl_FragColor += texture2D(sampler, vUv[5]) * 0.179044;\n gl_FragColor += texture2D(sampler, vUv[6]) * 0.124009;\n gl_FragColor += texture2D(sampler, vUv[7]) * 0.067234;\n gl_FragColor += texture2D(sampler, vUv[8]) * 0.028532;\n }\n}", vi = class extends H {
|
|
6235
6245
|
static {
|
|
6236
6246
|
gi = this;
|
|
6237
6247
|
}
|
|
6238
|
-
static materialX = new
|
|
6248
|
+
static materialX = new F({ gl: {
|
|
6239
6249
|
vertex: "attribute vec2 position;\nattribute vec2 uv;\nuniform float uStrength;\nvarying vec2 vUv[9];\n\nvoid main(void) {\n gl_Position = vec4(position, 0, 1);\n vUv[0] = uv + vec2(-4.0 * uStrength, 0.0);\n vUv[1] = uv + vec2(-3.0 * uStrength, 0.0);\n vUv[2] = uv + vec2(-2.0 * uStrength, 0.0);\n vUv[3] = uv + vec2(-1.0 * uStrength, 0.0);\n vUv[4] = uv + vec2(0.0 * uStrength, 0.0);\n vUv[5] = uv + vec2(1.0 * uStrength, 0.0);\n vUv[6] = uv + vec2(2.0 * uStrength, 0.0);\n vUv[7] = uv + vec2(3.0 * uStrength, 0.0);\n vUv[8] = uv + vec2(4.0 * uStrength, 0.0);\n}",
|
|
6240
6250
|
fragment: _i
|
|
6241
6251
|
} });
|
|
6242
|
-
static materialY = new
|
|
6252
|
+
static materialY = new F({ gl: {
|
|
6243
6253
|
vertex: "attribute vec2 position;\nattribute vec2 uv;\nuniform float uStrength;\nvarying vec2 vUv[9];\n\nvoid main(void) {\n gl_Position = vec4(position, 0, 1);\n vUv[0] = uv + vec2(0.0, -4.0 * uStrength);\n vUv[1] = uv + vec2(0.0, -3.0 * uStrength);\n vUv[2] = uv + vec2(0.0, -2.0 * uStrength);\n vUv[3] = uv + vec2(0.0, -1.0 * uStrength);\n vUv[4] = uv + vec2(0.0, 0.0 * uStrength);\n vUv[5] = uv + vec2(0.0, 1.0 * uStrength);\n vUv[6] = uv + vec2(0.0, 2.0 * uStrength);\n vUv[7] = uv + vec2(0.0, 3.0 * uStrength);\n vUv[8] = uv + vec2(0.0, 4.0 * uStrength);\n}",
|
|
6244
6254
|
fragment: _i
|
|
6245
6255
|
} });
|
|
@@ -6249,13 +6259,13 @@ var gi, _i = "varying vec2 vUv[9];\nuniform sampler2D sampler;\n\nvoid main(void
|
|
|
6249
6259
|
apply(e, t) {
|
|
6250
6260
|
let n = 1 / t.width, r = 1 / t.height, i = Math.max(this.quality, 1);
|
|
6251
6261
|
for (let r = 0; r < i; r++) t.redraw(e, () => {
|
|
6252
|
-
|
|
6262
|
+
I.draw(e, gi.materialX, {
|
|
6253
6263
|
sampler: 0,
|
|
6254
6264
|
uStrength: n * (this.strength / i)
|
|
6255
6265
|
});
|
|
6256
6266
|
});
|
|
6257
6267
|
for (let n = 0; n < i; n++) t.redraw(e, () => {
|
|
6258
|
-
|
|
6268
|
+
I.draw(e, gi.materialY, {
|
|
6259
6269
|
sampler: 0,
|
|
6260
6270
|
uStrength: r * (this.strength / i)
|
|
6261
6271
|
});
|
|
@@ -6269,7 +6279,7 @@ var yi, bi = class extends H {
|
|
|
6269
6279
|
static {
|
|
6270
6280
|
yi = this;
|
|
6271
6281
|
}
|
|
6272
|
-
static material = new
|
|
6282
|
+
static material = new F({ gl: {
|
|
6273
6283
|
vertex: "precision mediump float;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUv;\nvoid main() {\n gl_Position = vec4(position, 0.0, 1.0);\n vUv = uv;\n}",
|
|
6274
6284
|
fragment: "precision highp float;\nvarying vec2 vUv;\nuniform sampler2D sampler;\nuniform float uAlpha;\nuniform vec3 uColor;\nuniform vec2 uOffset;\nuniform vec4 uInputSize;\n\nvoid main(void) {\n vec4 sample = texture2D(sampler, vUv + uOffset * uInputSize.zw);\n sample.rgb = uColor.rgb * sample.a;\n sample *= uAlpha;\n gl_FragColor = sample;\n}"
|
|
6275
6285
|
} });
|
|
@@ -6281,7 +6291,7 @@ var yi, bi = class extends H {
|
|
|
6281
6291
|
}
|
|
6282
6292
|
apply(e, t) {
|
|
6283
6293
|
this.viewport3.activateWithCopy(e, t), this.viewport3.redraw(e, () => {
|
|
6284
|
-
this._color.value = this.color,
|
|
6294
|
+
this._color.value = this.color, I.draw(e, yi.material, {
|
|
6285
6295
|
sampler: 0,
|
|
6286
6296
|
uAlpha: this._color.a,
|
|
6287
6297
|
uColor: this._color.toArray().slice(0, 3),
|
|
@@ -6294,7 +6304,7 @@ var yi, bi = class extends H {
|
|
|
6294
6304
|
]
|
|
6295
6305
|
});
|
|
6296
6306
|
}), this.blurEffect.strength = this.blur, this.blurEffect.apply(e, this.viewport3), t.redraw(e, () => {
|
|
6297
|
-
this.viewport3.texture.activate(e, 1),
|
|
6307
|
+
this.viewport3.texture.activate(e, 1), I.draw(e, mr.instance, { sampler: 1 }), this.shadowOnly || I.draw(e, mr.instance, { sampler: 0 }), e.texture.unbind(1);
|
|
6298
6308
|
});
|
|
6299
6309
|
}
|
|
6300
6310
|
};
|
|
@@ -6305,7 +6315,7 @@ var xi, Si = class extends H {
|
|
|
6305
6315
|
static {
|
|
6306
6316
|
xi = this;
|
|
6307
6317
|
}
|
|
6308
|
-
static material = new
|
|
6318
|
+
static material = new F({ gl: {
|
|
6309
6319
|
vertex: "precision mediump float;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUv;\nvoid main() {\n gl_Position = vec4(position, 0.0, 1.0);\n vUv = uv;\n}",
|
|
6310
6320
|
fragment: "precision mediump float;\nuniform sampler2D sampler;\nuniform vec4 inputSize;\nuniform float strength;\nvarying vec2 vUv;\n\nvoid main(void) {\n vec2 onePixel = inputSize.zw;\n vec4 color;\n color.rgb = vec3(0.5);\n color -= texture2D(sampler, vUv - onePixel) * strength;\n color += texture2D(sampler, vUv + onePixel) * strength;\n color.rgb = vec3((color.r + color.g + color.b) / 3.0);\n float alpha = texture2D(sampler, vUv).a;\n gl_FragColor = vec4(color.rgb * alpha, alpha);\n}"
|
|
6311
6321
|
} });
|
|
@@ -6314,7 +6324,7 @@ var xi, Si = class extends H {
|
|
|
6314
6324
|
}
|
|
6315
6325
|
apply(e, t) {
|
|
6316
6326
|
t.redraw(e, () => {
|
|
6317
|
-
|
|
6327
|
+
I.draw(e, xi.material, {
|
|
6318
6328
|
sampler: 0,
|
|
6319
6329
|
strength: this.strength,
|
|
6320
6330
|
inputSize: [
|
|
@@ -6334,7 +6344,7 @@ var Ci, K = class extends H {
|
|
|
6334
6344
|
static {
|
|
6335
6345
|
Ci = this;
|
|
6336
6346
|
}
|
|
6337
|
-
static material = new
|
|
6347
|
+
static material = new F({ gl: {
|
|
6338
6348
|
vertex: "in vec2 position;\nin vec2 uv;\nout vec2 vUv;\nvoid main() {\n gl_Position = vec4(position, 0.0, 1.0);\n vUv = uv;\n}",
|
|
6339
6349
|
fragment: "\nin vec2 vUv;\nuniform sampler2D sampler;\n\nuniform vec4 filterArea;\nuniform vec4 filterClamp;\nuniform vec2 dimensions;\nuniform float aspect;\n\nuniform sampler2D displacementMap;\nuniform float offset;\nuniform float sinDir;\nuniform float cosDir;\nuniform int fillMode;\n\nuniform float seed;\nuniform vec2 red;\nuniform vec2 green;\nuniform vec2 blue;\n\nconst int TRANSPARENT = 0;\nconst int ORIGINAL = 1;\nconst int LOOP = 2;\nconst int CLAMP = 3;\nconst int MIRROR = 4;\n\nvoid main(void) {\n vec2 coord = (vUv * filterArea.xy) / dimensions;\n\n if (coord.x > 1.0 || coord.y > 1.0) {\n return;\n }\n\n float cx = coord.x - 0.5;\n float cy = (coord.y - 0.5) * aspect;\n float ny = (-sinDir * cx + cosDir * cy) / aspect + 0.5;\n\n // displacementMap: repeat\n // ny = ny > 1.0 ? ny - 1.0 : (ny < 0.0 ? 1.0 + ny : ny);\n\n // displacementMap: mirror\n ny = ny > 1.0 ? 2.0 - ny : (ny < 0.0 ? -ny : ny);\n\n vec4 dc = texture(displacementMap, vec2(0.5, ny));\n\n float displacement = (dc.r - dc.g) * (offset / filterArea.x);\n\n coord = vUv + vec2(cosDir * displacement, sinDir * displacement * aspect);\n\n if (fillMode == CLAMP) {\n coord = clamp(coord, filterClamp.xy, filterClamp.zw);\n } else {\n if (coord.x > filterClamp.z) {\n if (fillMode == TRANSPARENT) {\n discard;\n } else if (fillMode == LOOP) {\n coord.x -= filterClamp.z;\n } else if (fillMode == MIRROR) {\n coord.x = filterClamp.z * 2.0 - coord.x;\n }\n } else if (coord.x < filterClamp.x) {\n if (fillMode == TRANSPARENT) {\n discard;\n } else if (fillMode == LOOP) {\n coord.x += filterClamp.z;\n } else if (fillMode == MIRROR) {\n coord.x *= -filterClamp.z;\n }\n }\n\n if (coord.y > filterClamp.w) {\n if (fillMode == TRANSPARENT) {\n discard;\n } else if (fillMode == LOOP) {\n coord.y -= filterClamp.w;\n } else if (fillMode == MIRROR) {\n coord.y = filterClamp.w * 2.0 - coord.y;\n }\n } else if (coord.y < filterClamp.y) {\n if (fillMode == TRANSPARENT) {\n discard;\n } else if (fillMode == LOOP) {\n coord.y += filterClamp.w;\n } else if (fillMode == MIRROR) {\n coord.y *= -filterClamp.w;\n }\n }\n }\n\n gl_FragColor.r = texture(sampler, coord + red * (1.0 - seed * 0.4) / filterArea.xy).r;\n gl_FragColor.g = texture(sampler, coord + green * (1.0 - seed * 0.3) / filterArea.xy).g;\n gl_FragColor.b = texture(sampler, coord + blue * (1.0 - seed * 0.2) / filterArea.xy).b;\n gl_FragColor.a = texture(sampler, coord).a;\n}"
|
|
6340
6350
|
} });
|
|
@@ -6347,7 +6357,7 @@ var Ci, K = class extends H {
|
|
|
6347
6357
|
super(), this.setProperties(e).append(t);
|
|
6348
6358
|
let n = C(4, this.sampleSize);
|
|
6349
6359
|
if (!n) throw Error("GlitchEffect requires a canvas; call setCanvasFactory() in non-browser environments.");
|
|
6350
|
-
this._canvas = n, this._texture = new
|
|
6360
|
+
this._canvas = n, this._texture = new L(this._canvas), this._sizes = new Float32Array(this.slices), this._offsets = new Float32Array(this.slices);
|
|
6351
6361
|
}
|
|
6352
6362
|
redraw() {
|
|
6353
6363
|
let e = this.sampleSize, t = this._texture, n = this._canvas.getContext("2d");
|
|
@@ -6364,7 +6374,7 @@ var Ci, K = class extends H {
|
|
|
6364
6374
|
this._needsRedraw || (this._needsRedraw = !0, this.redraw());
|
|
6365
6375
|
let n = t.width, r = t.height, i = this.direction * (Math.PI / 180), a = Math.sin(i), o = Math.cos(i);
|
|
6366
6376
|
t.redraw(e, () => {
|
|
6367
|
-
this._texture.activate(e, 1),
|
|
6377
|
+
this._texture.activate(e, 1), I.draw(e, Ci.material, {
|
|
6368
6378
|
sampler: 0,
|
|
6369
6379
|
filterClamp: [
|
|
6370
6380
|
0,
|
|
@@ -6400,7 +6410,7 @@ var wi, Ti = "vec3 mod289(vec3 x) {\n return x - floor(x * (1.0 / 289.0)) * 289
|
|
|
6400
6410
|
static {
|
|
6401
6411
|
wi = this;
|
|
6402
6412
|
}
|
|
6403
|
-
static material = new
|
|
6413
|
+
static material = new F({ gl: {
|
|
6404
6414
|
vertex: "precision mediump float;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUv;\nvoid main() {\n gl_Position = vec4(position, 0.0, 1.0);\n vUv = uv;\n}",
|
|
6405
6415
|
fragment: `precision highp float;
|
|
6406
6416
|
varying vec2 vUv;
|
|
@@ -6452,7 +6462,7 @@ void main(void) {
|
|
|
6452
6462
|
apply(e, t) {
|
|
6453
6463
|
let n = this.angle * (Math.PI / 180), r = this.parallel ? [Math.cos(n), Math.sin(n)] : this.center;
|
|
6454
6464
|
t.redraw(e, () => {
|
|
6455
|
-
|
|
6465
|
+
I.draw(e, wi.material, {
|
|
6456
6466
|
sampler: 0,
|
|
6457
6467
|
uDimensions: [t.width, t.height],
|
|
6458
6468
|
uParallel: +!!this.parallel,
|
|
@@ -6480,7 +6490,7 @@ k([_({ fallback: 0 }), O("design:type", Number)], Ei.prototype, "time", void 0),
|
|
|
6480
6490
|
var Di = "varying vec2 vUv;\nuniform sampler2D sampler;\nuniform vec2 uOffset;\n\nvoid main(void) {\n vec4 color = vec4(0.0);\n color += texture2D(sampler, vec2(vUv.x - uOffset.x, vUv.y + uOffset.y));\n color += texture2D(sampler, vec2(vUv.x + uOffset.x, vUv.y + uOffset.y));\n color += texture2D(sampler, vec2(vUv.x + uOffset.x, vUv.y - uOffset.y));\n color += texture2D(sampler, vec2(vUv.x - uOffset.x, vUv.y - uOffset.y));\n color *= 0.25;\n gl_FragColor = color;\n}", Oi = "precision highp float;\nvarying vec2 vUv;\nuniform sampler2D sampler;\nuniform vec2 uOffset;\nuniform vec4 uInputClamp;\nvoid main(void) {\n vec4 color = vec4(0.0);\n color += texture2D(sampler, clamp(vec2(vUv.x - uOffset.x, vUv.y + uOffset.y), uInputClamp.xy, uInputClamp.zw));\n color += texture2D(sampler, clamp(vec2(vUv.x + uOffset.x, vUv.y + uOffset.y), uInputClamp.xy, uInputClamp.zw));\n color += texture2D(sampler, clamp(vec2(vUv.x + uOffset.x, vUv.y - uOffset.y), uInputClamp.xy, uInputClamp.zw));\n color += texture2D(sampler, clamp(vec2(vUv.x - uOffset.x, vUv.y - uOffset.y), uInputClamp.xy, uInputClamp.zw));\n color *= 0.25;\n gl_FragColor = color;\n}", ki = class extends H {
|
|
6481
6491
|
_kernels = [0];
|
|
6482
6492
|
constructor(e, t = []) {
|
|
6483
|
-
super(), this.material = new
|
|
6493
|
+
super(), this.material = new F({ gl: {
|
|
6484
6494
|
vertex: "precision mediump float;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUv;\nvoid main() {\n gl_Position = vec4(position, 0.0, 1.0);\n vUv = uv;\n}",
|
|
6485
6495
|
fragment: e?.clamp ? Oi : Di
|
|
6486
6496
|
} }), this.setProperties(e).append(t), this._generateKernels();
|
|
@@ -6506,7 +6516,7 @@ var Di = "varying vec2 vUv;\nuniform sampler2D sampler;\nuniform vec2 uOffset;\n
|
|
|
6506
6516
|
this._kernels.forEach((i) => {
|
|
6507
6517
|
let a = i + .5;
|
|
6508
6518
|
t.redraw(e, () => {
|
|
6509
|
-
|
|
6519
|
+
I.draw(e, this.material, {
|
|
6510
6520
|
sampler: 0,
|
|
6511
6521
|
uOffset: [a * n, a * r],
|
|
6512
6522
|
uInputClamp: [
|
|
@@ -6527,7 +6537,7 @@ var Ai, ji = class extends H {
|
|
|
6527
6537
|
static {
|
|
6528
6538
|
Ai = this;
|
|
6529
6539
|
}
|
|
6530
|
-
static material = new
|
|
6540
|
+
static material = new F({ gl: {
|
|
6531
6541
|
vertex: "attribute vec2 position;\nin vec2 uv;\nout vec2 vUv;\nvoid main() {\n gl_Position = vec4(position, 0.0, 1.0);\n vUv = uv;\n}",
|
|
6532
6542
|
fragment: "in vec2 vUv;\n\nuniform sampler2D sampler;\nuniform sampler2D mask;\nuniform float rotation;\n\nvec2 rotateUV(vec2 uv, float angle) {\n uv -= 0.5;\n float cosAngle = cos(angle);\n float sinAngle = sin(angle);\n mat2 rotationMatrix = mat2(\n cosAngle, -sinAngle,\n sinAngle, cosAngle\n );\n uv = rotationMatrix * uv;\n uv += 0.5;\n return uv;\n}\n\nvoid main(void) {\n vec4 color = texture(sampler, vUv);\n vec4 maskColor = texture(mask, rotateUV(vUv, rotation));\n gl_FragColor = mix(vec4(0.), color, maskColor.a);\n}"
|
|
6533
6543
|
} });
|
|
@@ -6547,7 +6557,7 @@ var Ai, ji = class extends H {
|
|
|
6547
6557
|
}
|
|
6548
6558
|
apply(e, t, n) {
|
|
6549
6559
|
this.texture && t.redraw(e, () => {
|
|
6550
|
-
this.texture.activate(e, 1),
|
|
6560
|
+
this.texture.activate(e, 1), I.draw(e, Ai.material, {
|
|
6551
6561
|
sampler: 0,
|
|
6552
6562
|
mask: 1,
|
|
6553
6563
|
rotation: n.target?.globalRotation ?? 0
|
|
@@ -6569,14 +6579,14 @@ var Mi, Ni = "precision highp float;\nvarying vec2 vUv;\nuniform sampler2D sampl
|
|
|
6569
6579
|
}
|
|
6570
6580
|
_color = new T();
|
|
6571
6581
|
constructor(e, t = []) {
|
|
6572
|
-
super(), this.setProperties(e).append(t), this.material = new
|
|
6582
|
+
super(), this.setProperties(e).append(t), this.material = new F({ gl: {
|
|
6573
6583
|
vertex: "precision mediump float;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUv;\nvoid main() {\n gl_Position = vec4(position, 0.0, 1.0);\n vUv = uv;\n}",
|
|
6574
6584
|
fragment: Ni.replace(/\{ANGLE_STEP\}/, Mi.getAngleStep(this.quality).toFixed(7))
|
|
6575
6585
|
} });
|
|
6576
6586
|
}
|
|
6577
6587
|
apply(e, t) {
|
|
6578
6588
|
t.redraw(e, () => {
|
|
6579
|
-
this._color.value = this.color,
|
|
6589
|
+
this._color.value = this.color, I.draw(e, this.material, {
|
|
6580
6590
|
sampler: 0,
|
|
6581
6591
|
uThickness: [this.width / t.width, this.width / t.height],
|
|
6582
6592
|
uColor: this._color.toArray().slice(0, 3),
|
|
@@ -6600,7 +6610,7 @@ var Fi, Ii = class extends H {
|
|
|
6600
6610
|
static {
|
|
6601
6611
|
Fi = this;
|
|
6602
6612
|
}
|
|
6603
|
-
static material = new
|
|
6613
|
+
static material = new F({ gl: {
|
|
6604
6614
|
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}",
|
|
6605
6615
|
fragment: "precision highp float;\nvarying vec2 vUv;\nuniform sampler2D sampler;\nuniform vec2 offset;\nuniform vec2 step;\n\nvoid main(void) {\n vec2 uv = vUv;\n uv = floor((uv - offset) / step) * step + offset + step / 2.0;\n gl_FragColor = texture2D(sampler, uv);\n}"
|
|
6606
6616
|
} });
|
|
@@ -6614,7 +6624,7 @@ var Fi, Ii = class extends H {
|
|
|
6614
6624
|
offset: [(r[0] + i[0]) / t.width, 1 - (r[1] + i[1]) / t.height],
|
|
6615
6625
|
step: [this.strength * r[0] / t.width, this.strength * r[1] / t.height]
|
|
6616
6626
|
};
|
|
6617
|
-
|
|
6627
|
+
I.draw(e, Fi.material, a);
|
|
6618
6628
|
});
|
|
6619
6629
|
}
|
|
6620
6630
|
};
|
|
@@ -6625,7 +6635,7 @@ var Li, Ri = class extends H {
|
|
|
6625
6635
|
static {
|
|
6626
6636
|
Li = this;
|
|
6627
6637
|
}
|
|
6628
|
-
static material = new
|
|
6638
|
+
static material = new F({ gl: {
|
|
6629
6639
|
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}",
|
|
6630
6640
|
fragment: "varying vec2 vUv;\nuniform sampler2D sampler;\nuniform vec4 uInputSize;\n\nuniform vec2 uCenter;\nuniform float uStrength;\nuniform float uInnerRadius;\nuniform float uRadius;\n\nconst float MAX_KERNEL_SIZE = 32.0;\n\nhighp float rand(vec2 co, float seed) {\n const highp float a = 12.9898, b = 78.233, c = 43758.5453;\n highp float dt = dot(co + seed, vec2(a, b)), sn = mod(dt, 3.14159);\n return fract(sin(sn) * c + seed);\n}\n\nvoid main() {\n float minGradient = uInnerRadius * 0.3;\n float innerRadius1 = (uInnerRadius + minGradient * 0.5) / uInputSize.x;\n\n float gradient = uRadius * 0.3;\n float radius1 = (uRadius - gradient * 0.5) / uInputSize.x;\n\n float countLimit = MAX_KERNEL_SIZE;\n\n vec2 dir = vec2(uCenter.xy / uInputSize.xy - vUv);\n float dist = length(vec2(dir.x, dir.y * uInputSize.y / uInputSize.x));\n\n float strength1 = uStrength;\n\n float delta = 0.0;\n float gap;\n if (dist < innerRadius1) {\n delta = innerRadius1 - dist;\n gap = minGradient;\n } else if (radius1 >= 0.0 && dist > radius1) { // radius1 < 0 means it's infinity\n delta = dist - radius1;\n gap = gradient;\n }\n\n if (delta > 0.0) {\n float normalCount = gap / uInputSize.x;\n delta = (normalCount - delta) / normalCount;\n countLimit *= delta;\n strength1 *= delta;\n if (countLimit < 1.0) {\n gl_FragColor = texture2D(sampler, vUv);\n return;\n }\n }\n\n float offset = rand(vUv, 0.0);\n\n float total = 0.0;\n vec4 color = vec4(0.0);\n\n dir *= strength1;\n\n for (float t = 0.0; t < MAX_KERNEL_SIZE; t++) {\n float percent = (t + offset) / MAX_KERNEL_SIZE;\n float weight = 4.0 * (percent - percent * percent);\n vec2 p = vUv + dir * percent;\n color += texture2D(sampler, p) * weight;\n total += weight;\n\n if (t > countLimit){\n break;\n }\n }\n\n color /= total;\n\n gl_FragColor = color;\n}"
|
|
6631
6641
|
} });
|
|
@@ -6634,7 +6644,7 @@ var Li, Ri = class extends H {
|
|
|
6634
6644
|
}
|
|
6635
6645
|
apply(e, t) {
|
|
6636
6646
|
t.redraw(e, () => {
|
|
6637
|
-
|
|
6647
|
+
I.draw(e, Li.material, {
|
|
6638
6648
|
sampler: 0,
|
|
6639
6649
|
uCenter: [t.width / 2, t.height / 2],
|
|
6640
6650
|
uInnerRadius: this.innerRadius,
|
|
@@ -6709,7 +6719,7 @@ var q = class extends w {
|
|
|
6709
6719
|
}
|
|
6710
6720
|
}
|
|
6711
6721
|
async loadTexture() {
|
|
6712
|
-
if (this.linearGradient || this.radialGradient) this.texture = new
|
|
6722
|
+
if (this.linearGradient || this.radialGradient) this.texture = new Cr(this.linearGradient ?? this.radialGradient, Math.floor(this._parent.size.width), Math.floor(this._parent.size.height));
|
|
6713
6723
|
else if (d(this.image)) this.animatedTexture = void 0, this.texture = void 0;
|
|
6714
6724
|
else if (this._parent.tree?.log(`load image ${this.image}`), this.image !== "viewport") {
|
|
6715
6725
|
let e = this.image.split("?")[0].endsWith(".gif"), t = this.image, n = await $.loadBy(t, async () => {
|
|
@@ -6728,7 +6738,7 @@ var q = class extends w {
|
|
|
6728
6738
|
let i = await n(t, r);
|
|
6729
6739
|
if (i) return this._pipelineImageToCanvas(i);
|
|
6730
6740
|
});
|
|
6731
|
-
r && (this.texture = new
|
|
6741
|
+
r && (this.texture = new L({
|
|
6732
6742
|
source: r,
|
|
6733
6743
|
width: r.width,
|
|
6734
6744
|
height: r.height,
|
|
@@ -6763,7 +6773,7 @@ var q = class extends w {
|
|
|
6763
6773
|
width: e,
|
|
6764
6774
|
height: t
|
|
6765
6775
|
} };
|
|
6766
|
-
if (this.image === "viewport") n.fillStyle = new
|
|
6776
|
+
if (this.image === "viewport") n.fillStyle = new Dr();
|
|
6767
6777
|
else {
|
|
6768
6778
|
let i = this.animatedTexture?.currentFrame.texture ?? this.texture;
|
|
6769
6779
|
r = {
|
|
@@ -6917,7 +6927,7 @@ var J = class extends w {
|
|
|
6917
6927
|
}), this._instance.setOption(this._toOption(), !0), !this._texture) {
|
|
6918
6928
|
let e = this._container.querySelector("canvas");
|
|
6919
6929
|
if (!e) return;
|
|
6920
|
-
this._texture = new
|
|
6930
|
+
this._texture = new vr({
|
|
6921
6931
|
source: e,
|
|
6922
6932
|
pixelRatio: 1
|
|
6923
6933
|
});
|
|
@@ -6930,7 +6940,7 @@ var J = class extends w {
|
|
|
6930
6940
|
let n = document.createElement("canvas");
|
|
6931
6941
|
n.width = Math.ceil(e), n.height = Math.ceil(t);
|
|
6932
6942
|
let r = n.getContext("2d");
|
|
6933
|
-
r && (r.fillStyle = "#f3f4f6", r.fillRect(0, 0, e, t), r.strokeStyle = "#d1d5db", r.setLineDash([6, 4]), r.strokeRect(1, 1, e - 2, t - 2), r.fillStyle = "#9ca3af", r.font = "14px sans-serif", r.textAlign = "center", r.textBaseline = "middle", r.fillText("图表需安装 echarts", e / 2, t / 2), this._texture ? this._texture.source = n : this._texture = new
|
|
6943
|
+
r && (r.fillStyle = "#f3f4f6", r.fillRect(0, 0, e, t), r.strokeStyle = "#d1d5db", r.setLineDash([6, 4]), r.strokeRect(1, 1, e - 2, t - 2), r.fillStyle = "#9ca3af", r.font = "14px sans-serif", r.textAlign = "center", r.textBaseline = "middle", r.fillText("图表需安装 echarts", e / 2, t / 2), this._texture ? this._texture.source = n : this._texture = new vr({
|
|
6934
6944
|
source: n,
|
|
6935
6945
|
pixelRatio: 1
|
|
6936
6946
|
}), this._texture.requestUpdate("source"), this._parent.requestDraw());
|
|
@@ -7206,7 +7216,7 @@ var Yi = {
|
|
|
7206
7216
|
}
|
|
7207
7217
|
draw() {
|
|
7208
7218
|
let { width: e, height: t } = this._parent.size, n = this._parent.context;
|
|
7209
|
-
this.image === "viewport" ? n.strokeStyle = new
|
|
7219
|
+
this.image === "viewport" ? n.strokeStyle = new Dr() : n.strokeStyle = this.texture ?? this.color ?? "#000000FF", n.lineWidth = (this.width || 1) * (this.widthBoost || 1), n.lineCap = this.lineCap, n.lineJoin = this.lineJoin, n.lineFlow = this.flow, n.stroke({ ...zi(this, {
|
|
7210
7220
|
x: 0,
|
|
7211
7221
|
y: 0,
|
|
7212
7222
|
width: e,
|
|
@@ -7451,7 +7461,7 @@ var ea = 100, ta = 40, na = class extends w {
|
|
|
7451
7461
|
}, r = `${JSON.stringify(e)}|${n.left},${n.top},${n.width},${n.height}`;
|
|
7452
7462
|
if (this._cellNodes.has(t) && this._cellSnapshots.get(t) === r) continue;
|
|
7453
7463
|
let i = this._cellNodes.get(t);
|
|
7454
|
-
i || (i =
|
|
7464
|
+
i || (i = z.parse({ is: "Element2D" }, "Element2D"), this._parent.appendChild(i, "back"), this._cellNodes.set(t, i)), this._applyCell(i, e, n), this._cellSnapshots.set(t, r);
|
|
7455
7465
|
}
|
|
7456
7466
|
for (let [e, t] of this._cellNodes) s.has(e) || (this._parent.removeChild(t), t.destroy(), this._cellNodes.delete(e), this._cellSnapshots.delete(e));
|
|
7457
7467
|
this._parent.requestDraw();
|
|
@@ -7463,7 +7473,7 @@ var ea = 100, ta = 40, na = class extends w {
|
|
|
7463
7473
|
}, e.background = t.background;
|
|
7464
7474
|
for (let t of [...e.getChildren(!0)]) e.removeChild(t), t.destroy();
|
|
7465
7475
|
t.children?.forEach((t) => {
|
|
7466
|
-
e.appendChild(
|
|
7476
|
+
e.appendChild(z.parse(t, "Element2D"));
|
|
7467
7477
|
});
|
|
7468
7478
|
}
|
|
7469
7479
|
_clearCells() {
|
|
@@ -7501,7 +7511,7 @@ var X = class extends w {
|
|
|
7501
7511
|
_autoDrawMode;
|
|
7502
7512
|
_atlasEligible = !1;
|
|
7503
7513
|
_textureStale = !0;
|
|
7504
|
-
_texture = new
|
|
7514
|
+
_texture = new vr({ mipmap: !0 });
|
|
7505
7515
|
_tiles = [];
|
|
7506
7516
|
_textureMap = /* @__PURE__ */ new Map();
|
|
7507
7517
|
constructor(e) {
|
|
@@ -7549,6 +7559,9 @@ var X = class extends w {
|
|
|
7549
7559
|
}
|
|
7550
7560
|
this._rasterTexture(), this._parent.requestDraw();
|
|
7551
7561
|
}
|
|
7562
|
+
_resolveThemeColor(e) {
|
|
7563
|
+
return this._parent.tree?.resolveThemeColor(e) ?? e;
|
|
7564
|
+
}
|
|
7552
7565
|
_rasterTexture() {
|
|
7553
7566
|
let e = Math.ceil(this.base.boundingBox.width), t = Math.ceil(this.base.boundingBox.height), n = ra, r = Math.floor((oa() - ia) / n);
|
|
7554
7567
|
if (e <= r && t <= r) {
|
|
@@ -7568,7 +7581,7 @@ var X = class extends w {
|
|
|
7568
7581
|
for (let o = 0; o < a; o++) for (let a = 0; a < i; a++) {
|
|
7569
7582
|
let i = a * r, c = o * r, l = Math.min(r, e - i), u = Math.min(r, t - c), d = this._tiles[s];
|
|
7570
7583
|
d || (d = {
|
|
7571
|
-
texture: new
|
|
7584
|
+
texture: new vr({ mipmap: !0 }),
|
|
7572
7585
|
x: i,
|
|
7573
7586
|
y: c,
|
|
7574
7587
|
w: l,
|
|
@@ -7616,7 +7629,7 @@ var X = class extends w {
|
|
|
7616
7629
|
}), this._parent.requestDraw());
|
|
7617
7630
|
}
|
|
7618
7631
|
async _loadTexture(e, t) {
|
|
7619
|
-
return e.linearGradient || e.radialGradient ? new
|
|
7632
|
+
return e.linearGradient || e.radialGradient ? new Cr(e.linearGradient ?? e.radialGradient, t.width, t.height) : d(e.image) ? void 0 : (this._parent.tree?.log(`load image ${e.image}`), await $.texture.load(e.image));
|
|
7620
7633
|
}
|
|
7621
7634
|
setContent(e) {
|
|
7622
7635
|
this.content = oe(e);
|
|
@@ -7644,7 +7657,7 @@ var X = class extends w {
|
|
|
7644
7657
|
let i = r.parent.index, a = r.parent.parent.index;
|
|
7645
7658
|
if (n.style.fill && !d(n.style.fill)) if (typeof n.style.fill == "object") {
|
|
7646
7659
|
let r = n.style.fill, o = this._textureMap.get(`${a}.${i}.fill`) ?? this._textureMap.get(`${a}.fill`) ?? this._textureMap.get("fill");
|
|
7647
|
-
r.enabled !== !1 && (o || r.color) && (e.addPath(n), e.style = { ...n.style }, e.fillStyle = o?.texture ?? r.color, e.fill({
|
|
7660
|
+
r.enabled !== !1 && (o || r.color) && (e.addPath(n), e.style = { ...n.style }, e.fillStyle = o?.texture ?? this._resolveThemeColor(r.color), e.fill({
|
|
7648
7661
|
...zi(r, o?.box ?? {
|
|
7649
7662
|
x: 0,
|
|
7650
7663
|
y: 0,
|
|
@@ -7656,7 +7669,7 @@ var X = class extends w {
|
|
|
7656
7669
|
} else e.addPath(n), e.style = { ...n.style }, e.fill({ transformVertex: t });
|
|
7657
7670
|
if (n.style.stroke && !d(n.style.stroke)) if (typeof n.style.stroke == "object") {
|
|
7658
7671
|
let r = n.style.stroke, o = this._textureMap.get(`${a}.${i}.outline`) ?? this._textureMap.get(`${a}.outline`) ?? this._textureMap.get("outline");
|
|
7659
|
-
r.enabled !== !1 && (o || r.color) && (r.width === void 0 || r.width) && (e.addPath(n), e.style = { ...n.style }, e.lineWidth = r.width || 1, e.strokeStyle = o?.texture ?? r.color, e.lineCap = r.lineCap, e.lineJoin = r.lineJoin, e.stroke({
|
|
7672
|
+
r.enabled !== !1 && (o || r.color) && (r.width === void 0 || r.width) && (e.addPath(n), e.style = { ...n.style }, e.lineWidth = r.width || 1, e.strokeStyle = o?.texture ?? this._resolveThemeColor(r.color), e.lineCap = r.lineCap, e.lineJoin = r.lineJoin, e.stroke({
|
|
7660
7673
|
...zi(r, o?.box ?? {
|
|
7661
7674
|
x: 0,
|
|
7662
7675
|
y: 0,
|
|
@@ -7693,7 +7706,7 @@ var X = class extends w {
|
|
|
7693
7706
|
"listStyle",
|
|
7694
7707
|
"highlight"
|
|
7695
7708
|
]) if (this.base.plugins.get(e)?.pathSet?.paths?.length) return !1;
|
|
7696
|
-
let e = 2048 /
|
|
7709
|
+
let e = 2048 / Sr.superSample / 1.5, t = this.base.characters;
|
|
7697
7710
|
for (let n = 0; n < t.length; n++) {
|
|
7698
7711
|
let r = t[n].computedStyle;
|
|
7699
7712
|
if (typeof r.color != "string" || r.fontSize > e) return !1;
|
|
@@ -7701,13 +7714,13 @@ var X = class extends w {
|
|
|
7701
7714
|
return !0;
|
|
7702
7715
|
}
|
|
7703
7716
|
_atlasDraw(e) {
|
|
7704
|
-
let t =
|
|
7717
|
+
let t = Sr, n = this.base.characters, r = /* @__PURE__ */ new Map();
|
|
7705
7718
|
for (let e = 0; e < n.length; e++) {
|
|
7706
7719
|
let i = n[e], a = i.glyphBox;
|
|
7707
7720
|
if (!a || a.width <= 0 || a.height <= 0) continue;
|
|
7708
|
-
let o = i.computedStyle
|
|
7709
|
-
if (typeof
|
|
7710
|
-
let c = +(o.fontStyle === "italic"), l = `${i.content}|${o.fontFamily}|${o.fontSize}|${o.fontWeight ?? 400}|${c}|${s}`, u = a.left, d = a.top, f = t.acquire(l, a.width, a.height, (e) => {
|
|
7721
|
+
let o = i.computedStyle;
|
|
7722
|
+
if (typeof o.color != "string") return !1;
|
|
7723
|
+
let s = this._resolveThemeColor(o.color), c = +(o.fontStyle === "italic"), l = `${i.content}|${o.fontFamily}|${o.fontSize}|${o.fontWeight ?? 400}|${c}|${s}`, u = a.left, d = a.top, f = t.acquire(l, a.width, a.height, (e) => {
|
|
7711
7724
|
e.translate(-u, -d), i.path.drawTo(e, {
|
|
7712
7725
|
fill: s,
|
|
7713
7726
|
fillRule: "nonzero",
|
|
@@ -8213,7 +8226,7 @@ var Da = class extends Gr {
|
|
|
8213
8226
|
this._updateStyleMaskImage(t);
|
|
8214
8227
|
break;
|
|
8215
8228
|
case "backgroundColor":
|
|
8216
|
-
this.background.color = t;
|
|
8229
|
+
this.background.color = this._resolveThemeColor(t);
|
|
8217
8230
|
break;
|
|
8218
8231
|
case "backgroundImage":
|
|
8219
8232
|
this.background.image = t;
|
|
@@ -8228,7 +8241,7 @@ var Da = class extends Gr {
|
|
|
8228
8241
|
break;
|
|
8229
8242
|
case "borderColor":
|
|
8230
8243
|
case "outlineColor":
|
|
8231
|
-
this.outline.color = t;
|
|
8244
|
+
this.outline.color = this._resolveThemeColor(t);
|
|
8232
8245
|
break;
|
|
8233
8246
|
case "overflow":
|
|
8234
8247
|
this._overflowHidden = t === "hidden" || t === "clip" || t === "scroll" || t === "auto", this._scrollbarMode = t === "scroll" ? "scroll" : t === "auto" ? "auto" : void 0, this._updateMask();
|
|
@@ -8256,6 +8269,15 @@ var Da = class extends Gr {
|
|
|
8256
8269
|
break;
|
|
8257
8270
|
}
|
|
8258
8271
|
}
|
|
8272
|
+
_resolveThemeColor(e) {
|
|
8273
|
+
return this.tree?.resolveThemeColor(e) ?? e;
|
|
8274
|
+
}
|
|
8275
|
+
applyThemeColors() {
|
|
8276
|
+
let e = this._style.json, t = e.backgroundColor;
|
|
8277
|
+
typeof t == "string" && t[0] === "@" && (this.background.color = this._resolveThemeColor(t));
|
|
8278
|
+
let n = e.borderColor ?? e.outlineColor;
|
|
8279
|
+
typeof n == "string" && n[0] === "@" && (this.outline.color = this._resolveThemeColor(n)), this._text.isValid() && this._text.update(), this.requestDraw();
|
|
8280
|
+
}
|
|
8259
8281
|
requestLayout() {
|
|
8260
8282
|
super.requestLayout(), this.flexbox.update();
|
|
8261
8283
|
}
|
|
@@ -8394,15 +8416,15 @@ var Da = class extends Gr {
|
|
|
8394
8416
|
let e = a.position?.x ?? 0, o = a.position?.y ?? 0, s = a.size?.width ?? 0, c = a.size?.height ?? 0;
|
|
8395
8417
|
e < t && (t = e), o < n && (n = o), e + s > r && (r = e + s), o + c > i && (i = o + c);
|
|
8396
8418
|
}
|
|
8397
|
-
let a = this.size.width, o = this.size.height;
|
|
8419
|
+
let a = this.size.width, o = this.size.height, s = (e) => Math.abs(e) < 1 ? 0 : e, c = s(Math.min(0, t)), l = s(Math.max(0, r - a)), u = s(Math.min(0, n)), d = s(Math.max(0, i - o));
|
|
8398
8420
|
return {
|
|
8399
8421
|
x: {
|
|
8400
|
-
min:
|
|
8401
|
-
max:
|
|
8422
|
+
min: c,
|
|
8423
|
+
max: l
|
|
8402
8424
|
},
|
|
8403
8425
|
y: {
|
|
8404
|
-
min:
|
|
8405
|
-
max:
|
|
8426
|
+
min: u,
|
|
8427
|
+
max: d
|
|
8406
8428
|
},
|
|
8407
8429
|
content: {
|
|
8408
8430
|
w: r - Math.min(0, t),
|
|
@@ -8485,7 +8507,7 @@ var Da = class extends Gr {
|
|
|
8485
8507
|
2,
|
|
8486
8508
|
3
|
|
8487
8509
|
]),
|
|
8488
|
-
texture:
|
|
8510
|
+
texture: yr.get("#000000"),
|
|
8489
8511
|
modulate: [
|
|
8490
8512
|
255,
|
|
8491
8513
|
255,
|
|
@@ -8618,7 +8640,7 @@ var Oa = class extends Da {
|
|
|
8618
8640
|
}
|
|
8619
8641
|
}
|
|
8620
8642
|
}, ka = class extends Oa {
|
|
8621
|
-
texture = new
|
|
8643
|
+
texture = new vr();
|
|
8622
8644
|
animation;
|
|
8623
8645
|
_lastTime = NaN;
|
|
8624
8646
|
constructor(e, t = []) {
|
|
@@ -8695,10 +8717,10 @@ var Aa = class extends Da {
|
|
|
8695
8717
|
}
|
|
8696
8718
|
}
|
|
8697
8719
|
_drawCircle(e, t) {
|
|
8698
|
-
this.context.arc(e, t, this.handleSize, 0, Math.PI * 2, !0), this.context.fillStyle =
|
|
8720
|
+
this.context.arc(e, t, this.handleSize, 0, Math.PI * 2, !0), this.context.fillStyle = L.WHITE, this.context.fill(), this.context.arc(e, t, this.handleSize, 0, Math.PI * 2, !0), this.context.strokeStyle = "rgba(0, 0, 0, 0.2)", this.context.stroke();
|
|
8699
8721
|
}
|
|
8700
8722
|
_drawEllipse(e, t) {
|
|
8701
|
-
this.context.roundRect(e - this.handleSize, t - this.handleSize * 2, this.handleSize * 2, this.handleSize * 4, this.handleSize), this.context.fillStyle =
|
|
8723
|
+
this.context.roundRect(e - this.handleSize, t - this.handleSize * 2, this.handleSize * 2, this.handleSize * 4, this.handleSize), this.context.fillStyle = L.WHITE, this.context.fill(), this.context.roundRect(e - this.handleSize, t - this.handleSize * 2, this.handleSize * 2, this.handleSize * 4, this.handleSize), this.context.strokeStyle = "rgba(0, 0, 0, 0.2)", this.context.stroke();
|
|
8702
8724
|
}
|
|
8703
8725
|
_draw() {
|
|
8704
8726
|
let { width: e, height: t } = this.getRect();
|
|
@@ -8865,7 +8887,7 @@ var La = {
|
|
|
8865
8887
|
.355,
|
|
8866
8888
|
1
|
|
8867
8889
|
]
|
|
8868
|
-
}, Ra = Object.fromEntries(Object.entries(La).map(([e, [t, n, r, i]]) => [e, Ia(t, n, r, i)])), za = class extends
|
|
8890
|
+
}, Ra = Object.fromEntries(Object.entries(La).map(([e, [t, n, r, i]]) => [e, Ia(t, n, r, i)])), za = class extends B {
|
|
8869
8891
|
_keyframes = [];
|
|
8870
8892
|
_isFirstUpdatePosition = !1;
|
|
8871
8893
|
_cachedProps = new t();
|
|
@@ -9561,7 +9583,7 @@ var qa = class e extends Ua {
|
|
|
9561
9583
|
createSound() {
|
|
9562
9584
|
return new Ja();
|
|
9563
9585
|
}
|
|
9564
|
-
}, Xa, Za = class extends
|
|
9586
|
+
}, Xa, Za = class extends B {
|
|
9565
9587
|
static {
|
|
9566
9588
|
Xa = this;
|
|
9567
9589
|
}
|
|
@@ -9699,7 +9721,7 @@ var Qa = class extends Gr {}, $a = class extends Da {
|
|
|
9699
9721
|
_audioBuffer;
|
|
9700
9722
|
_src = (() => {
|
|
9701
9723
|
let e = C();
|
|
9702
|
-
return e ? new
|
|
9724
|
+
return e ? new L({ source: e }) : void 0;
|
|
9703
9725
|
})();
|
|
9704
9726
|
_needsUpdateTexture = !1;
|
|
9705
9727
|
constructor(e = {}) {
|
|
@@ -9763,7 +9785,7 @@ var eo, to = class extends Ur {
|
|
|
9763
9785
|
}
|
|
9764
9786
|
blur = 10;
|
|
9765
9787
|
quality = 10;
|
|
9766
|
-
static material = new
|
|
9788
|
+
static material = new F({ gl: {
|
|
9767
9789
|
vertex: "attribute vec2 position;\nattribute vec2 uv;\nout vec2 vUv;\nvoid main() {\n gl_Position = vec4(position, 0.0, 1.0);\n vUv = uv;\n}",
|
|
9768
9790
|
fragment: "precision highp float;\nin vec2 vUv;\nuniform sampler2D sampler;\nuniform vec2 offset;\nuniform float progress;\n\nvoid main(void) {\n vec2 offset1 = vec2(offset.x - progress * offset.x, offset.y - progress * offset.y);\n vec4 color = vec4(0.0);\n color += texture(sampler, vec2(vUv.x - offset1.x, vUv.y + offset1.y));\n color += texture(sampler, vec2(vUv.x + offset1.x, vUv.y + offset1.y));\n color += texture(sampler, vec2(vUv.x + offset1.x, vUv.y - offset1.y));\n color += texture(sampler, vec2(vUv.x - offset1.x, vUv.y - offset1.y));\n color *= 0.25;\n gl_FragColor = color;\n}"
|
|
9769
9791
|
} });
|
|
@@ -9778,7 +9800,7 @@ var eo, to = class extends Ur {
|
|
|
9778
9800
|
let d = 1 / s, f = 1 / c, p = [], m, h = o - 1;
|
|
9779
9801
|
for (let e = 0; e < h; e++) m = u[e] + .5, p[0] = m * d, p[1] = m * f, l.push({ offset: p });
|
|
9780
9802
|
m = u[h] + .5, p[0] = m * d, p[1] = m * f, l.push({ offset: p }), l.forEach((t) => {
|
|
9781
|
-
|
|
9803
|
+
I.draw(e, eo.material, {
|
|
9782
9804
|
sampler: r,
|
|
9783
9805
|
progress: i,
|
|
9784
9806
|
...t
|
|
@@ -9793,12 +9815,12 @@ var no, ro = class extends Ur {
|
|
|
9793
9815
|
static {
|
|
9794
9816
|
no = this;
|
|
9795
9817
|
}
|
|
9796
|
-
static material = new
|
|
9818
|
+
static material = new F({ gl: {
|
|
9797
9819
|
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}",
|
|
9798
9820
|
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}"
|
|
9799
9821
|
} });
|
|
9800
9822
|
apply(e) {
|
|
9801
|
-
|
|
9823
|
+
I.draw(e, no.material, {
|
|
9802
9824
|
previous: 0,
|
|
9803
9825
|
next: 1,
|
|
9804
9826
|
progress: this.currentTimeProgress
|
|
@@ -9814,7 +9836,7 @@ var io, ao = class extends Ur {
|
|
|
9814
9836
|
}
|
|
9815
9837
|
blur = 100;
|
|
9816
9838
|
gradientBlur = 600;
|
|
9817
|
-
static material = new
|
|
9839
|
+
static material = new F({ gl: {
|
|
9818
9840
|
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}",
|
|
9819
9841
|
fragment: "precision highp float;\nvarying vec2 vUv;\nuniform sampler2D sampler;\nuniform float blur;\nuniform float gradientBlur;\nuniform vec2 start;\nuniform vec2 end;\nuniform vec2 delta;\nuniform vec2 texSize;\nuniform float progress;\n\nfloat random(vec3 scale, float seed) {\n return fract(sin(dot(gl_FragCoord.xyz + seed, scale)) * 43758.5453 + seed);\n}\n\nvoid main(void) {\n float blur1 = blur - progress * blur;\n float gradientBlur1 = progress * gradientBlur;\n\n vec4 color = vec4(0.0);\n float total = 0.0;\n float offset = random(vec3(12.9898, 78.233, 151.7182), 0.0);\n vec2 normal = normalize(vec2(start.y - end.y, end.x - start.x));\n float radius = smoothstep(0.0, 1.0, abs(dot(vUv * texSize - start, normal)) / gradientBlur1) * blur1;\n\n for (float t = -30.0; t <= 30.0; t++) {\n float percent = (t + offset - 0.5) / 30.0;\n float weight = 1.0 - abs(percent);\n vec4 sample1 = texture2D(sampler, vUv + delta / texSize * percent * radius);\n sample1.rgb *= sample1.a;\n color += sample1 * weight;\n total += weight;\n }\n\n color /= total;\n color.rgb /= color.a + 0.00001;\n\n gl_FragColor = color;\n}"
|
|
9820
9842
|
} });
|
|
@@ -9822,7 +9844,7 @@ var io, ao = class extends Ur {
|
|
|
9822
9844
|
let n = this.currentTimeProgress, r, i;
|
|
9823
9845
|
n < .5 ? (r = 0, i = (.5 - n) / .5) : (r = 1, i = (n - .5) / .5);
|
|
9824
9846
|
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);
|
|
9825
|
-
|
|
9847
|
+
I.draw(e, io.material, {
|
|
9826
9848
|
sampler: r,
|
|
9827
9849
|
progress: i,
|
|
9828
9850
|
blur: this.blur,
|
|
@@ -9831,7 +9853,7 @@ var io, ao = class extends Ur {
|
|
|
9831
9853
|
end: c,
|
|
9832
9854
|
delta: [u / f, d / f],
|
|
9833
9855
|
texSize: l
|
|
9834
|
-
}),
|
|
9856
|
+
}), I.draw(e, io.material, {
|
|
9835
9857
|
sampler: r,
|
|
9836
9858
|
progress: i,
|
|
9837
9859
|
blur: this.blur,
|
|
@@ -9854,7 +9876,7 @@ var oo, so = class extends Ur {
|
|
|
9854
9876
|
angle = 4;
|
|
9855
9877
|
padding = 20;
|
|
9856
9878
|
offset;
|
|
9857
|
-
static material = new
|
|
9879
|
+
static material = new F({ gl: {
|
|
9858
9880
|
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}",
|
|
9859
9881
|
fragment: "precision highp float;\nvarying vec2 vUv;\nuniform sampler2D sampler;\nuniform float radius;\nuniform float angle;\nuniform vec2 offset;\nuniform vec4 filterArea;\nuniform float progress;\n\nvec2 mapCoord(vec2 coord) {\n coord -= filterArea.zw;\n coord *= filterArea.xy;\n return coord;\n}\n\nvec2 unmapCoord(vec2 coord) {\n coord -= filterArea.zw;\n coord /= filterArea.xy;\n return coord;\n}\n\nvec2 twist(vec2 coord, float radius) {\n coord -= offset;\n float dist = length(coord);\n if (dist < radius) {\n float ratioDist = (radius - dist) / radius;\n float angleMod = ratioDist * ratioDist * angle;\n float s = sin(angleMod);\n float c = cos(angleMod);\n coord = vec2(coord.x * c - coord.y * s, coord.x * s + coord.y * c);\n }\n coord += offset;\n return coord;\n}\n\nvoid main(void) {\n vec2 coord = mapCoord(vUv);\n coord = twist(coord, radius - (progress * radius));\n coord = unmapCoord(coord);\n gl_FragColor = texture2D(sampler, coord);\n}"
|
|
9860
9882
|
} });
|
|
@@ -9862,7 +9884,7 @@ var oo, so = class extends Ur {
|
|
|
9862
9884
|
let n = this.currentTimeProgress, r, i;
|
|
9863
9885
|
n < .5 ? (r = 0, i = (.5 - n) / .5) : (r = 1, i = (n - .5) / .5);
|
|
9864
9886
|
let a = t.width, o = t.height;
|
|
9865
|
-
|
|
9887
|
+
I.draw(e, oo.material, {
|
|
9866
9888
|
sampler: r,
|
|
9867
9889
|
progress: i,
|
|
9868
9890
|
filterArea: [
|
|
@@ -9885,9 +9907,9 @@ var co = class extends nr {
|
|
|
9885
9907
|
install(e) {
|
|
9886
9908
|
let t = async (t) => {
|
|
9887
9909
|
let { decodeFrames: n } = await import("modern-gif");
|
|
9888
|
-
return await t.arrayBuffer().then((t) => n(t, e.gifWorkerUrl ? { workerUrl: e.gifWorkerUrl } : void 0)).then((e) => new
|
|
9910
|
+
return await t.arrayBuffer().then((t) => n(t, e.gifWorkerUrl ? { workerUrl: e.gifWorkerUrl } : void 0)).then((e) => new _r(e.map((e) => ({
|
|
9889
9911
|
duration: e.delay,
|
|
9890
|
-
texture: new
|
|
9912
|
+
texture: new wr({
|
|
9891
9913
|
source: e.data,
|
|
9892
9914
|
width: e.width,
|
|
9893
9915
|
height: e.height
|
|
@@ -9923,7 +9945,7 @@ var co = class extends nr {
|
|
|
9923
9945
|
}
|
|
9924
9946
|
}, po = class extends nr {
|
|
9925
9947
|
install(e) {
|
|
9926
|
-
let t = (t) => e.fetchImageBitmap(t, { premultiplyAlpha: "premultiply" }).then((e) => new
|
|
9948
|
+
let t = (t) => e.fetchImageBitmap(t, { premultiplyAlpha: "premultiply" }).then((e) => new L({
|
|
9927
9949
|
source: e,
|
|
9928
9950
|
uploadMethodId: "image",
|
|
9929
9951
|
mipmap: !0,
|
|
@@ -9947,7 +9969,7 @@ var co = class extends nr {
|
|
|
9947
9969
|
}
|
|
9948
9970
|
}, mo = class extends nr {
|
|
9949
9971
|
install(e) {
|
|
9950
|
-
return this.load = (t) => e.awaitBy(() => new
|
|
9972
|
+
return this.load = (t) => e.awaitBy(() => new Er(t).load()), e.video = this, this;
|
|
9951
9973
|
}
|
|
9952
9974
|
}, ho = Object.entries({
|
|
9953
9975
|
"font/woff": ["woff"],
|
|
@@ -10308,4 +10330,4 @@ async function ko(e) {
|
|
|
10308
10330
|
});
|
|
10309
10331
|
}
|
|
10310
10332
|
//#endregion
|
|
10311
|
-
export { wt as Aabb2D,
|
|
10333
|
+
export { wt as Aabb2D, _r as AnimatedTexture, za as Animation, yo as Assets, Za as Audio, Ua as AudioPipeline, Wa as AudioProcessor, Qa as AudioSpectrum, $a as AudioWaveform, A as BufferUsage, Kr as Camera2D, Or as CanvasContext, Rr as CanvasItem, vr as CanvasTexture, T as Color, W as ColorAdjustEffect, ai as ColorFilterEffect, Dt as ColorMatrix, ci as ColorOverlayEffect, ui as ColorRemoveEffect, pi as ColorReplaceEffect, yr as ColorTexture, w as CoreObject, Tt as DEG_TO_RAD, Xe as DEVICE_PIXEL_RATIO, G as DrawboardEffect, bi as DropShadowEffect, H as Effect, fr as EffectMaterial, Da as Element2D, Bi as Element2DBackground, J as Element2DChart, Wi as Element2DComments, Ki as Element2DConnection, q as Element2DFill, Ji as Element2DForeground, Y as Element2DOutline, Xi as Element2DShadow, Zi as Element2DShape, Qi as Element2DStyle, na as Element2DTable, X as Element2DText, Si as EmbossEffect, xo as Engine, Nt as FLAG_CLIP_OUTSIDE_UV, Pt as FLAG_STROKE_AA, _a as Flexbox, rr as FontLoader, pr as FxaaMaterial, vi as GaussianBlurEffect, ar as Geometry, co as GifLoader, Cn as GlBatch2DSystem, _n as GlBlendMode, zt as GlBuffer, Kt as GlBufferSystem, Rt as GlBufferTarget, Dn as GlMaskSystem, an as GlProgram, jn as GlRenderTarget, Mn as GlRenderTargetSystem, mn as GlShaderSystem, yn as GlState, bn as GlStateSystem, kn as GlStencilSystem, j as GlSystem, An as GlViewportSystem, K as GlitchEffect, xr as GlyphAtlas, Ei as GodrayEffect, Cr as GradientTexture, Ha as HTMLAudio, Ba as HTMLAudioContext, Va as HTMLSound, Je as IN_BROWSER, Ye as IN_MAC_OS, ir as IndexBuffer, xt as Input, ht as InputEvent, lo as JsonLoader, ki as KawaseBlurEffect, to as KawaseTransition, gt as KeyboardInputEvent, ro as LeftEraseTransition, nr as Loader, ka as Lottie2D, uo as LottieLoader, At as MainLoop, ji as MaskEffect, F as Material, Aa as Mesh2D, Ar as Meta, _t as MouseInputEvent, z as Node, Gr as Node2D, Ot as Obb2D, Pi as OutlineEffect, Se as PI, Ce as PI_2, Ii as PixelateEffect, wr as PixelsTexture, vt as PointerInputEvent, kt as Projection2D, sr as QuadGeometry, I as QuadUvGeometry, Et as RAD_TO_DEG, St as RefCounted, gr as RenderTarget, Bt as Renderer, Ct as Resource, Ue as SUPPORTS_AUDIO_CONTEXT, Ve as SUPPORTS_CLICK_EVENTS, He as SUPPORTS_CREATE_IMAGE_BITMAP, Fe as SUPPORTS_IMAGE_BITMAP, ze as SUPPORTS_MOUSE_EVENTS, Ge as SUPPORTS_OFFLINE_AUDIO_CONTEXT, Le as SUPPORTS_POINTER_EVENTS, Ie as SUPPORTS_RESIZE_OBSERVER, Be as SUPPORTS_TOUCH_EVENTS, Pe as SUPPORTS_WEBGL2, We as SUPPORTS_WEBKIT_AUDIO_CONTEXT, Ke as SUPPORTS_WEBKIT_OFFLINE_AUDIO_CONTEXT, qe as SUPPORTS_WEB_AUDIO, Re as SUPPORTS_WHEEL_EVENTS, U as SceneTree, fo as TextLoader, L as Texture2D, po as TextureLoader, Oa as TextureRect2D, S as Ticker, ao as TiltShiftTransition, Vr as Timeline, B as TimelineNode, ja as TransformRect2D, Ur as Transition, so as TwistTransition, Ht as UniformGroup, hr as UvGeometry, mr as UvMaterial, P as VertexAttribute, or as VertexBuffer, Ma as Video2D, mo as VideoLoader, Er as VideoTexture, V as Viewport, Dr as ViewportTexture, Ya as WebAudio, qa as WebAudioContext, tr as WebGLRenderer, Ja as WebSound, yt as WheelInputEvent, Hr as Window, Ri as ZoomBlurEffect, ca as alignMap, $ as assets, qr as axisDir, ga as boxSizingMap, ft as bumpGeometryRevision, E as clamp, Oi as clampFrag, C as createHTMLCanvas, Gt as createIdFromString, be as createNode, lt as crossOrigin, La as cssEasingPresets, Ia as cubicBezier, x as customNode, ye as customNodes, bo as defaultOptions, ct as determineCrossOrigin, ua as directionMap, la as displayMap, Z as edgeMap, Ft as encodeFlowSpeed, da as flexDirectionMap, fa as flexWrapMap, Lt as flowStreakEffect, Di as frag, dt as geometryRevision, it as getCanvasFactory, ke as getDefaultCssPropertyValue, st as getGlContextProvider, To as getRenderEngine, sa as gutterMap, mt as instanceId, et as isCanvasElement, Ze as isElementNode, $e as isImageElement, we as isPow2, Qe as isVideoElement, tt as isWebgl2, pa as justifyMap, D as lerp, Tn as log2, vn as mapGlBlendModes, Mt as markRaw, wn as nextPow2, xe as nextTick, ma as overflowMap, ti as parseCssFilter, je as parseCssFunctions, Ae as parseCssProperty, ni as parseCssTransformOrigin, Te as planExportTiles, ha as positionTypeMap, Oo as render, ko as renderPixels, Ir as resetBatchPool, Jr as routeConnection, rt as setCanvasFactory, ot as setGlContextProvider, Sr as sharedGlyphAtlas, On as stencilModeMap, It as strokeFeatherEffect };
|