pixi-effects 0.48.0 → 0.48.2
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/CHANGELOG.md +14 -0
- package/README.md +5 -5
- package/ai/chat-template.html +3 -3
- package/dist/Composition-5FKV2IBP.js +7 -0
- package/dist/{Composition-ZCRJHBB5.js.map → Composition-5FKV2IBP.js.map} +1 -1
- package/dist/Composition-TJ5D7Z63.cjs +16 -0
- package/dist/{Composition-PMWLJQPI.cjs.map → Composition-TJ5D7Z63.cjs.map} +1 -1
- package/dist/{Spans-KTUPDFSR.cjs → Spans-5ENZ3XGS.cjs} +9 -9
- package/dist/{Spans-KTUPDFSR.cjs.map → Spans-5ENZ3XGS.cjs.map} +1 -1
- package/dist/{Spans-FMAVPATS.js → Spans-6A3VLHRH.js} +4 -4
- package/dist/{Spans-FMAVPATS.js.map → Spans-6A3VLHRH.js.map} +1 -1
- package/dist/{chunk-NGK4E536.cjs → chunk-45ALIMAF.cjs} +85 -60
- package/dist/chunk-45ALIMAF.cjs.map +1 -0
- package/dist/{chunk-UI7CEUTP.js → chunk-6D4W2KZQ.js} +3 -3
- package/dist/{chunk-UI7CEUTP.js.map → chunk-6D4W2KZQ.js.map} +1 -1
- package/dist/{chunk-OGLRSR6C.cjs → chunk-CCPJD76D.cjs} +63 -63
- package/dist/{chunk-OGLRSR6C.cjs.map → chunk-CCPJD76D.cjs.map} +1 -1
- package/dist/{chunk-4PYVHLIK.js → chunk-IVKI6CPH.js} +23 -22
- package/dist/chunk-IVKI6CPH.js.map +1 -0
- package/dist/{chunk-GX2WQV4A.js → chunk-RCKLUCB7.js} +45 -20
- package/dist/chunk-RCKLUCB7.js.map +1 -0
- package/dist/{chunk-ECLBZV4N.cjs → chunk-Z3DM4ETD.cjs} +68 -86
- package/dist/chunk-Z3DM4ETD.cjs.map +1 -0
- package/dist/index.cjs +33 -33
- package/dist/index.js +3 -3
- package/dist/loader.css +1 -1
- package/dist/present.cjs +3 -3
- package/dist/present.js +3 -3
- package/dist/three.cjs +5 -5
- package/dist/three.js +1 -1
- package/llms-full.txt +2 -2
- package/package.json +1 -1
- package/skills/pixi-effects/SKILL.md +1 -1
- package/skills/pixi-effects/reference/pitfalls.md +1 -1
- package/skills/pixi-effects/template.html +6 -6
- package/dist/Composition-PMWLJQPI.cjs +0 -16
- package/dist/Composition-ZCRJHBB5.js +0 -7
- package/dist/chunk-4PYVHLIK.js.map +0 -1
- package/dist/chunk-ECLBZV4N.cjs.map +0 -1
- package/dist/chunk-GX2WQV4A.js.map +0 -1
- package/dist/chunk-NGK4E536.cjs.map +0 -1
|
@@ -2,27 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var chunkNGJXVJB7_cjs = require('./chunk-NGJXVJB7.cjs');
|
|
4
4
|
var chunkDOLTCXCL_cjs = require('./chunk-DOLTCXCL.cjs');
|
|
5
|
-
var
|
|
6
|
-
|
|
7
|
-
function _interopNamespace(e) {
|
|
8
|
-
if (e && e.__esModule) return e;
|
|
9
|
-
var n = Object.create(null);
|
|
10
|
-
if (e) {
|
|
11
|
-
Object.keys(e).forEach(function (k) {
|
|
12
|
-
if (k !== 'default') {
|
|
13
|
-
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
14
|
-
Object.defineProperty(n, k, d.get ? d : {
|
|
15
|
-
enumerable: true,
|
|
16
|
-
get: function () { return e[k]; }
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
n.default = e;
|
|
22
|
-
return Object.freeze(n);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
var PIXI__namespace = /*#__PURE__*/_interopNamespace(PIXI);
|
|
5
|
+
var pixi_js = require('pixi.js');
|
|
26
6
|
|
|
27
7
|
// src/core/spring.ts
|
|
28
8
|
var SETTLE_TOL = 5e-3;
|
|
@@ -948,7 +928,7 @@ function colorNumber(v) {
|
|
|
948
928
|
}
|
|
949
929
|
function viaPixi(s) {
|
|
950
930
|
try {
|
|
951
|
-
const [r, g, b, a] = new
|
|
931
|
+
const [r, g, b, a] = new pixi_js.Color(s).toArray();
|
|
952
932
|
return [Math.round(r * 255), Math.round(g * 255), Math.round(b * 255), a];
|
|
953
933
|
} catch {
|
|
954
934
|
return null;
|
|
@@ -1690,10 +1670,10 @@ fn mainFragment(@location(0) uv : vec2<f32>) -> @location(0) vec4<f32> {
|
|
|
1690
1670
|
`;
|
|
1691
1671
|
function toRgb01(input) {
|
|
1692
1672
|
if (Array.isArray(input)) return [input[0], input[1], input[2]];
|
|
1693
|
-
const c = new
|
|
1673
|
+
const c = new pixi_js.Color(input);
|
|
1694
1674
|
return [c.red, c.green, c.blue];
|
|
1695
1675
|
}
|
|
1696
|
-
var ChromaKeyFilter = class extends
|
|
1676
|
+
var ChromaKeyFilter = class extends pixi_js.Filter {
|
|
1697
1677
|
constructor(options = {}) {
|
|
1698
1678
|
const {
|
|
1699
1679
|
keyColor = "#00ff00",
|
|
@@ -1701,12 +1681,12 @@ var ChromaKeyFilter = class extends PIXI.Filter {
|
|
|
1701
1681
|
smoothing = 0.1,
|
|
1702
1682
|
spill = 0.2
|
|
1703
1683
|
} = options;
|
|
1704
|
-
const glProgram =
|
|
1705
|
-
vertex:
|
|
1684
|
+
const glProgram = pixi_js.GlProgram.from({
|
|
1685
|
+
vertex: pixi_js.defaultFilterVert,
|
|
1706
1686
|
fragment: GL_FRAGMENT,
|
|
1707
1687
|
name: "chroma-key-filter"
|
|
1708
1688
|
});
|
|
1709
|
-
const gpuProgram =
|
|
1689
|
+
const gpuProgram = pixi_js.GpuProgram.from({
|
|
1710
1690
|
vertex: { source: WGSL_SOURCE, entryPoint: "mainVertex" },
|
|
1711
1691
|
fragment: { source: WGSL_SOURCE, entryPoint: "mainFragment" }
|
|
1712
1692
|
});
|
|
@@ -1714,7 +1694,7 @@ var ChromaKeyFilter = class extends PIXI.Filter {
|
|
|
1714
1694
|
glProgram,
|
|
1715
1695
|
gpuProgram,
|
|
1716
1696
|
resources: {
|
|
1717
|
-
chromaUniforms: new
|
|
1697
|
+
chromaUniforms: new pixi_js.UniformGroup({
|
|
1718
1698
|
uKeyColor: { value: toRgb01(keyColor), type: "vec3<f32>" },
|
|
1719
1699
|
uThreshold: { value: threshold, type: "f32" },
|
|
1720
1700
|
uSmoothing: { value: smoothing, type: "f32" },
|
|
@@ -1898,17 +1878,17 @@ fn mainFragment(@location(0) uv : vec2<f32>) -> @location(0) vec4<f32> {
|
|
|
1898
1878
|
return vec4<f32>(rgb * raw.a, raw.a);
|
|
1899
1879
|
}`;
|
|
1900
1880
|
var GRAIN_KEYS = ["amount", "size", "seed", "fps", "color", "loop"];
|
|
1901
|
-
var GrainFilter = class extends
|
|
1881
|
+
var GrainFilter = class extends pixi_js.Filter {
|
|
1902
1882
|
_fps;
|
|
1903
1883
|
_loop = 0;
|
|
1904
1884
|
constructor(options = {}) {
|
|
1905
1885
|
chunkDOLTCXCL_cjs.warnUnknownOptions("grain filter", options, GRAIN_KEYS);
|
|
1906
1886
|
const { amount = 0.08, size = 1.5, seed = 0, fps = 24, color = 0, loop } = options;
|
|
1907
1887
|
super({
|
|
1908
|
-
glProgram:
|
|
1909
|
-
gpuProgram:
|
|
1888
|
+
glProgram: pixi_js.GlProgram.from({ vertex: GL_VERTEX, fragment: GL_FRAGMENT2, name: "grain-filter" }),
|
|
1889
|
+
gpuProgram: pixi_js.GpuProgram.from({ vertex: { source: WGSL_SOURCE2, entryPoint: "mainVertex" }, fragment: { source: WGSL_SOURCE2, entryPoint: "mainFragment" } }),
|
|
1910
1890
|
resources: {
|
|
1911
|
-
grainUniforms: new
|
|
1891
|
+
grainUniforms: new pixi_js.UniformGroup({
|
|
1912
1892
|
uAmount: { value: amount, type: "f32" },
|
|
1913
1893
|
uSize: { value: Math.max(size, 0.25), type: "f32" },
|
|
1914
1894
|
uSeed: { value: Math.floor(seed), type: "f32" },
|
|
@@ -2121,7 +2101,7 @@ fn mainFragment(@location(0) uv : vec2<f32>) -> @location(0) vec4<f32> {
|
|
|
2121
2101
|
let suv = clamp(uv + off * gfu.uInputSize.zw, gfu.uInputClamp.xy, gfu.uInputClamp.zw);
|
|
2122
2102
|
return textureSampleLevel(uTexture, uSampler, suv, 0.0);
|
|
2123
2103
|
}`;
|
|
2124
|
-
var WarpFilter = class extends
|
|
2104
|
+
var WarpFilter = class extends pixi_js.Filter {
|
|
2125
2105
|
constructor(options = {}) {
|
|
2126
2106
|
chunkDOLTCXCL_cjs.warnUnknownOptions("warp filter", options, OPTION_KEYS);
|
|
2127
2107
|
let { kind = "wave", strength = 6, scale = 80, speed = 0.5, angle = 0, seed = 0 } = options;
|
|
@@ -2143,10 +2123,10 @@ var WarpFilter = class extends PIXI.Filter {
|
|
|
2143
2123
|
scale = 1;
|
|
2144
2124
|
}
|
|
2145
2125
|
super({
|
|
2146
|
-
glProgram:
|
|
2147
|
-
gpuProgram:
|
|
2126
|
+
glProgram: pixi_js.GlProgram.from({ vertex: GL_VERTEX2, fragment: GL_FRAGMENT3, name: "warp-filter" }),
|
|
2127
|
+
gpuProgram: pixi_js.GpuProgram.from({ vertex: { source: WGSL_SOURCE3, entryPoint: "mainVertex" }, fragment: { source: WGSL_SOURCE3, entryPoint: "mainFragment" } }),
|
|
2148
2128
|
resources: {
|
|
2149
|
-
warpUniforms: new
|
|
2129
|
+
warpUniforms: new pixi_js.UniformGroup({
|
|
2150
2130
|
uStrength: { value: strength, type: "f32" },
|
|
2151
2131
|
uScale: { value: scale, type: "f32" },
|
|
2152
2132
|
uSpeed: { value: speed, type: "f32" },
|
|
@@ -2206,7 +2186,7 @@ var WarpFilter = class extends PIXI.Filter {
|
|
|
2206
2186
|
};
|
|
2207
2187
|
|
|
2208
2188
|
// src/filters/named.ts
|
|
2209
|
-
var CORE = { blur:
|
|
2189
|
+
var CORE = { blur: () => pixi_js.BlurFilter, noise: () => pixi_js.NoiseFilter, alpha: () => pixi_js.AlphaFilter };
|
|
2210
2190
|
var CORE_TYPES = ["blur", "noise", "alpha", "colorMatrix", "grain", "warp"];
|
|
2211
2191
|
var LIBRARY_TYPES = [
|
|
2212
2192
|
"adjustment",
|
|
@@ -2267,11 +2247,11 @@ function registerFilterLibrary(mod) {
|
|
|
2267
2247
|
if (key.endsWith("Filter") && typeof value === "function") library.set(lower(key.slice(0, -"Filter".length)), value);
|
|
2268
2248
|
}
|
|
2269
2249
|
}
|
|
2270
|
-
var MISSING = (
|
|
2271
|
-
`pixi-effects: the filter
|
|
2250
|
+
var MISSING = (what, why, many = false) => new Error(
|
|
2251
|
+
`pixi-effects: the ${many ? "filters" : "filter"} ${what} ${many ? "come" : "comes"} from the pixi-filters package${why ? ` (${why})` : ""}. Add it to your import map ("pixi-filters": "https://esm.sh/pixi-filters@6.1.5?external=pixi.js") or run \`npm i pixi-filters\`.`
|
|
2272
2252
|
);
|
|
2273
|
-
function
|
|
2274
|
-
|
|
2253
|
+
function libraryFilters(spec) {
|
|
2254
|
+
const found = /* @__PURE__ */ new Map();
|
|
2275
2255
|
const visit = (node) => {
|
|
2276
2256
|
if (!node || typeof node !== "object") return;
|
|
2277
2257
|
if (Array.isArray(node)) {
|
|
@@ -2282,27 +2262,30 @@ function needsFilterLibrary(spec) {
|
|
|
2282
2262
|
if (Array.isArray(o.filters)) {
|
|
2283
2263
|
for (const f of o.filters) {
|
|
2284
2264
|
if (typeof f?.type !== "string" || !isNamedFilterType(f.type)) continue;
|
|
2285
|
-
if (isLibraryType(f.type))
|
|
2286
|
-
|
|
2265
|
+
if (isLibraryType(f.type)) {
|
|
2266
|
+
if (!found.get(f.type)) found.set(f.type, typeof o.name === "string" && o.name ? o.name : void 0);
|
|
2267
|
+
} else if (!isCoreType(f.type)) throw unknownType(f.type);
|
|
2287
2268
|
}
|
|
2288
2269
|
}
|
|
2289
2270
|
for (const key of ["sequences", "mask", "layer"]) visit(o[key]);
|
|
2290
2271
|
};
|
|
2291
2272
|
visit(spec);
|
|
2292
|
-
return
|
|
2273
|
+
return found;
|
|
2293
2274
|
}
|
|
2294
2275
|
async function ensureFilterLibrary(spec, load = () => import('pixi-filters')) {
|
|
2295
|
-
|
|
2276
|
+
const used = libraryFilters(spec);
|
|
2277
|
+
if (!used.size || library) return;
|
|
2296
2278
|
try {
|
|
2297
2279
|
registerFilterLibrary(await load());
|
|
2298
2280
|
} catch (e) {
|
|
2299
|
-
|
|
2281
|
+
const what = [...used].map(([type, layer]) => `"${type}"${layer ? ` (layer "${layer}")` : ""}`).join(", ");
|
|
2282
|
+
throw MISSING(what, e.message, used.size > 1);
|
|
2300
2283
|
}
|
|
2301
2284
|
}
|
|
2302
2285
|
var SINGLE_VALUE = { pixelate: "size", emboss: "strength" };
|
|
2303
2286
|
var MATRIX_PRESETS = ["sepia", "grayscale", "negative", "polaroid", "technicolor", "vintage", "kodachrome", "browni"];
|
|
2304
2287
|
function colorMatrix(params) {
|
|
2305
|
-
const f = new
|
|
2288
|
+
const f = new pixi_js.ColorMatrixFilter();
|
|
2306
2289
|
const preset = params.preset;
|
|
2307
2290
|
if (preset !== void 0) {
|
|
2308
2291
|
if (!MATRIX_PRESETS.includes(preset)) {
|
|
@@ -2332,9 +2315,8 @@ function lintBulgeCenter(params) {
|
|
|
2332
2315
|
function fixRadialBlurGpu(f) {
|
|
2333
2316
|
const holder = f;
|
|
2334
2317
|
const gp = holder.gpuProgram;
|
|
2335
|
-
|
|
2336
|
-
|
|
2337
|
-
holder.gpuProgram = GpuProgram5.from({ name: gp.name, vertex: gp.vertex, fragment: { ...gp.fragment, source: gp.fragment.source.replace(/uKernelSize(\s*):\s*f32/, "uKernelSize$1: i32") } });
|
|
2318
|
+
if (!gp || !/uKernelSize\s*:\s*f32/.test(gp.fragment.source)) return f;
|
|
2319
|
+
holder.gpuProgram = pixi_js.GpuProgram.from({ name: gp.name, vertex: gp.vertex, fragment: { ...gp.fragment, source: gp.fragment.source.replace(/uKernelSize(\s*):\s*f32/, "uKernelSize$1: i32") } });
|
|
2338
2320
|
return f;
|
|
2339
2321
|
}
|
|
2340
2322
|
function createNamedFilter(type, params) {
|
|
@@ -2343,10 +2325,10 @@ function createNamedFilter(type, params) {
|
|
|
2343
2325
|
if (lower(type) === "grain") return new GrainFilter(params);
|
|
2344
2326
|
if (lower(type) === "warp") return new WarpFilter(params);
|
|
2345
2327
|
const core = Object.entries(CORE).find(([k]) => lower(k) === lower(type));
|
|
2346
|
-
if (core) return new
|
|
2328
|
+
if (core) return new (core[1]())(params);
|
|
2347
2329
|
if (!isLibraryType(type)) throw unknownType(type);
|
|
2348
2330
|
const Ctor = library?.get(lower(type));
|
|
2349
|
-
if (!Ctor) throw MISSING(type
|
|
2331
|
+
if (!Ctor) throw MISSING(`"${type}"`, library ? "not found in the loaded package" : "not loaded yet");
|
|
2350
2332
|
const single = SINGLE_VALUE[Object.keys(SINGLE_VALUE).find((k) => lower(k) === lower(type)) ?? ""];
|
|
2351
2333
|
if (single) return new Ctor(params[single]);
|
|
2352
2334
|
const made = new Ctor(lower(type) === "colorgradient" ? colorGradientParams(params) : params);
|
|
@@ -2438,7 +2420,7 @@ var Sequence = class {
|
|
|
2438
2420
|
}
|
|
2439
2421
|
const fa = this.spec.filterArea;
|
|
2440
2422
|
if (fa && this.target) {
|
|
2441
|
-
this.target.filterArea = new
|
|
2423
|
+
this.target.filterArea = new pixi_js.Rectangle(fa.x, fa.y, fa.width, fa.height);
|
|
2442
2424
|
}
|
|
2443
2425
|
}
|
|
2444
2426
|
scope() {
|
|
@@ -2503,7 +2485,7 @@ var Sequence = class {
|
|
|
2503
2485
|
};
|
|
2504
2486
|
var NullSequence = class extends Sequence {
|
|
2505
2487
|
async build() {
|
|
2506
|
-
this.target = new
|
|
2488
|
+
this.target = new pixi_js.Container();
|
|
2507
2489
|
this.buildFilters();
|
|
2508
2490
|
}
|
|
2509
2491
|
};
|
|
@@ -2785,7 +2767,7 @@ var GradientPainter = class {
|
|
|
2785
2767
|
this.size = size;
|
|
2786
2768
|
this.canvas.width = size;
|
|
2787
2769
|
this.canvas.height = size;
|
|
2788
|
-
this.tex =
|
|
2770
|
+
this.tex = pixi_js.Texture.from(this.canvas);
|
|
2789
2771
|
globalThis.__gradientPainters = (globalThis.__gradientPainters ?? 0) + 1;
|
|
2790
2772
|
}
|
|
2791
2773
|
size;
|
|
@@ -2794,7 +2776,7 @@ var GradientPainter = class {
|
|
|
2794
2776
|
/** Paint `g` and return what `Graphics.fill(...)` takes. */
|
|
2795
2777
|
paint(g) {
|
|
2796
2778
|
const ctx = this.canvas.getContext("2d"), s = this.size;
|
|
2797
|
-
if (!ctx) return new
|
|
2779
|
+
if (!ctx) return new pixi_js.FillGradient(gradientOptions({ angle: g.angle, stops: g.stops.map((x) => [x.offset, x.color]) }));
|
|
2798
2780
|
ctx.clearRect(0, 0, s, s);
|
|
2799
2781
|
if (g.type === "radial") {
|
|
2800
2782
|
paintRadial(ctx, s, { stops: g.stops.map((x) => [x.offset, x.color]), center: g.center, innerRadius: g.innerRadius, radius: g.radius });
|
|
@@ -2954,7 +2936,7 @@ var TextSequence = class extends Sequence {
|
|
|
2954
2936
|
_fillGradient = null;
|
|
2955
2937
|
_applyGradient() {
|
|
2956
2938
|
const g = this._grad.grad;
|
|
2957
|
-
const next = new
|
|
2939
|
+
const next = new pixi_js.FillGradient(gradientOptions({ angle: g.angle, stops: g.stops.map((s) => [s.offset, s.color]) }));
|
|
2958
2940
|
this.target.style.fill = next;
|
|
2959
2941
|
this._fillGradient?.destroy();
|
|
2960
2942
|
this._fillGradient = next;
|
|
@@ -2985,7 +2967,7 @@ var TextSequence = class extends Sequence {
|
|
|
2985
2967
|
const baseStyle = { ...TEXT_STYLE_DEFAULTS };
|
|
2986
2968
|
const initialProps = this.spec.initial ?? {};
|
|
2987
2969
|
this._template = String(initialProps.text ?? this.spec.text ?? "");
|
|
2988
|
-
const text = new
|
|
2970
|
+
const text = new pixi_js.Text({
|
|
2989
2971
|
text: this._template,
|
|
2990
2972
|
style: baseStyle,
|
|
2991
2973
|
label: this.spec.name
|
|
@@ -3491,7 +3473,7 @@ var CameraSequence = class extends Sequence {
|
|
|
3491
3473
|
this.duration = this.parent?.duration ?? this.root.duration;
|
|
3492
3474
|
}
|
|
3493
3475
|
const home = homeCamera(compW, this.compH);
|
|
3494
|
-
const carrier = new
|
|
3476
|
+
const carrier = new pixi_js.Container();
|
|
3495
3477
|
carrier.x = home.x;
|
|
3496
3478
|
carrier.y = home.y;
|
|
3497
3479
|
carrier.z = home.z;
|
|
@@ -3563,7 +3545,7 @@ var CameraSequence = class extends Sequence {
|
|
|
3563
3545
|
fogState() {
|
|
3564
3546
|
if (!this.fog) return null;
|
|
3565
3547
|
const c = this.target;
|
|
3566
|
-
const fc = this.fogC ??= new
|
|
3548
|
+
const fc = this.fogC ??= new pixi_js.Color();
|
|
3567
3549
|
try {
|
|
3568
3550
|
fc.setValue(c.fogColor);
|
|
3569
3551
|
} catch {
|
|
@@ -3675,12 +3657,12 @@ function lightLevel(frame, cam, lights) {
|
|
|
3675
3657
|
return 0.2126 * m[0] + 0.7152 * m[1] + 0.0722 * m[2];
|
|
3676
3658
|
}
|
|
3677
3659
|
var LightSequence = class extends Sequence {
|
|
3678
|
-
color = new
|
|
3660
|
+
color = new pixi_js.Color();
|
|
3679
3661
|
async build() {
|
|
3680
3662
|
const w = this.parent?.width ?? this.root.width;
|
|
3681
3663
|
const h = this.parent?.height ?? this.root.height;
|
|
3682
3664
|
if (this.duration === void 0) this.duration = this.parent?.duration ?? this.root.duration;
|
|
3683
|
-
const c = new
|
|
3665
|
+
const c = new pixi_js.Container();
|
|
3684
3666
|
c.x = w * 0.3;
|
|
3685
3667
|
c.y = h * 0.2;
|
|
3686
3668
|
c.z = homeDistance(h, 40) * 0.6;
|
|
@@ -3737,7 +3719,7 @@ var defaultWarn = (m) => console.warn(m);
|
|
|
3737
3719
|
var SPAN_STYLE_KEYS = ["fill", "fontWeight", "fontStyle", "fontVariant", "letterSpacing", "dropShadow"];
|
|
3738
3720
|
var LINE_KEYS = ["fontSize", "fontFamily", "lineHeight", "wordWrap", "wordWrapWidth", "align", "leading", "textBaseline", "whiteSpace", "stroke", "padding"];
|
|
3739
3721
|
var spansMeta = /* @__PURE__ */ new WeakMap();
|
|
3740
|
-
var widthOf = (text, style) =>
|
|
3722
|
+
var widthOf = (text, style) => pixi_js.CanvasTextMetrics.measureText(text, style).width;
|
|
3741
3723
|
function normalize(spans, who, warn) {
|
|
3742
3724
|
if (!Array.isArray(spans) || spans.length === 0) {
|
|
3743
3725
|
warn(`pixi-effects: ${who}: spans is empty: write an array of strings and { text, fill \u2026 } objects (nothing is drawn)`);
|
|
@@ -3772,15 +3754,15 @@ function normalize(spans, who, warn) {
|
|
|
3772
3754
|
}
|
|
3773
3755
|
function layoutSpans(spans, style, align2, who, warn = defaultWarn) {
|
|
3774
3756
|
const clean = normalize(spans, who, warn);
|
|
3775
|
-
const base = new
|
|
3776
|
-
const m =
|
|
3757
|
+
const base = new pixi_js.TextStyle(style);
|
|
3758
|
+
const m = pixi_js.CanvasTextMetrics.measureText("M", base);
|
|
3777
3759
|
const lineHeight = m.lineHeight ?? m.height;
|
|
3778
3760
|
const sentinel = (ts) => widthOf("|", ts);
|
|
3779
3761
|
const measure = (text, ts) => widthOf(text + "|", ts) - sentinel(ts);
|
|
3780
3762
|
const pieces = [];
|
|
3781
3763
|
let line = 0, chars = 0, x = 0;
|
|
3782
3764
|
clean.forEach((sp, spanIdx) => {
|
|
3783
|
-
const ts = Object.keys(sp.overrides).length ? new
|
|
3765
|
+
const ts = Object.keys(sp.overrides).length ? new pixi_js.TextStyle({ ...style, ...sp.overrides }) : base;
|
|
3784
3766
|
sp.text.split("\n").forEach((part, k) => {
|
|
3785
3767
|
if (k > 0) {
|
|
3786
3768
|
line++;
|
|
@@ -3884,13 +3866,13 @@ function expandSpans(spec, warn = defaultWarn, scope) {
|
|
|
3884
3866
|
var ORIGINAL_SCALE_MODE = /* @__PURE__ */ new WeakMap();
|
|
3885
3867
|
var ImageSequence = class extends Sequence {
|
|
3886
3868
|
async build() {
|
|
3887
|
-
const texture = await
|
|
3869
|
+
const texture = await pixi_js.Assets.get(this.spec.asset);
|
|
3888
3870
|
const source = texture.source;
|
|
3889
3871
|
if (source && !ORIGINAL_SCALE_MODE.has(source)) ORIGINAL_SCALE_MODE.set(source, source.scaleMode);
|
|
3890
3872
|
const mode = this.spec.scaleMode;
|
|
3891
3873
|
if (mode !== void 0 && mode !== "nearest" && mode !== "linear") console.warn(`pixi-effects: ${chunkNGJXVJB7_cjs.describeLayer(this.spec)}: scaleMode "${String(mode)}" is not "nearest" or "linear": ignored`);
|
|
3892
3874
|
if (source) source.scaleMode = mode === "nearest" || mode === "linear" ? mode : ORIGINAL_SCALE_MODE.get(source);
|
|
3893
|
-
const sprite = new
|
|
3875
|
+
const sprite = new pixi_js.Sprite({ texture, label: this.spec.name });
|
|
3894
3876
|
sprite.cullable = true;
|
|
3895
3877
|
this.target = sprite;
|
|
3896
3878
|
this.intrinsicWidth = texture.width;
|
|
@@ -3986,7 +3968,7 @@ var AudioSequence = class extends Sequence {
|
|
|
3986
3968
|
if (this.spec.sfx !== void 0) return this._buildSfx(this.spec);
|
|
3987
3969
|
const spec = this.spec;
|
|
3988
3970
|
this._source = `asset "${spec.asset}"`;
|
|
3989
|
-
const data = await
|
|
3971
|
+
const data = await pixi_js.Assets.get(spec.asset);
|
|
3990
3972
|
this._audioBuffer = data.audioBuffer;
|
|
3991
3973
|
this._remap = remapOf(spec, "time", data.duration ?? null);
|
|
3992
3974
|
const constant = this._remap && this._remap.timeKfs.length === 0 ? Math.abs(this._remap.speed ?? 1) : 1;
|
|
@@ -4523,7 +4505,7 @@ var VideoSequence = class extends Sequence {
|
|
|
4523
4505
|
/** Movie asks this layer to draw the frame its own timeline is at, not the one for a time it computed. */
|
|
4524
4506
|
selfTimed = true;
|
|
4525
4507
|
async build() {
|
|
4526
|
-
const data = await
|
|
4508
|
+
const data = await pixi_js.Assets.get(this.spec.asset);
|
|
4527
4509
|
this._sourceDuration = data.duration;
|
|
4528
4510
|
this._remap = remapOf(this.spec, "currentTime", this._sourceDuration);
|
|
4529
4511
|
this._audioBuffer = this.spec.audio !== false ? data.audioBuffer : null;
|
|
@@ -4537,8 +4519,8 @@ var VideoSequence = class extends Sequence {
|
|
|
4537
4519
|
this._canvas = canvas;
|
|
4538
4520
|
this._ctx = canvas.getContext("2d", { alpha: true });
|
|
4539
4521
|
if (probeFrame && this._ctx) this._ctx.drawImage(probeFrame, 0, 0);
|
|
4540
|
-
const texture =
|
|
4541
|
-
const sprite = new
|
|
4522
|
+
const texture = pixi_js.Texture.from(canvas);
|
|
4523
|
+
const sprite = new pixi_js.Sprite({ texture, label: this.spec.name });
|
|
4542
4524
|
sprite.cullable = true;
|
|
4543
4525
|
this.target = sprite;
|
|
4544
4526
|
this.intrinsicWidth = w;
|
|
@@ -4645,15 +4627,15 @@ function makeGradientFill(g) {
|
|
|
4645
4627
|
const ctx = canvas.getContext("2d");
|
|
4646
4628
|
if (ctx) {
|
|
4647
4629
|
paintRadial(ctx, RADIAL_SIZE, g);
|
|
4648
|
-
return { texture:
|
|
4630
|
+
return { texture: pixi_js.Texture.from(canvas), textureSpace: "local" };
|
|
4649
4631
|
}
|
|
4650
4632
|
}
|
|
4651
|
-
return new
|
|
4633
|
+
return new pixi_js.FillGradient(gradientOptions(g));
|
|
4652
4634
|
}
|
|
4653
4635
|
var CURVE_STEPS = 24;
|
|
4654
4636
|
var ELLIPSE_STEPS = 128;
|
|
4655
4637
|
function flattenSvgPath(d) {
|
|
4656
|
-
const prims = new
|
|
4638
|
+
const prims = new pixi_js.GraphicsPath(d).shapePath.shapePrimitives;
|
|
4657
4639
|
const out = [];
|
|
4658
4640
|
for (const { shape } of prims) {
|
|
4659
4641
|
const poly = shape;
|
|
@@ -4897,7 +4879,7 @@ var ShapeSequence = class extends Sequence {
|
|
|
4897
4879
|
};
|
|
4898
4880
|
_liveKeys = new Set(STYLE_KEYS);
|
|
4899
4881
|
async build() {
|
|
4900
|
-
const graphics = new
|
|
4882
|
+
const graphics = new pixi_js.Graphics({ label: this.spec.name });
|
|
4901
4883
|
graphics.cullable = true;
|
|
4902
4884
|
this.target = graphics;
|
|
4903
4885
|
if (this.duration === void 0) {
|
|
@@ -5011,13 +4993,13 @@ var ShapeSequence = class extends Sequence {
|
|
|
5011
4993
|
applyFill(g, s);
|
|
5012
4994
|
for (const hole of holes) {
|
|
5013
4995
|
g.beginPath();
|
|
5014
|
-
g.path(new
|
|
4996
|
+
g.path(new pixi_js.GraphicsPath(hole));
|
|
5015
4997
|
g.cut();
|
|
5016
4998
|
}
|
|
5017
4999
|
if (s.strokeColor !== void 0 && s.strokeWidth > 0) {
|
|
5018
5000
|
g.beginPath();
|
|
5019
|
-
g.path(new
|
|
5020
|
-
for (const hole of holes) g.path(new
|
|
5001
|
+
g.path(new pixi_js.GraphicsPath(main));
|
|
5002
|
+
for (const hole of holes) g.path(new pixi_js.GraphicsPath(hole));
|
|
5021
5003
|
applyStroke(g, s);
|
|
5022
5004
|
}
|
|
5023
5005
|
}
|
|
@@ -5261,7 +5243,7 @@ function makePolygonDraw(spec, scope) {
|
|
|
5261
5243
|
function makePathDraw(spec) {
|
|
5262
5244
|
const d = spec.fillRule === "evenodd" ? splitEvenOdd(spec.d).main : spec.d;
|
|
5263
5245
|
return (g) => {
|
|
5264
|
-
g.path(new
|
|
5246
|
+
g.path(new pixi_js.GraphicsPath(d));
|
|
5265
5247
|
};
|
|
5266
5248
|
}
|
|
5267
5249
|
var STATE_DRAWERS = {
|
|
@@ -5625,7 +5607,7 @@ var ShaderSequence = class extends Sequence {
|
|
|
5625
5607
|
this.c2d = document.createElement("canvas");
|
|
5626
5608
|
this.c2d.width = this.w;
|
|
5627
5609
|
this.c2d.height = this.h;
|
|
5628
|
-
const sprite = new
|
|
5610
|
+
const sprite = new pixi_js.Sprite({ texture: pixi_js.Texture.from(this.c2d), label: spec.name });
|
|
5629
5611
|
sprite.width = width;
|
|
5630
5612
|
sprite.height = height;
|
|
5631
5613
|
this.target = sprite;
|
|
@@ -5888,7 +5870,7 @@ var CanvasSequence = class extends Sequence {
|
|
|
5888
5870
|
this.canvas = document.createElement("canvas");
|
|
5889
5871
|
this.canvas.width = this.w;
|
|
5890
5872
|
this.canvas.height = this.h;
|
|
5891
|
-
const sprite = new
|
|
5873
|
+
const sprite = new pixi_js.Sprite({ texture: pixi_js.Texture.from(this.canvas), label: spec.name });
|
|
5892
5874
|
if (!this.smoothing) sprite.texture.source.scaleMode = "nearest";
|
|
5893
5875
|
sprite.width = this.layerW;
|
|
5894
5876
|
sprite.height = this.layerH;
|
|
@@ -6090,13 +6072,13 @@ var CanvasSequence = class extends Sequence {
|
|
|
6090
6072
|
var _CompositionSequence = null;
|
|
6091
6073
|
async function getCompositionSequence() {
|
|
6092
6074
|
if (!_CompositionSequence) {
|
|
6093
|
-
_CompositionSequence = (await import('./Composition-
|
|
6075
|
+
_CompositionSequence = (await import('./Composition-TJ5D7Z63.cjs')).CompositionSequence;
|
|
6094
6076
|
}
|
|
6095
6077
|
return _CompositionSequence;
|
|
6096
6078
|
}
|
|
6097
6079
|
var _SpansSequence = null;
|
|
6098
6080
|
async function getSpansSequence() {
|
|
6099
|
-
if (!_SpansSequence) _SpansSequence = (await import('./Spans-
|
|
6081
|
+
if (!_SpansSequence) _SpansSequence = (await import('./Spans-5ENZ3XGS.cjs')).SpansSequence;
|
|
6100
6082
|
return _SpansSequence;
|
|
6101
6083
|
}
|
|
6102
6084
|
var staticTypes = {
|
|
@@ -6196,5 +6178,5 @@ exports.spansMeta = spansMeta;
|
|
|
6196
6178
|
exports.springDuration = springDuration;
|
|
6197
6179
|
exports.timeRemapOf = timeRemapOf;
|
|
6198
6180
|
exports.trimPolylines = trimPolylines;
|
|
6199
|
-
//# sourceMappingURL=chunk-
|
|
6200
|
-
//# sourceMappingURL=chunk-
|
|
6181
|
+
//# sourceMappingURL=chunk-Z3DM4ETD.cjs.map
|
|
6182
|
+
//# sourceMappingURL=chunk-Z3DM4ETD.cjs.map
|