pixi-effects 0.26.0 → 0.26.1
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 +10 -0
- package/README.md +5 -5
- package/ai/chat-template.html +3 -3
- package/ai/tools/check.mjs +12 -0
- package/dist/{Base-BgnRXbtJ.d.ts → Base-CpdDs4HT.d.ts} +1 -1
- package/dist/{Base-DHVKqA46.d.cts → Base-TbBhHPrG.d.cts} +1 -1
- package/dist/Composition-THQPG4E5.cjs +16 -0
- package/dist/{Composition-2GJSCHPP.cjs.map → Composition-THQPG4E5.cjs.map} +1 -1
- package/dist/Composition-Z2VY3KWZ.js +7 -0
- package/dist/{Composition-C4FSWJZF.js.map → Composition-Z2VY3KWZ.js.map} +1 -1
- package/dist/Controller.d.cts +2 -2
- package/dist/Controller.d.ts +2 -2
- package/dist/{Movie-DP5p1r4E.d.ts → Movie-DVeDTdnc.d.ts} +23 -2
- package/dist/{Movie-DXReF4-W.d.cts → Movie-i05Oh9mJ.d.cts} +23 -2
- package/dist/Presenter.d.cts +2 -2
- package/dist/Presenter.d.ts +2 -2
- package/dist/{chunk-DP37TTMO.cjs → chunk-EABL3UKJ.cjs} +5 -3
- package/dist/chunk-EABL3UKJ.cjs.map +1 -0
- package/dist/{chunk-SY27HZC5.cjs → chunk-H3RHEH5W.cjs} +59 -59
- package/dist/{chunk-SY27HZC5.cjs.map → chunk-H3RHEH5W.cjs.map} +1 -1
- package/dist/{chunk-PRZ4U6JN.js → chunk-JHJNEIDI.js} +5 -3
- package/dist/chunk-JHJNEIDI.js.map +1 -0
- package/dist/{chunk-XS6GSJCN.js → chunk-YEVAUQ6Y.js} +3 -3
- package/dist/{chunk-XS6GSJCN.js.map → chunk-YEVAUQ6Y.js.map} +1 -1
- package/dist/index.cjs +186 -32
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +162 -8
- package/dist/index.js.map +1 -1
- package/dist/loader.css +35 -2
- package/dist/three.cjs +5 -5
- package/dist/three.d.cts +2 -2
- package/dist/three.d.ts +2 -2
- package/dist/three.js +1 -1
- package/dist/{types-CoT0ypcx.d.ts → types-DSGwN5w1.d.cts} +2 -0
- package/dist/{types-CoT0ypcx.d.cts → types-DSGwN5w1.d.ts} +2 -0
- package/docs/api.md +3 -2
- package/llms-full.txt +4 -3
- package/package.json +1 -1
- package/skills/pixi-effects/SKILL.md +2 -2
- package/skills/pixi-effects/template.html +6 -5
- package/dist/Composition-2GJSCHPP.cjs +0 -16
- package/dist/Composition-C4FSWJZF.js +0 -7
- package/dist/chunk-DP37TTMO.cjs.map +0 -1
- package/dist/chunk-PRZ4U6JN.js.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
3
|
+
var chunkH3RHEH5W_cjs = require('./chunk-H3RHEH5W.cjs');
|
|
4
|
+
var chunkEABL3UKJ_cjs = require('./chunk-EABL3UKJ.cjs');
|
|
5
5
|
var chunk3DLYAPK7_cjs = require('./chunk-3DLYAPK7.cjs');
|
|
6
6
|
var chunkECA2WNRX_cjs = require('./chunk-ECA2WNRX.cjs');
|
|
7
7
|
var chunkTWZNOUM7_cjs = require('./chunk-TWZNOUM7.cjs');
|
|
@@ -80,11 +80,11 @@ function ensureLoadersRegistered(audioContext) {
|
|
|
80
80
|
}
|
|
81
81
|
});
|
|
82
82
|
}
|
|
83
|
-
async function loadAssetBundle(assets, audioContext) {
|
|
83
|
+
async function loadAssetBundle(assets, audioContext, onProgress) {
|
|
84
84
|
ensureLoadersRegistered(audioContext);
|
|
85
85
|
const bundle = assets.map((a) => ({ alias: a.name, src: a.src }));
|
|
86
86
|
PIXI.Assets.addBundle("pixi-effects", bundle);
|
|
87
|
-
return await PIXI.Assets.loadBundle("pixi-effects");
|
|
87
|
+
return await PIXI.Assets.loadBundle("pixi-effects", onProgress);
|
|
88
88
|
}
|
|
89
89
|
|
|
90
90
|
// src/core/audioRemap.ts
|
|
@@ -1407,8 +1407,8 @@ function expandTransitions(spec) {
|
|
|
1407
1407
|
}
|
|
1408
1408
|
const transitions = out.transitions;
|
|
1409
1409
|
const sequences = out.sequences ?? [];
|
|
1410
|
-
const remap = out.duration !== void 0 ?
|
|
1411
|
-
const parentDuration = remap ?
|
|
1410
|
+
const remap = out.duration !== void 0 ? chunkEABL3UKJ_cjs.timeRemapOf(out) : null;
|
|
1411
|
+
const parentDuration = remap ? chunkEABL3UKJ_cjs.contentLength(remap, out.duration) : out.duration ?? Infinity;
|
|
1412
1412
|
const compW = out.width;
|
|
1413
1413
|
const compH = out.height;
|
|
1414
1414
|
const threeDByName = new Set(sequences.filter((s) => s.name && s.threeD).map((s) => s.name));
|
|
@@ -1476,16 +1476,16 @@ function expandTransitions(spec) {
|
|
|
1476
1476
|
if (toUses > 1) {
|
|
1477
1477
|
throw new Error(`pixi-effects: ${tag} sequence "${t.to}" is used as \`to\` in more than one transition`);
|
|
1478
1478
|
}
|
|
1479
|
-
const tStart =
|
|
1479
|
+
const tStart = chunkEABL3UKJ_cjs.resolveAt(t.at, parentDuration);
|
|
1480
1480
|
const tEnd = tStart + t.duration;
|
|
1481
1481
|
const fromSeq = fromEntry.seq;
|
|
1482
|
-
const fromStart =
|
|
1482
|
+
const fromStart = chunkEABL3UKJ_cjs.resolveAt(fromSeq.at, parentDuration);
|
|
1483
1483
|
const fromEnd = fromStart + (fromSeq.duration ?? parentDuration);
|
|
1484
1484
|
if (tStart < fromStart - EPS || tEnd > fromEnd + EPS) {
|
|
1485
1485
|
throw new Error(`pixi-effects: ${tag} window [${tStart}, ${tEnd}] is not covered by \`from\` "${t.from}" (lives [${fromStart}, ${fromEnd}], so it ends at ${fromEnd})`);
|
|
1486
1486
|
}
|
|
1487
1487
|
const toSeq = toEntry.seq;
|
|
1488
|
-
const toStart =
|
|
1488
|
+
const toStart = chunkEABL3UKJ_cjs.resolveAt(toSeq.at, parentDuration);
|
|
1489
1489
|
const toEnd = toStart + (toSeq.duration ?? parentDuration);
|
|
1490
1490
|
if (tStart < toStart - EPS || tEnd > toEnd + EPS) {
|
|
1491
1491
|
throw new Error(`pixi-effects: ${tag} window [${tStart}, ${tEnd}] is not covered by \`to\` "${t.to}" (lives [${toStart}, ${toEnd}], so it starts at ${toStart})`);
|
|
@@ -1545,7 +1545,7 @@ function wrapAsFullComposition(seq, compW, compH) {
|
|
|
1545
1545
|
delete inner.at;
|
|
1546
1546
|
delete inner.duration;
|
|
1547
1547
|
const m = inner.mask;
|
|
1548
|
-
const carriesMatte = m !== void 0 &&
|
|
1548
|
+
const carriesMatte = m !== void 0 && chunkH3RHEH5W_cjs.maskSourceOf(m).kind === "refs";
|
|
1549
1549
|
if (carriesMatte) delete inner.mask;
|
|
1550
1550
|
return {
|
|
1551
1551
|
...carriesMatte ? { mask: m } : {},
|
|
@@ -1872,7 +1872,7 @@ function inspectScene(root, frame, time, canvas, opts = {}) {
|
|
|
1872
1872
|
const group = parentScene ?? (name !== void 0 && blending.has(name) ? name : void 0);
|
|
1873
1873
|
if (group) scene.set(info, group);
|
|
1874
1874
|
if (zero || seq.showsNothingYet) scaledToNothing.add(info);
|
|
1875
|
-
if (seq instanceof
|
|
1875
|
+
if (seq instanceof chunkH3RHEH5W_cjs.CompositionSequence) walk2(seq, prefix + label + "/", insideThreeD || threeD, visible, group, moving, zero);
|
|
1876
1876
|
});
|
|
1877
1877
|
};
|
|
1878
1878
|
walk2(root, "", false, true);
|
|
@@ -1933,10 +1933,10 @@ function walk(comp, parentStart, parentEnd, depth, prefix, rows, transitions, lo
|
|
|
1933
1933
|
const start = parentStart + (seq.at ?? 0);
|
|
1934
1934
|
const end = Math.min(parentEnd, seq.duration !== void 0 ? start + seq.duration : parentEnd);
|
|
1935
1935
|
const span = end - start;
|
|
1936
|
-
const keys = (seq.spec.keyframes ?? []).map((kf) => round(start +
|
|
1936
|
+
const keys = (seq.spec.keyframes ?? []).map((kf) => round(start + chunkEABL3UKJ_cjs.resolveAt(kf.at, span))).sort((a, b) => a - b).slice(0, MAX_KEYS);
|
|
1937
1937
|
const row = { path: prefix + name, name, type: seq.spec.type, depth, start: round(start), end: round(end), keys, detail: detailOf(seq), ...local ? { local } : {} };
|
|
1938
1938
|
const inner = [];
|
|
1939
|
-
const isComp = seq instanceof
|
|
1939
|
+
const isComp = seq instanceof chunkH3RHEH5W_cjs.CompositionSequence;
|
|
1940
1940
|
if (isComp) {
|
|
1941
1941
|
const label = seq.remapLabel();
|
|
1942
1942
|
walk(seq, label ? 0 : start, label ? seq.contentSpan : end, depth + 1, prefix + name + "/", inner, transitions, label ? `${name} ${label}` : local);
|
|
@@ -2302,6 +2302,100 @@ function changedFraction(a, b, threshold = 12) {
|
|
|
2302
2302
|
return changed / n;
|
|
2303
2303
|
}
|
|
2304
2304
|
|
|
2305
|
+
// src/core/loadProgress.ts
|
|
2306
|
+
var STAGE_LABEL = {
|
|
2307
|
+
assets: "LOADING ASSETS",
|
|
2308
|
+
build: "BUILDING LAYERS",
|
|
2309
|
+
sound: "MIXING SOUND",
|
|
2310
|
+
frames: "PREPARING"
|
|
2311
|
+
};
|
|
2312
|
+
var ORDER = ["assets", "build", "sound", "frames"];
|
|
2313
|
+
var WEIGHT = { assets: 0.15, build: 0.6, sound: 0.2, frames: 0.05 };
|
|
2314
|
+
var YIELD_EVERY_MS = 50;
|
|
2315
|
+
function defaultYielder() {
|
|
2316
|
+
if (typeof MessageChannel === "undefined") return new Promise((resolve) => setTimeout(resolve, 0));
|
|
2317
|
+
return new Promise((resolve) => {
|
|
2318
|
+
const ch = new MessageChannel();
|
|
2319
|
+
ch.port1.onmessage = () => {
|
|
2320
|
+
ch.port1.close();
|
|
2321
|
+
resolve();
|
|
2322
|
+
};
|
|
2323
|
+
ch.port2.postMessage(0);
|
|
2324
|
+
});
|
|
2325
|
+
}
|
|
2326
|
+
var LoadProgress = class {
|
|
2327
|
+
constructor(_onChange, opts = {}) {
|
|
2328
|
+
this._onChange = _onChange;
|
|
2329
|
+
this._now = opts.now ?? (() => typeof performance !== "undefined" ? performance.now() : Date.now());
|
|
2330
|
+
this._yielder = opts.yielder ?? defaultYielder;
|
|
2331
|
+
this._hidden = opts.hidden ?? (() => typeof document !== "undefined" && document.hidden === true);
|
|
2332
|
+
this._every = opts.yieldEveryMs ?? YIELD_EVERY_MS;
|
|
2333
|
+
this._lastYield = this._now();
|
|
2334
|
+
}
|
|
2335
|
+
_onChange;
|
|
2336
|
+
_stage = null;
|
|
2337
|
+
_loaded = 0;
|
|
2338
|
+
_total = 0;
|
|
2339
|
+
_high = 0;
|
|
2340
|
+
_started = 0;
|
|
2341
|
+
_ms = { assets: 0, build: 0, sound: 0, frames: 0 };
|
|
2342
|
+
_lastYield;
|
|
2343
|
+
_now;
|
|
2344
|
+
_yielder;
|
|
2345
|
+
_every;
|
|
2346
|
+
_hidden;
|
|
2347
|
+
get progress() {
|
|
2348
|
+
return this._high;
|
|
2349
|
+
}
|
|
2350
|
+
/** Start a stage with `total` items (0 = nothing to wait for). Every earlier stage is done. */
|
|
2351
|
+
begin(stage, total) {
|
|
2352
|
+
this._closeTiming();
|
|
2353
|
+
this._stage = stage;
|
|
2354
|
+
this._loaded = 0;
|
|
2355
|
+
this._total = Math.max(0, total);
|
|
2356
|
+
this._started = this._now();
|
|
2357
|
+
this._emit();
|
|
2358
|
+
}
|
|
2359
|
+
tick(n = 1) {
|
|
2360
|
+
if (!this._stage) return;
|
|
2361
|
+
this._loaded = Math.min(this._total, this._loaded + n);
|
|
2362
|
+
this._emit();
|
|
2363
|
+
}
|
|
2364
|
+
/** Everything is done: 1, whatever stage it was in. */
|
|
2365
|
+
finish() {
|
|
2366
|
+
this._closeTiming();
|
|
2367
|
+
this._stage = this._stage ?? "frames";
|
|
2368
|
+
this._loaded = this._total;
|
|
2369
|
+
this._high = 1;
|
|
2370
|
+
this._onChange({ stage: this._stage, loaded: this._loaded, total: this._total, progress: 1 });
|
|
2371
|
+
}
|
|
2372
|
+
/** Milliseconds each stage took (a stage never begun is 0). */
|
|
2373
|
+
timings() {
|
|
2374
|
+
return { ...this._ms };
|
|
2375
|
+
}
|
|
2376
|
+
/** Await one macrotask when 50 ms of work have gone by since the last time, so the page can paint the bar. Cheap when it is not due. */
|
|
2377
|
+
async yieldIfDue() {
|
|
2378
|
+
const t = this._now();
|
|
2379
|
+
if (t - this._lastYield < this._every || this._hidden()) return;
|
|
2380
|
+
await this._yielder();
|
|
2381
|
+
this._lastYield = this._now();
|
|
2382
|
+
}
|
|
2383
|
+
_closeTiming() {
|
|
2384
|
+
if (this._stage) this._ms[this._stage] += Math.max(0, this._now() - this._started);
|
|
2385
|
+
}
|
|
2386
|
+
_emit() {
|
|
2387
|
+
const stage = this._stage;
|
|
2388
|
+
let done = 0;
|
|
2389
|
+
for (const s of ORDER) {
|
|
2390
|
+
if (s === stage) break;
|
|
2391
|
+
done += WEIGHT[s];
|
|
2392
|
+
}
|
|
2393
|
+
const within = this._total > 0 ? this._loaded / this._total : 1;
|
|
2394
|
+
this._high = Math.min(1, Math.max(this._high, done + WEIGHT[stage] * within));
|
|
2395
|
+
this._onChange({ stage, loaded: this._loaded, total: this._total, progress: this._high });
|
|
2396
|
+
}
|
|
2397
|
+
};
|
|
2398
|
+
|
|
2305
2399
|
// src/core/loader.ts
|
|
2306
2400
|
var FADE_FALLBACK_MS = 900;
|
|
2307
2401
|
function resolveLoader(option, canvas) {
|
|
@@ -2327,15 +2421,31 @@ function dismissLoader(loader) {
|
|
|
2327
2421
|
loader.remove();
|
|
2328
2422
|
}
|
|
2329
2423
|
};
|
|
2330
|
-
loader.addEventListener("transitionend",
|
|
2424
|
+
loader.addEventListener("transitionend", (e) => {
|
|
2425
|
+
if (e.target === loader && e.propertyName === "opacity") remove();
|
|
2426
|
+
});
|
|
2331
2427
|
setTimeout(remove, FADE_FALLBACK_MS);
|
|
2332
2428
|
}
|
|
2333
2429
|
function failLoader(loader, message) {
|
|
2334
2430
|
if (!loader) return;
|
|
2335
2431
|
loader.setAttribute("data-state", "error");
|
|
2432
|
+
for (const a of ["data-stage", "data-percent"]) loader.removeAttribute(a);
|
|
2433
|
+
loader.querySelector(".pe-loader__bar")?.remove();
|
|
2336
2434
|
if (loader.hasAttribute("data-label")) loader.setAttribute("data-label", message);
|
|
2337
2435
|
loader.setAttribute("aria-busy", "false");
|
|
2338
2436
|
}
|
|
2437
|
+
function setLoaderProgress(loader, state) {
|
|
2438
|
+
if (!loader || loader.getAttribute("data-state") === "error" || loader.classList.contains("pe-loader--done")) return;
|
|
2439
|
+
if (!loader.querySelector(".pe-loader__bar")) {
|
|
2440
|
+
const bar = loader.ownerDocument.createElement("i");
|
|
2441
|
+
bar.className = "pe-loader__bar";
|
|
2442
|
+
bar.setAttribute("aria-hidden", "true");
|
|
2443
|
+
loader.appendChild(bar);
|
|
2444
|
+
}
|
|
2445
|
+
loader.style.setProperty("--pe-progress", String(Math.round(state.progress * 1e3) / 1e3));
|
|
2446
|
+
loader.setAttribute("data-stage", STAGE_LABEL[state.stage]);
|
|
2447
|
+
loader.setAttribute("data-percent", String(Math.round(state.progress * 100)));
|
|
2448
|
+
}
|
|
2339
2449
|
|
|
2340
2450
|
// src/core/Movie.ts
|
|
2341
2451
|
PIXI.extensions.add(PIXI.CullerPlugin);
|
|
@@ -2415,6 +2525,11 @@ var Movie = class {
|
|
|
2415
2525
|
get isReady() {
|
|
2416
2526
|
return this._initState === "ready";
|
|
2417
2527
|
}
|
|
2528
|
+
/** Milliseconds `init()` spent in each stage (assets, build, sound, frames), or null before it has finished: `check` says which stage is the slow one. */
|
|
2529
|
+
get loadStages() {
|
|
2530
|
+
return this._loadStages;
|
|
2531
|
+
}
|
|
2532
|
+
_loadStages = null;
|
|
2418
2533
|
/** True while the movie has sound but the browser keeps it silent until the viewer taps (iOS Safari, a page nobody has touched): a player can show "tap for sound"; the sound starts at a tap or key press that arrives while play() is pending, or at the next play() made from a tap. */
|
|
2419
2534
|
get audioBlocked() {
|
|
2420
2535
|
return audioIsBlocked(this._audioContext, !!this.audioBuffer);
|
|
@@ -2499,15 +2614,39 @@ var Movie = class {
|
|
|
2499
2614
|
this.app.stage.addChild(root);
|
|
2500
2615
|
this._rootContainer = root;
|
|
2501
2616
|
const audioContext = this._ensureAudioContext();
|
|
2502
|
-
|
|
2503
|
-
const
|
|
2617
|
+
let loaderEl;
|
|
2618
|
+
const lp = new LoadProgress((state) => {
|
|
2619
|
+
if (loaderEl === void 0) loaderEl = resolveLoader(options.loader, options.canvas ?? this.app?.canvas ?? null);
|
|
2620
|
+
setLoaderProgress(loaderEl, state);
|
|
2621
|
+
this.emit("loadprogress", state);
|
|
2622
|
+
}, { yieldEveryMs: globalThis.__peLoadYieldMs });
|
|
2623
|
+
const assetCount = (options.assets ?? []).length;
|
|
2624
|
+
lp.begin("assets", assetCount);
|
|
2625
|
+
let assetsSeen = 0;
|
|
2626
|
+
await loadAssetBundle(options.assets ?? [], audioContext, (p) => {
|
|
2627
|
+
const n = Math.round(p * assetCount);
|
|
2628
|
+
if (n > assetsSeen) {
|
|
2629
|
+
lp.tick(n - assetsSeen);
|
|
2630
|
+
assetsSeen = n;
|
|
2631
|
+
}
|
|
2632
|
+
});
|
|
2633
|
+
const rootShape = {
|
|
2634
|
+
width: this.width,
|
|
2635
|
+
height: this.height,
|
|
2636
|
+
duration: this.duration,
|
|
2637
|
+
frameRate: this.frameRate,
|
|
2638
|
+
onLayerBuilt: async () => {
|
|
2639
|
+
lp.tick();
|
|
2640
|
+
await lp.yieldIfDue();
|
|
2641
|
+
}
|
|
2642
|
+
};
|
|
2504
2643
|
const seededComposition = options.composition ? {
|
|
2505
2644
|
...options.composition,
|
|
2506
2645
|
width: options.composition.width ?? this.width,
|
|
2507
2646
|
height: options.composition.height ?? this.height,
|
|
2508
2647
|
duration: options.composition.duration ?? this.duration
|
|
2509
2648
|
} : void 0;
|
|
2510
|
-
await
|
|
2649
|
+
await chunkEABL3UKJ_cjs.ensureFilterLibrary(seededComposition);
|
|
2511
2650
|
const userComposition = seededComposition ? expandTransitions(seededComposition) : void 0;
|
|
2512
2651
|
const rootSeqSpec = {
|
|
2513
2652
|
type: "composition",
|
|
@@ -2517,7 +2656,8 @@ var Movie = class {
|
|
|
2517
2656
|
...userComposition
|
|
2518
2657
|
};
|
|
2519
2658
|
if (userComposition) carryTransitionWindows(userComposition, rootSeqSpec);
|
|
2520
|
-
const composition = new
|
|
2659
|
+
const composition = new chunkH3RHEH5W_cjs.CompositionSequence(rootSeqSpec, null, rootShape);
|
|
2660
|
+
lp.begin("build", countLayers(rootSeqSpec));
|
|
2521
2661
|
await composition.build();
|
|
2522
2662
|
this._rootSequence = composition;
|
|
2523
2663
|
if (composition.target) root.addChild(composition.target);
|
|
@@ -2525,15 +2665,20 @@ var Movie = class {
|
|
|
2525
2665
|
this._timeFilters = collectTimeFilters(composition);
|
|
2526
2666
|
const audios = [];
|
|
2527
2667
|
composition.collectAudio(audios, 0);
|
|
2668
|
+
lp.begin("sound", audios.length);
|
|
2528
2669
|
if (audios.length > 0) {
|
|
2529
2670
|
this.audioBuffer = await mixdown(audios, this.duration, audioContext.sampleRate);
|
|
2671
|
+
lp.tick(audios.length);
|
|
2530
2672
|
if (this.audioBuffer) this._mixStats = limitMix(this.audioBuffer, audios);
|
|
2531
2673
|
}
|
|
2532
2674
|
this._audioSources = audios;
|
|
2533
2675
|
this.timeline.progress(1).progress(0);
|
|
2676
|
+
lp.begin("frames", 0);
|
|
2534
2677
|
await this._awaitVideoFrames();
|
|
2535
2678
|
this._updateSpace();
|
|
2536
2679
|
this._renderNow();
|
|
2680
|
+
lp.finish();
|
|
2681
|
+
this._loadStages = lp.timings();
|
|
2537
2682
|
this._initState = "ready";
|
|
2538
2683
|
if (this._posterFrame !== null) await this._showPoster();
|
|
2539
2684
|
this.emit("ready");
|
|
@@ -3173,6 +3318,15 @@ function collectVideoSequences(seq, out, clocks, clock = null) {
|
|
|
3173
3318
|
collectVideoSequences(child, out, clocks, own);
|
|
3174
3319
|
}
|
|
3175
3320
|
}
|
|
3321
|
+
function countLayers(spec) {
|
|
3322
|
+
let n = 0;
|
|
3323
|
+
for (const s of spec?.sequences ?? []) {
|
|
3324
|
+
const mask = s.mask;
|
|
3325
|
+
n += 1 + countLayers(s);
|
|
3326
|
+
for (const m of Array.isArray(mask) ? mask : [mask]) if (m && typeof m === "object" && "type" in m) n += 1 + countLayers(m);
|
|
3327
|
+
}
|
|
3328
|
+
return n;
|
|
3329
|
+
}
|
|
3176
3330
|
var BY = ["chars", "words", "lines"];
|
|
3177
3331
|
var ALIGN = ["left", "center", "right"];
|
|
3178
3332
|
var widthOf = (text, style) => PIXI.CanvasTextMetrics.measureText(text, style).width;
|
|
@@ -3337,7 +3491,7 @@ function clamp(v, lo, hi) {
|
|
|
3337
3491
|
return Math.max(lo, Math.min(hi, v));
|
|
3338
3492
|
}
|
|
3339
3493
|
function parseEase(name) {
|
|
3340
|
-
|
|
3494
|
+
chunkEABL3UKJ_cjs.checkEase(name, "a preset");
|
|
3341
3495
|
return gsap.gsap.parseEase(name);
|
|
3342
3496
|
}
|
|
3343
3497
|
|
|
@@ -3360,17 +3514,17 @@ function orbit(opts) {
|
|
|
3360
3514
|
throw new Error("pixi-effects: orbit() cannot combine `radius` with `dollyZoom` \u2014 the radius follows the animated fov");
|
|
3361
3515
|
}
|
|
3362
3516
|
const [cx, cy] = opts.center ?? [width / 2, height / 2];
|
|
3363
|
-
const fixedR = opts.radius ??
|
|
3517
|
+
const fixedR = opts.radius ?? chunkEABL3UKJ_cjs.homeDistance(height, fov ?? chunkEABL3UKJ_cjs.DEFAULT_FOV);
|
|
3364
3518
|
const start = opts.start ?? -degrees / 2;
|
|
3365
3519
|
const steps = Math.max(1, Math.round(duration * stepsPerSecond));
|
|
3366
3520
|
const easeFn = parseEase(ease);
|
|
3367
3521
|
const dollyEase = dolly ? parseEase(dolly.ease ?? ease) : null;
|
|
3368
3522
|
const pos = (i) => {
|
|
3369
3523
|
const p = i / steps;
|
|
3370
|
-
const a = (start + degrees * easeFn(p)) *
|
|
3524
|
+
const a = (start + degrees * easeFn(p)) * chunkEABL3UKJ_cjs.DEG;
|
|
3371
3525
|
if (!dolly) return { x: cx + fixedR * Math.sin(a), z: fixedR * Math.cos(a) };
|
|
3372
3526
|
const f = dolly.from + (dolly.to - dolly.from) * dollyEase(p);
|
|
3373
|
-
const R =
|
|
3527
|
+
const R = chunkEABL3UKJ_cjs.homeDistance(height, f);
|
|
3374
3528
|
return { x: cx + R * Math.sin(a), z: R * Math.cos(a), fov: f };
|
|
3375
3529
|
};
|
|
3376
3530
|
const keyframes = [];
|
|
@@ -3425,7 +3579,7 @@ function particles(opts) {
|
|
|
3425
3579
|
const round3 = (v) => Math.round(v * 1e6) / 1e6;
|
|
3426
3580
|
const out = [];
|
|
3427
3581
|
for (let i = 0; i < count; i++) {
|
|
3428
|
-
const r =
|
|
3582
|
+
const r = chunkEABL3UKJ_cjs.random(seed * 1000003 + i * 7919 + 17);
|
|
3429
3583
|
const pick = ([a2, b]) => a2 + r() * (b - a2);
|
|
3430
3584
|
const born = at + r() * emit;
|
|
3431
3585
|
const lifetime = pick(life);
|
|
@@ -3438,7 +3592,7 @@ function particles(opts) {
|
|
|
3438
3592
|
const turn = spin ? pick(spin) : 0;
|
|
3439
3593
|
const startAngle = spin ? r() * 360 : 0;
|
|
3440
3594
|
const swayAmp = sway?.amp ?? 0, swayFreq = sway?.freq ?? 1;
|
|
3441
|
-
const n0 = sway ?
|
|
3595
|
+
const n0 = sway ? chunkEABL3UKJ_cjs.noise(0, seed * 1000003 + i) : 0;
|
|
3442
3596
|
const at_ = (t) => {
|
|
3443
3597
|
const axis = (p0, v0, acc) => {
|
|
3444
3598
|
if (drag > 0) {
|
|
@@ -3447,7 +3601,7 @@ function particles(opts) {
|
|
|
3447
3601
|
}
|
|
3448
3602
|
return p0 + v0 * t + 0.5 * acc * t * t;
|
|
3449
3603
|
};
|
|
3450
|
-
const sw = sway ? swayAmp * (
|
|
3604
|
+
const sw = sway ? swayAmp * (chunkEABL3UKJ_cjs.noise(t * swayFreq, seed * 1000003 + i) - n0) : 0;
|
|
3451
3605
|
return { x: axis(x0, vx, wind) + sw, y: axis(y0, vy, gravity) };
|
|
3452
3606
|
};
|
|
3453
3607
|
const kfs = [];
|
|
@@ -3509,7 +3663,7 @@ function followPath(opts) {
|
|
|
3509
3663
|
if (steps > MAX_STEPS) throw new Error(`followPath(): ${steps} samples is too many (max ${MAX_STEPS}); lower frameRate or duration`);
|
|
3510
3664
|
const segments = [];
|
|
3511
3665
|
let total = 0;
|
|
3512
|
-
for (const line of
|
|
3666
|
+
for (const line of chunkEABL3UKJ_cjs.flattenSvgPath(d)) {
|
|
3513
3667
|
const p = line.closed ? [...line.pts, line.pts[0], line.pts[1]] : line.pts;
|
|
3514
3668
|
for (let i = 2; i < p.length; i += 2) {
|
|
3515
3669
|
const len = Math.hypot(p[i] - p[i - 2], p[i + 1] - p[i - 1]);
|
|
@@ -3663,7 +3817,7 @@ function distances(n, from, grid, seed) {
|
|
|
3663
3817
|
if (n === 0) return [];
|
|
3664
3818
|
if (from === "random") {
|
|
3665
3819
|
const order = Array.from({ length: n }, (_, i) => i);
|
|
3666
|
-
const r =
|
|
3820
|
+
const r = chunkEABL3UKJ_cjs.random(seed);
|
|
3667
3821
|
for (let i = n - 1; i > 0; i--) {
|
|
3668
3822
|
const j = Math.floor(r() * (i + 1));
|
|
3669
3823
|
[order[i], order[j]] = [order[j], order[i]];
|
|
@@ -3725,7 +3879,7 @@ function wiggle(opts) {
|
|
|
3725
3879
|
to[n] = p.around;
|
|
3726
3880
|
return;
|
|
3727
3881
|
}
|
|
3728
|
-
const off = (
|
|
3882
|
+
const off = (chunkEABL3UKJ_cjs.rand(seed * 7919 + pi * 104729 + s * 31 + 1) * 2 - 1) * p.amp;
|
|
3729
3883
|
to[n] = typeof p.around === "number" ? p.around + off : `(${p.around}) ${off < 0 ? "-" : "+"} ${Math.abs(off)}`;
|
|
3730
3884
|
});
|
|
3731
3885
|
out.push({ at: at + s * stepLen, to, duration: stepLen, ease });
|
|
@@ -4200,19 +4354,19 @@ function withFade(spec, opts) {
|
|
|
4200
4354
|
|
|
4201
4355
|
Object.defineProperty(exports, "noise", {
|
|
4202
4356
|
enumerable: true,
|
|
4203
|
-
get: function () { return
|
|
4357
|
+
get: function () { return chunkEABL3UKJ_cjs.noise; }
|
|
4204
4358
|
});
|
|
4205
4359
|
Object.defineProperty(exports, "rand", {
|
|
4206
4360
|
enumerable: true,
|
|
4207
|
-
get: function () { return
|
|
4361
|
+
get: function () { return chunkEABL3UKJ_cjs.rand; }
|
|
4208
4362
|
});
|
|
4209
4363
|
Object.defineProperty(exports, "random", {
|
|
4210
4364
|
enumerable: true,
|
|
4211
|
-
get: function () { return
|
|
4365
|
+
get: function () { return chunkEABL3UKJ_cjs.random; }
|
|
4212
4366
|
});
|
|
4213
4367
|
Object.defineProperty(exports, "registerSequenceType", {
|
|
4214
4368
|
enumerable: true,
|
|
4215
|
-
get: function () { return
|
|
4369
|
+
get: function () { return chunkEABL3UKJ_cjs.registerSequenceType; }
|
|
4216
4370
|
});
|
|
4217
4371
|
exports.Movie = Movie;
|
|
4218
4372
|
exports.animateText = animateText;
|