pixi-effects 0.18.1 → 0.20.0
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 +49 -0
- package/README.md +6 -6
- package/ai/CHAT.md +1 -1
- package/ai/SKILL.md +2 -1
- package/ai/chat-template.html +4 -4
- package/ai/reference/cheatsheet.md +10 -9
- package/ai/reference/pitfalls.md +9 -0
- package/ai/reference/recipes.md +117 -0
- package/ai/template.html +5 -5
- package/ai/tools/check.mjs +29 -6
- package/dist/{Base-BQUodYZK.d.ts → Base-CzfLGoDr.d.ts} +9 -1
- package/dist/{Base-OHqp8qvX.d.cts → Base-wYJQ2g5Q.d.cts} +9 -1
- package/dist/Composition-6PA4C4TV.js +5 -0
- package/dist/{Composition-MLBHYYFF.js.map → Composition-6PA4C4TV.js.map} +1 -1
- package/dist/Composition-LL2XXU5N.cjs +14 -0
- package/dist/{Composition-6JMXWNVV.cjs.map → Composition-LL2XXU5N.cjs.map} +1 -1
- package/dist/Controller.cjs +2 -2
- package/dist/Controller.d.cts +2 -2
- package/dist/Controller.d.ts +2 -2
- package/dist/Controller.js +1 -1
- package/dist/{Movie-DlHQ9C02.d.ts → Movie-CBxGH5ms.d.ts} +13 -2
- package/dist/{Movie-K2YuVAdg.d.cts → Movie-CzzJw8A-.d.cts} +13 -2
- package/dist/Presenter.cjs +2 -2
- package/dist/Presenter.d.cts +2 -2
- package/dist/Presenter.d.ts +2 -2
- package/dist/Presenter.js +1 -1
- package/dist/{chunk-SG3Y66FN.js → chunk-DQHXVNOI.js} +1029 -64
- package/dist/chunk-DQHXVNOI.js.map +1 -0
- package/dist/{chunk-JW67MDHQ.cjs → chunk-FFYA3UBU.cjs} +144 -36
- package/dist/chunk-FFYA3UBU.cjs.map +1 -0
- package/dist/{chunk-DKGG7WD4.js → chunk-MNM56B3X.js} +6 -3
- package/dist/chunk-MNM56B3X.js.map +1 -0
- package/dist/{chunk-ANO5R2E6.cjs → chunk-NO26HWR7.cjs} +1036 -65
- package/dist/chunk-NO26HWR7.cjs.map +1 -0
- package/dist/{chunk-UXDR3ZDU.js → chunk-TSPMKV2F.js} +121 -13
- package/dist/chunk-TSPMKV2F.js.map +1 -0
- package/dist/{chunk-UQBGW5DO.cjs → chunk-WTRKDIKH.cjs} +6 -3
- package/dist/chunk-WTRKDIKH.cjs.map +1 -0
- package/dist/index.cjs +246 -96
- 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 +187 -37
- package/dist/index.js.map +1 -1
- package/dist/loader.css +1 -1
- package/dist/{music-4HDFULNR.js → music-CFEC7HKL.js} +3 -3
- package/dist/{music-4HDFULNR.js.map → music-CFEC7HKL.js.map} +1 -1
- package/dist/{music-3OF5C6X5.cjs → music-UAN7DXK4.cjs} +7 -7
- package/dist/{music-3OF5C6X5.cjs.map → music-UAN7DXK4.cjs.map} +1 -1
- package/dist/{sfx-MZJZXYY3.cjs → sfx-EX4PUBMV.cjs} +8 -8
- package/dist/{sfx-MZJZXYY3.cjs.map → sfx-EX4PUBMV.cjs.map} +1 -1
- package/dist/{sfx-S37DDC66.js → sfx-U3GM2MED.js} +3 -3
- package/dist/{sfx-S37DDC66.js.map → sfx-U3GM2MED.js.map} +1 -1
- package/dist/three.cjs +6 -6
- package/dist/three.d.cts +2 -2
- package/dist/three.d.ts +2 -2
- package/dist/three.js +2 -2
- package/dist/{types-SS51lP6O.d.ts → types-YmUaViL1.d.cts} +40 -6
- package/dist/{types-SS51lP6O.d.cts → types-YmUaViL1.d.ts} +40 -6
- package/docs/dsl.md +58 -5
- package/llms-full.txt +196 -15
- package/package.json +3 -1
- package/dist/Composition-6JMXWNVV.cjs +0 -14
- package/dist/Composition-MLBHYYFF.js +0 -5
- package/dist/chunk-ANO5R2E6.cjs.map +0 -1
- package/dist/chunk-DKGG7WD4.js.map +0 -1
- package/dist/chunk-JW67MDHQ.cjs.map +0 -1
- package/dist/chunk-SG3Y66FN.js.map +0 -1
- package/dist/chunk-UQBGW5DO.cjs.map +0 -1
- package/dist/chunk-UXDR3ZDU.js.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
3
|
+
var chunkFFYA3UBU_cjs = require('./chunk-FFYA3UBU.cjs');
|
|
4
|
+
var chunkNO26HWR7_cjs = require('./chunk-NO26HWR7.cjs');
|
|
5
|
+
var chunkWTRKDIKH_cjs = require('./chunk-WTRKDIKH.cjs');
|
|
6
6
|
var PIXI = require('pixi.js');
|
|
7
7
|
var gsap = require('gsap');
|
|
8
8
|
var PixiPlugin = require('gsap/PixiPlugin');
|
|
@@ -85,6 +85,85 @@ async function loadAssetBundle(assets, audioContext) {
|
|
|
85
85
|
return await PIXI.Assets.loadBundle("pixi-effects");
|
|
86
86
|
}
|
|
87
87
|
|
|
88
|
+
// src/core/audioRemap.ts
|
|
89
|
+
function gainAt(a, u) {
|
|
90
|
+
let prevT = a.start, prevV = a.initialVolume ?? 1;
|
|
91
|
+
if (u <= prevT) return prevV;
|
|
92
|
+
for (const kf of a.volumeKeyframes ?? []) {
|
|
93
|
+
if (u <= kf.time) return kf.time === prevT ? kf.value : prevV + (kf.value - prevV) * ((u - prevT) / (kf.time - prevT));
|
|
94
|
+
prevT = kf.time;
|
|
95
|
+
prevV = kf.value;
|
|
96
|
+
}
|
|
97
|
+
return prevV;
|
|
98
|
+
}
|
|
99
|
+
var CELL = 1 / 1e3;
|
|
100
|
+
function resampleThrough(a, left, right, srcRate, outRate, total) {
|
|
101
|
+
const nCell = Math.ceil(total / CELL) + 2;
|
|
102
|
+
const U = new Float64Array(nCell);
|
|
103
|
+
let first = -1, last = -1;
|
|
104
|
+
for (let k = 0; k < nCell; k++) {
|
|
105
|
+
const u = a.warp ? a.warp(k * CELL) : k * CELL;
|
|
106
|
+
U[k] = u;
|
|
107
|
+
if (Number.isFinite(u) && u >= a.start && u < a.end) {
|
|
108
|
+
if (first < 0) first = k;
|
|
109
|
+
last = k;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
if (first < 0) return null;
|
|
113
|
+
const lo = Math.max(0, (first - 1) * CELL), hi = Math.min(total, (last + 2) * CELL);
|
|
114
|
+
const n = Math.max(1, Math.ceil((hi - lo) * outRate));
|
|
115
|
+
const L = new Float32Array(n), R = new Float32Array(n);
|
|
116
|
+
const dur = left.length / srcRate;
|
|
117
|
+
let prevPos = NaN;
|
|
118
|
+
for (let i = 0; i < n; i++) {
|
|
119
|
+
const T = lo + i / outRate;
|
|
120
|
+
const x = T / CELL, k = Math.min(Math.floor(x), nCell - 2), f = x - k;
|
|
121
|
+
const u0 = U[k], u1 = U[k + 1];
|
|
122
|
+
if (!(Number.isFinite(u0) && Number.isFinite(u1))) {
|
|
123
|
+
prevPos = NaN;
|
|
124
|
+
continue;
|
|
125
|
+
}
|
|
126
|
+
const u = u0 * (1 - f) + u1 * f;
|
|
127
|
+
if (u < a.start || u >= a.end) {
|
|
128
|
+
prevPos = NaN;
|
|
129
|
+
continue;
|
|
130
|
+
}
|
|
131
|
+
const raw = a.sourceMap ? a.sourceMap(u) : u - a.start;
|
|
132
|
+
let pos = raw;
|
|
133
|
+
if (a.loop) pos = (pos % dur + dur) % dur;
|
|
134
|
+
const rate = Number.isNaN(prevPos) ? 1 : Math.abs(raw - prevPos) * outRate;
|
|
135
|
+
prevPos = raw;
|
|
136
|
+
if (pos < 0 || pos >= dur) continue;
|
|
137
|
+
const g = gainAt(a, u) * Math.min(1, rate / 0.02);
|
|
138
|
+
const sp = pos * srcRate, j = Math.floor(sp), fr = sp - j, j1 = Math.min(j + 1, left.length - 1);
|
|
139
|
+
L[i] = (left[j] * (1 - fr) + left[j1] * fr) * g;
|
|
140
|
+
R[i] = (right[j] * (1 - fr) + right[j1] * fr) * g;
|
|
141
|
+
}
|
|
142
|
+
return { L, R, at: lo };
|
|
143
|
+
}
|
|
144
|
+
function playSpan(a, total) {
|
|
145
|
+
if (!a.warp) return { start: a.start, end: a.end };
|
|
146
|
+
let first = -1, last = -1;
|
|
147
|
+
const n = Math.ceil(total / CELL) + 1;
|
|
148
|
+
for (let k = 0; k <= n; k++) {
|
|
149
|
+
const u = a.warp(k * CELL);
|
|
150
|
+
if (Number.isFinite(u) && u >= a.start && u < a.end) {
|
|
151
|
+
if (first < 0) first = k;
|
|
152
|
+
last = k;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
return first < 0 ? { start: total, end: total } : { start: first * CELL, end: (last + 1) * CELL };
|
|
156
|
+
}
|
|
157
|
+
function clockReach(a, total) {
|
|
158
|
+
let reach = -Infinity;
|
|
159
|
+
const n = Math.ceil(total / CELL) + 1;
|
|
160
|
+
for (let k = 0; k <= n; k++) {
|
|
161
|
+
const u = a.warp ? a.warp(k * CELL) : k * CELL;
|
|
162
|
+
if (Number.isFinite(u) && u > reach) reach = u;
|
|
163
|
+
}
|
|
164
|
+
return reach;
|
|
165
|
+
}
|
|
166
|
+
|
|
88
167
|
// src/core/AudioMixer.ts
|
|
89
168
|
async function mixdown(audios, totalDuration, sampleRate = 44100) {
|
|
90
169
|
if (audios.length === 0) return null;
|
|
@@ -106,6 +185,18 @@ async function mixdown(audios, totalDuration, sampleRate = 44100) {
|
|
|
106
185
|
for (const a of audios) {
|
|
107
186
|
const buffer = bufferOf(a);
|
|
108
187
|
if (!buffer) continue;
|
|
188
|
+
if (a.warp || a.sourceMap) {
|
|
189
|
+
const r = resampleThrough(a, buffer.getChannelData(0), buffer.numberOfChannels > 1 ? buffer.getChannelData(1) : buffer.getChannelData(0), buffer.sampleRate, sampleRate, totalDuration);
|
|
190
|
+
if (!r) continue;
|
|
191
|
+
const out = ctx.createBuffer(2, r.L.length, sampleRate);
|
|
192
|
+
out.getChannelData(0).set(r.L);
|
|
193
|
+
out.getChannelData(1).set(r.R);
|
|
194
|
+
const rendered = ctx.createBufferSource();
|
|
195
|
+
rendered.buffer = out;
|
|
196
|
+
rendered.connect(ctx.destination);
|
|
197
|
+
rendered.start(r.at);
|
|
198
|
+
continue;
|
|
199
|
+
}
|
|
109
200
|
const begin = Math.max(0, a.start);
|
|
110
201
|
const skipped = begin - a.start;
|
|
111
202
|
if (skipped > 0) {
|
|
@@ -144,7 +235,7 @@ function limitMix(buffer, audios) {
|
|
|
144
235
|
}
|
|
145
236
|
const peakAt = peakIndex / buffer.sampleRate;
|
|
146
237
|
if (peak > 1) {
|
|
147
|
-
const playing = audios.
|
|
238
|
+
const playing = audios.map((a) => ({ a, ...playSpan(a, buffer.duration) })).filter((s) => s.start <= peakAt && peakAt < s.end).map((s) => s.a.layer ?? "an audio layer");
|
|
148
239
|
console.warn(
|
|
149
240
|
`pixi-effects: the audio mix peaks at ${peak.toFixed(2)} (${(20 * Math.log10(peak)).toFixed(1)} dBFS) at ${peakAt.toFixed(2)}s, so it was limited (it would distort). Playing there: ${[...new Set(playing)].join(", ")}. Lower their volume.`
|
|
150
241
|
);
|
|
@@ -339,6 +430,13 @@ function measure(chans, sampleRate) {
|
|
|
339
430
|
};
|
|
340
431
|
}
|
|
341
432
|
function analyzeAudio(mix, sources, stats, movieDuration, opts = {}) {
|
|
433
|
+
const warped = /* @__PURE__ */ new Map();
|
|
434
|
+
sources = sources.map((s) => {
|
|
435
|
+
if (!s.warp) return s;
|
|
436
|
+
const moved = { ...s, ...playSpan(s, movieDuration) };
|
|
437
|
+
warped.set(moved, { localEnd: s.end, reach: clockReach(s, movieDuration) });
|
|
438
|
+
return moved;
|
|
439
|
+
});
|
|
342
440
|
if (!mix) {
|
|
343
441
|
return {
|
|
344
442
|
duration: movieDuration,
|
|
@@ -405,8 +503,15 @@ function analyzeAudio(mix, sources, stats, movieDuration, opts = {}) {
|
|
|
405
503
|
} else if (ownDb < INAUDIBLE_DB || peakDb < INAUDIBLE_DB) {
|
|
406
504
|
issues.push(`${layer} (${source}) is inaudible from ${s.start.toFixed(2)}s to ${s.end.toFixed(2)}s (its own peak ${ownDb} dBFS at volume ${topVolume}; mix peak there ${peakDb} dBFS) \u2014 check its volume`);
|
|
407
505
|
}
|
|
408
|
-
|
|
409
|
-
|
|
506
|
+
const clock = warped.get(s);
|
|
507
|
+
if (s.synth && s.start < movieDuration) {
|
|
508
|
+
if (clock) {
|
|
509
|
+
if (clock.reach < clock.localEnd - 1e-3) {
|
|
510
|
+
issues.push(`${layer} (${source}) is cut off: its composition's clock only reaches ${clock.reach.toFixed(2)}s (the sound is ${clock.localEnd.toFixed(2)}s long), because the clock stops or the movie ends first \u2014 give the layer a shorter duration, or let the clock run on`);
|
|
511
|
+
}
|
|
512
|
+
} else if (s.end > movieDuration + 1e-6) {
|
|
513
|
+
issues.push(`${layer} (${source}) is cut off by the end of the movie at ${movieDuration}s (it runs to ${s.end.toFixed(2)}s)`);
|
|
514
|
+
}
|
|
410
515
|
}
|
|
411
516
|
return { layer, source, start: s.start, end: s.end, peakDb, sound };
|
|
412
517
|
});
|
|
@@ -486,7 +591,21 @@ function inspectFonts(root) {
|
|
|
486
591
|
|
|
487
592
|
// src/core/scenes.ts
|
|
488
593
|
function namedScenes(rows) {
|
|
489
|
-
return rows.filter((r) => r.depth === 0 && r.type === "composition" && !/[#×]/.test(r.name) && r.end - r.start >= 1).map((r) => ({ name: r.name, start: r.start, end: r.end }));
|
|
594
|
+
return rows.filter((r) => !r.local && r.depth === 0 && r.type === "composition" && !/[#×]/.test(r.name) && r.end - r.start >= 1).map((r) => ({ name: r.name, start: r.start, end: r.end }));
|
|
595
|
+
}
|
|
596
|
+
|
|
597
|
+
// src/core/timeFilters.ts
|
|
598
|
+
function collectTimeFilters(seq, out = [], clock = null) {
|
|
599
|
+
for (const f of seq.filters ?? []) {
|
|
600
|
+
if (typeof f.setTime === "function") {
|
|
601
|
+
const tf = f;
|
|
602
|
+
out.push(clock ? { setTime: () => tf.setTime(clock()) } : tf);
|
|
603
|
+
}
|
|
604
|
+
}
|
|
605
|
+
if (seq.maskSequence) collectTimeFilters(seq.maskSequence, out, clock);
|
|
606
|
+
const own = seq.localClock?.() ?? clock;
|
|
607
|
+
for (const child of seq._children ?? []) collectTimeFilters(child, out, own);
|
|
608
|
+
return out;
|
|
490
609
|
}
|
|
491
610
|
|
|
492
611
|
// src/core/review.ts
|
|
@@ -510,11 +629,13 @@ var AT_HELP = "use seconds (3.5), a percentage (50%), a frame (f120) or a layer'
|
|
|
510
629
|
function resolveAtList(list, ctx) {
|
|
511
630
|
const { frameRate: fps, totalFrames, duration, rows } = ctx;
|
|
512
631
|
const out = [], used = /* @__PURE__ */ new Set();
|
|
513
|
-
const named = rows.flatMap((r) => r.parts && r.partNames ? r.partNames.map((name, i) => ({ name, start: r.parts[i].start, end: r.parts[i].end })) : [r]);
|
|
632
|
+
const named = rows.filter((r) => !r.local).flatMap((r) => r.parts && r.partNames ? r.partNames.map((name, i) => ({ name, start: r.parts[i].start, end: r.parts[i].end })) : [r]);
|
|
514
633
|
for (const raw of String(list).split(",").map((s) => s.trim()).filter(Boolean)) {
|
|
515
634
|
let frame, label, m;
|
|
516
635
|
if (m = raw.match(/^(.+)@(start|mid|end)$/)) {
|
|
517
636
|
const row = named.find((r) => r.name === m[1]);
|
|
637
|
+
const inside = row ? void 0 : rows.find((r) => r.local && r.name === m[1]);
|
|
638
|
+
if (inside) throw new Error(`--at "${raw}": layer "${m[1]}" is inside a time-remapped composition (${inside.local}), so its times are that composition's local seconds, not the movie's; name the composition (${inside.local.replace(/ (×.*|time keyframes)$/, "")}@${m[2]}) or give seconds`);
|
|
518
639
|
if (!row) throw new Error(`--at "${raw}": no layer named "${m[1]}" (names: ${named.slice(0, 40).map((r) => r.name).join(", ")}${named.length > 40 ? ", \u2026" : ""})`);
|
|
519
640
|
const t = m[2] === "start" ? row.start : m[2] === "mid" ? (row.start + row.end) / 2 : row.end - 1 / fps;
|
|
520
641
|
frame = Math.round(t * fps);
|
|
@@ -594,7 +715,7 @@ var DEFAULTS = { samples: 8, shutter: 0.5 };
|
|
|
594
715
|
function resolveMotionBlur(spec, where) {
|
|
595
716
|
if (spec === void 0 || spec === null || spec === false) return null;
|
|
596
717
|
const o = spec === true ? {} : typeof spec === "number" ? { samples: spec } : spec;
|
|
597
|
-
if (typeof spec === "object")
|
|
718
|
+
if (typeof spec === "object") chunkWTRKDIKH_cjs.warnUnknownOptions(`${where} motionBlur`, o, ["samples", "shutter"]);
|
|
598
719
|
const samples = o.samples ?? DEFAULTS.samples, shutter = o.shutter ?? DEFAULTS.shutter;
|
|
599
720
|
if (!(Number.isInteger(samples) && samples >= 2 && samples <= 64)) throw new Error(`pixi-effects: ${where}: motionBlur samples must be a whole number from 2 to 64, got ${samples}`);
|
|
600
721
|
if (!(Number.isFinite(shutter) && shutter > 0 && shutter <= 1)) throw new Error(`pixi-effects: ${where}: motionBlur shutter must be a fraction of the frame time above 0 and up to 1 (0.5 is a 180\xB0 shutter), got ${shutter}`);
|
|
@@ -611,7 +732,7 @@ function resolveRange(range2, ctx) {
|
|
|
611
732
|
if (range2 === void 0) return { fromFrame: 0, toFrame: totalFrames, fromSec: 0, toSec: duration, partial: false };
|
|
612
733
|
let from, to;
|
|
613
734
|
if (typeof range2 === "string") {
|
|
614
|
-
const rows = (ctx.rows ?? []).filter((r) => r.depth === 0).flatMap((r) => r.parts && r.partNames ? r.partNames.map((name, i) => ({ name, start: r.parts[i].start, end: r.parts[i].end })) : [r]);
|
|
735
|
+
const rows = (ctx.rows ?? []).filter((r) => r.depth === 0 && !r.local).flatMap((r) => r.parts && r.partNames ? r.partNames.map((name, i) => ({ name, start: r.parts[i].start, end: r.parts[i].end })) : [r]);
|
|
615
736
|
const row = rows.find((r) => r.name === range2);
|
|
616
737
|
if (!row) throw new Error(`pixi-effects: render({ range: "${range2}" }): no layer named "${range2}" at the top level (names: ${rows.slice(0, 40).map((r) => r.name).join(", ") || "none"}${rows.length > 40 ? ", \u2026" : ""})`);
|
|
617
738
|
from = row.start;
|
|
@@ -1157,7 +1278,8 @@ function expandTransitions(spec) {
|
|
|
1157
1278
|
}
|
|
1158
1279
|
const transitions = out.transitions;
|
|
1159
1280
|
const sequences = out.sequences ?? [];
|
|
1160
|
-
const
|
|
1281
|
+
const remap = out.duration !== void 0 ? chunkNO26HWR7_cjs.timeRemapOf(out) : null;
|
|
1282
|
+
const parentDuration = remap ? chunkNO26HWR7_cjs.contentLength(remap, out.duration) : out.duration ?? Infinity;
|
|
1161
1283
|
const compW = out.width;
|
|
1162
1284
|
const compH = out.height;
|
|
1163
1285
|
const threeDByName = new Set(sequences.filter((s) => s.name && s.threeD).map((s) => s.name));
|
|
@@ -1225,16 +1347,16 @@ function expandTransitions(spec) {
|
|
|
1225
1347
|
if (toUses > 1) {
|
|
1226
1348
|
throw new Error(`pixi-effects: ${tag} sequence "${t.to}" is used as \`to\` in more than one transition`);
|
|
1227
1349
|
}
|
|
1228
|
-
const tStart =
|
|
1350
|
+
const tStart = chunkNO26HWR7_cjs.resolveAt(t.at, parentDuration);
|
|
1229
1351
|
const tEnd = tStart + t.duration;
|
|
1230
1352
|
const fromSeq = fromEntry.seq;
|
|
1231
|
-
const fromStart =
|
|
1353
|
+
const fromStart = chunkNO26HWR7_cjs.resolveAt(fromSeq.at, parentDuration);
|
|
1232
1354
|
const fromEnd = fromStart + (fromSeq.duration ?? parentDuration);
|
|
1233
1355
|
if (tStart < fromStart - EPS || tEnd > fromEnd + EPS) {
|
|
1234
1356
|
throw new Error(`pixi-effects: ${tag} window [${tStart}, ${tEnd}] is not covered by \`from\` "${t.from}" (lives [${fromStart}, ${fromEnd}], so it ends at ${fromEnd})`);
|
|
1235
1357
|
}
|
|
1236
1358
|
const toSeq = toEntry.seq;
|
|
1237
|
-
const toStart =
|
|
1359
|
+
const toStart = chunkNO26HWR7_cjs.resolveAt(toSeq.at, parentDuration);
|
|
1238
1360
|
const toEnd = toStart + (toSeq.duration ?? parentDuration);
|
|
1239
1361
|
if (tStart < toStart - EPS || tEnd > toEnd + EPS) {
|
|
1240
1362
|
throw new Error(`pixi-effects: ${tag} window [${tStart}, ${tEnd}] is not covered by \`to\` "${t.to}" (lives [${toStart}, ${toEnd}], so it starts at ${toStart})`);
|
|
@@ -1548,9 +1670,10 @@ function inspectScene(root, frame, time, canvas, opts = {}) {
|
|
|
1548
1670
|
const scaledToNothing = /* @__PURE__ */ new Set();
|
|
1549
1671
|
const walk2 = (comp, prefix, insideThreeD, parentVisible, parentScene, parentMoving = false, parentZero = false) => {
|
|
1550
1672
|
const blending = /* @__PURE__ */ new Set();
|
|
1673
|
+
const now = comp.childTime(time);
|
|
1551
1674
|
for (const w of transitionWindowsOf(comp.spec)) {
|
|
1552
|
-
const start =
|
|
1553
|
-
if (
|
|
1675
|
+
const start = comp.childBase + w.start, end = comp.childBase + w.end;
|
|
1676
|
+
if (now >= start - 1e-9 && now <= end + 1e-9) {
|
|
1554
1677
|
blending.add(w.from);
|
|
1555
1678
|
blending.add(w.to);
|
|
1556
1679
|
}
|
|
@@ -1574,9 +1697,9 @@ function inspectScene(root, frame, time, canvas, opts = {}) {
|
|
|
1574
1697
|
onCanvas = inter === 0 && area > 0 ? "none" : inter >= area - 1e-6 ? "full" : "partial";
|
|
1575
1698
|
if (area === 0) onCanvas = "none";
|
|
1576
1699
|
}
|
|
1577
|
-
const keys =
|
|
1700
|
+
const keys = chunkNO26HWR7_cjs.collectPropKeys(seq.spec);
|
|
1578
1701
|
const carried = carriers.some((c) => {
|
|
1579
|
-
const k =
|
|
1702
|
+
const k = chunkNO26HWR7_cjs.collectPropKeys(c.spec);
|
|
1580
1703
|
return (c.spec.keyframes ?? []).length > 0 && (k.has("x") || k.has("y") || k.has("rotation") || k.has("scale"));
|
|
1581
1704
|
});
|
|
1582
1705
|
const moving = parentMoving || carried || (seq.spec.keyframes ?? []).length > 0 && (keys.has("x") || keys.has("y"));
|
|
@@ -1597,7 +1720,7 @@ function inspectScene(root, frame, time, canvas, opts = {}) {
|
|
|
1597
1720
|
const group = parentScene ?? (name !== void 0 && blending.has(name) ? name : void 0);
|
|
1598
1721
|
if (group) scene.set(info, group);
|
|
1599
1722
|
if (zero || seq.showsNothingYet) scaledToNothing.add(info);
|
|
1600
|
-
if (seq instanceof
|
|
1723
|
+
if (seq instanceof chunkFFYA3UBU_cjs.CompositionSequence) walk2(seq, prefix + label + "/", insideThreeD || threeD, visible, group, moving, zero);
|
|
1601
1724
|
});
|
|
1602
1725
|
};
|
|
1603
1726
|
walk2(root, "", false, true);
|
|
@@ -1651,23 +1774,26 @@ function detailOf(seq) {
|
|
|
1651
1774
|
if (s.music && typeof s.music === "object") return "music";
|
|
1652
1775
|
return void 0;
|
|
1653
1776
|
}
|
|
1654
|
-
function walk(comp, parentStart, parentEnd, depth, prefix, rows, transitions) {
|
|
1777
|
+
function walk(comp, parentStart, parentEnd, depth, prefix, rows, transitions, local) {
|
|
1655
1778
|
const entries = [];
|
|
1656
1779
|
comp._children.forEach((seq, i) => {
|
|
1657
1780
|
const name = seq.spec.name ?? `${seq.spec.type}#${i}`;
|
|
1658
1781
|
const start = parentStart + (seq.at ?? 0);
|
|
1659
1782
|
const end = Math.min(parentEnd, seq.duration !== void 0 ? start + seq.duration : parentEnd);
|
|
1660
1783
|
const span = end - start;
|
|
1661
|
-
const keys = (seq.spec.keyframes ?? []).map((kf) => round(start +
|
|
1662
|
-
const row = { path: prefix + name, name, type: seq.spec.type, depth, start: round(start), end: round(end), keys, detail: detailOf(seq) };
|
|
1784
|
+
const keys = (seq.spec.keyframes ?? []).map((kf) => round(start + chunkNO26HWR7_cjs.resolveAt(kf.at, span))).sort((a, b) => a - b).slice(0, MAX_KEYS);
|
|
1785
|
+
const row = { path: prefix + name, name, type: seq.spec.type, depth, start: round(start), end: round(end), keys, detail: detailOf(seq), ...local ? { local } : {} };
|
|
1663
1786
|
const inner = [];
|
|
1664
|
-
const isComp = seq instanceof
|
|
1665
|
-
if (isComp)
|
|
1787
|
+
const isComp = seq instanceof chunkFFYA3UBU_cjs.CompositionSequence;
|
|
1788
|
+
if (isComp) {
|
|
1789
|
+
const label = seq.remapLabel();
|
|
1790
|
+
walk(seq, label ? 0 : start, label ? seq.contentSpan : end, depth + 1, prefix + name + "/", inner, transitions, label ? `${name} ${label}` : local);
|
|
1791
|
+
}
|
|
1666
1792
|
entries.push({ row, inner, groupable: !isComp });
|
|
1667
1793
|
});
|
|
1668
1794
|
rows.push(...groupFamilies(entries));
|
|
1669
1795
|
for (const w of transitionWindowsOf(comp.spec)) {
|
|
1670
|
-
transitions.push({ from: prefix + w.from, to: prefix + w.to, start: round(parentStart + w.start), end: round(parentStart + w.end) });
|
|
1796
|
+
transitions.push({ from: prefix + w.from, to: prefix + w.to, start: round(parentStart + w.start), end: round(parentStart + w.end), ...local ? { local } : {} });
|
|
1671
1797
|
}
|
|
1672
1798
|
}
|
|
1673
1799
|
function groupFamilies(entries) {
|
|
@@ -1708,7 +1834,8 @@ function groupFamilies(entries) {
|
|
|
1708
1834
|
function collectTimeline(root, duration) {
|
|
1709
1835
|
const rows = [];
|
|
1710
1836
|
const transitions = [];
|
|
1711
|
-
|
|
1837
|
+
const label = root.remapLabel();
|
|
1838
|
+
walk(root, 0, label ? root.contentSpan : duration, 0, "", rows, transitions, label ? `movie ${label}` : void 0);
|
|
1712
1839
|
return { duration, rows, transitions };
|
|
1713
1840
|
}
|
|
1714
1841
|
var COLORS = {
|
|
@@ -1741,12 +1868,12 @@ function timelineSvg(data, opts = {}) {
|
|
|
1741
1868
|
}
|
|
1742
1869
|
if (Math.abs(data.duration % step) > 1e-9) out.push(`<text class="tick" x="${num(x(data.duration))}" y="${TOP - 12}" text-anchor="middle">${num(data.duration)} s</text>`);
|
|
1743
1870
|
for (const t of data.transitions) {
|
|
1744
|
-
out.push(`<g><title>transition ${esc(t.from)} \u2192 ${esc(t.to)} (${num(t.start)}\u2013${num(t.end)} s)</title><rect class="transition" x="${num(x(t.start))}" y="${TOP - 4}" width="${num(Math.max(2, x(t.end) - x(t.start)))}" height="${H - TOP - PAD + 4}"/></g>`);
|
|
1871
|
+
out.push(`<g><title>transition ${esc(t.from)} \u2192 ${esc(t.to)} (${num(t.start)}\u2013${num(t.end)} s${t.local ? `, local time of ${esc(t.local)}` : ""})</title><rect class="transition" x="${num(x(t.start))}" y="${TOP - 4}" width="${num(Math.max(2, x(t.end) - x(t.start)))}" height="${H - TOP - PAD + 4}"/></g>`);
|
|
1745
1872
|
}
|
|
1746
1873
|
data.rows.forEach((r, i) => {
|
|
1747
1874
|
const y = TOP + i * ROW;
|
|
1748
1875
|
const color = COLORS[r.type] ?? "#9aa7b8";
|
|
1749
|
-
const tip = `${r.path} \xB7 ${r.type} \xB7 ${num(r.start)}\u2013${num(r.end)} s (${num(r.end - r.start)} s)${r.keys.length ? ` \xB7 ${r.keys.length} keyframe${r.keys.length > 1 ? "s" : ""}` : ""}${r.detail ? ` \xB7 ${r.detail}` : ""}`;
|
|
1876
|
+
const tip = `${r.path} \xB7 ${r.type} \xB7 ${num(r.start)}\u2013${num(r.end)} s (${num(r.end - r.start)} s)${r.keys.length ? ` \xB7 ${r.keys.length} keyframe${r.keys.length > 1 ? "s" : ""}` : ""}${r.detail ? ` \xB7 ${r.detail}` : ""}${r.local ? ` \xB7 local time of ${r.local}` : ""}`;
|
|
1750
1877
|
out.push(`<g class="row" data-start="${num(r.start)}"><title>${esc(tip)}</title>`);
|
|
1751
1878
|
out.push(`<rect class="band" x="${PAD}" y="${y}" width="${LABEL + CHART}" height="${ROW}" ${i % 2 ? 'fill-opacity=".05"' : 'fill-opacity="0"'}/>`);
|
|
1752
1879
|
if (withLabels) out.push(`<text class="label" x="${PAD + 6 + r.depth * 14}" y="${y + 15}">${esc(r.name)}</text>`);
|
|
@@ -1940,7 +2067,7 @@ function normalizeStops(raw, duration, frameRate) {
|
|
|
1940
2067
|
console.warn(`pixi-effects: stops[${i}] ${JSON.stringify(r)} is not a time in seconds (or { at, page?, notes?, advance?, pdf? }); ignored`);
|
|
1941
2068
|
return;
|
|
1942
2069
|
}
|
|
1943
|
-
if (typeof r === "object")
|
|
2070
|
+
if (typeof r === "object") chunkWTRKDIKH_cjs.warnUnknownOptions(`stops[${i}]`, r, KEYS);
|
|
1944
2071
|
const at = spec.at < 0 ? duration + spec.at : spec.at;
|
|
1945
2072
|
if (at < -1e-9 || at > duration + 1e-9) {
|
|
1946
2073
|
console.warn(`pixi-effects: stops[${i}] at ${spec.at} s is outside the movie (0 to ${duration} s); ignored`);
|
|
@@ -2094,6 +2221,15 @@ var Movie = class {
|
|
|
2094
2221
|
background = "#000000";
|
|
2095
2222
|
_audioContext = null;
|
|
2096
2223
|
_rootSequence = null;
|
|
2224
|
+
/** The filters that take the time of the frame they draw (`grain`), collected once after the build. */
|
|
2225
|
+
_timeFilters = [];
|
|
2226
|
+
/** While a motion-blurred frame is exposed: the frame's own time, so all its sub-frames share one grain frame (and not the playhead's). */
|
|
2227
|
+
_nominalTime = null;
|
|
2228
|
+
_feedTimeFilters() {
|
|
2229
|
+
if (!this._timeFilters.length) return;
|
|
2230
|
+
const t = this._nominalTime ?? this._timeOf(this.currentFrame);
|
|
2231
|
+
for (const f of this._timeFilters) f.setTime(t);
|
|
2232
|
+
}
|
|
2097
2233
|
_rootContainer = null;
|
|
2098
2234
|
_raf = null;
|
|
2099
2235
|
/** What went into the mix, and its peak before limiting — kept for inspectAudio(). */
|
|
@@ -2161,7 +2297,7 @@ var Movie = class {
|
|
|
2161
2297
|
return this._audioContext;
|
|
2162
2298
|
}
|
|
2163
2299
|
async init(options = {}) {
|
|
2164
|
-
|
|
2300
|
+
chunkWTRKDIKH_cjs.warnUnknownOptions("movie.init()", options, ["width", "height", "duration", "frameRate", "background", "canvas", "assets", "composition", "poster", "motionBlur", "loader"]);
|
|
2165
2301
|
this._initState = "pending";
|
|
2166
2302
|
try {
|
|
2167
2303
|
this.width = options.width ?? 1920;
|
|
@@ -2210,7 +2346,7 @@ var Movie = class {
|
|
|
2210
2346
|
height: options.composition.height ?? this.height,
|
|
2211
2347
|
duration: options.composition.duration ?? this.duration
|
|
2212
2348
|
} : void 0;
|
|
2213
|
-
await
|
|
2349
|
+
await chunkNO26HWR7_cjs.ensureFilterLibrary(seededComposition);
|
|
2214
2350
|
const userComposition = seededComposition ? expandTransitions(seededComposition) : void 0;
|
|
2215
2351
|
const rootSeqSpec = {
|
|
2216
2352
|
type: "composition",
|
|
@@ -2220,11 +2356,12 @@ var Movie = class {
|
|
|
2220
2356
|
...userComposition
|
|
2221
2357
|
};
|
|
2222
2358
|
if (userComposition) carryTransitionWindows(userComposition, rootSeqSpec);
|
|
2223
|
-
const composition = new
|
|
2359
|
+
const composition = new chunkFFYA3UBU_cjs.CompositionSequence(rootSeqSpec, null, rootShape);
|
|
2224
2360
|
await composition.build();
|
|
2225
2361
|
this._rootSequence = composition;
|
|
2226
2362
|
if (composition.target) root.addChild(composition.target);
|
|
2227
2363
|
composition.bindTimeline(this.timeline);
|
|
2364
|
+
this._timeFilters = collectTimeFilters(composition);
|
|
2228
2365
|
const audios = [];
|
|
2229
2366
|
composition.collectAudio(audios, 0);
|
|
2230
2367
|
if (audios.length > 0) {
|
|
@@ -2293,15 +2430,17 @@ var Movie = class {
|
|
|
2293
2430
|
async _awaitVideoFrames(t = this._timeOf(this.currentFrame)) {
|
|
2294
2431
|
if (!this._rootSequence) return;
|
|
2295
2432
|
const collected = [];
|
|
2296
|
-
|
|
2433
|
+
const clocks = /* @__PURE__ */ new Map();
|
|
2434
|
+
collectVideoSequences(this._rootSequence, collected, clocks);
|
|
2297
2435
|
await Promise.all(collected.map((v) => {
|
|
2298
|
-
|
|
2436
|
+
if (v.selfTimed) return v.awaitFrameAt(t);
|
|
2437
|
+
const local = (clocks.get(v)?.() ?? t) - (v.absoluteStart ?? v.at);
|
|
2299
2438
|
if (local < 0 || local > (v.duration ?? 0)) return Promise.resolve();
|
|
2300
2439
|
return v.awaitFrameAt(local);
|
|
2301
2440
|
}));
|
|
2302
2441
|
}
|
|
2303
2442
|
async snapshot(frame = this.currentFrame, opts = {}) {
|
|
2304
|
-
|
|
2443
|
+
chunkWTRKDIKH_cjs.warnUnknownOptions("movie.snapshot()", opts, ["scale", "type", "as", "motionBlur"]);
|
|
2305
2444
|
this._requireReady("snapshot");
|
|
2306
2445
|
return this._captureFrame(clampFrame(frame, this.totalFrames), { scale: opts.scale ?? 1, type: opts.type ?? "image/png", as: opts.as ?? "blob", motionBlur: opts.motionBlur });
|
|
2307
2446
|
}
|
|
@@ -2330,7 +2469,7 @@ var Movie = class {
|
|
|
2330
2469
|
return encodeCanvas(out, o.type, o.as, o.quality);
|
|
2331
2470
|
}
|
|
2332
2471
|
async stopImages(opts = {}) {
|
|
2333
|
-
|
|
2472
|
+
chunkWTRKDIKH_cjs.warnUnknownOptions("movie.stopImages()", opts, ["which", "pick", "scale", "type", "quality", "as", "motionBlur", "pdf", "onImage"]);
|
|
2334
2473
|
this._requireReady("stopImages");
|
|
2335
2474
|
if (this.stops.length === 0) return [];
|
|
2336
2475
|
const picks = pictureStops(this.stops, { which: opts.which, pick: opts.pick, pdf: opts.pdf });
|
|
@@ -2362,7 +2501,7 @@ var Movie = class {
|
|
|
2362
2501
|
* animation. `issues` says which stop, which page and what to do; leaves the playhead where it was.
|
|
2363
2502
|
*/
|
|
2364
2503
|
async inspectStops(opts = {}) {
|
|
2365
|
-
|
|
2504
|
+
chunkWTRKDIKH_cjs.warnUnknownOptions("movie.inspectStops()", opts, ["lookback", "tolerance"]);
|
|
2366
2505
|
this._requireReady("inspectStops");
|
|
2367
2506
|
const out = { stops: [], issues: [] };
|
|
2368
2507
|
if (this.stops.length === 0) return out;
|
|
@@ -2396,7 +2535,7 @@ var Movie = class {
|
|
|
2396
2535
|
* JPEG at the canvas size. Needs `composition.stops`. A transparent background comes out black: give the movie a `background`.
|
|
2397
2536
|
*/
|
|
2398
2537
|
async exportPDF(opts = {}) {
|
|
2399
|
-
|
|
2538
|
+
chunkWTRKDIKH_cjs.warnUnknownOptions("movie.exportPDF()", opts, ["which", "pick", "scale", "quality", "title", "motionBlur", "onImage"]);
|
|
2400
2539
|
this._requireReady("exportPDF");
|
|
2401
2540
|
if (this.stops.length === 0) throw new Error("pixi-effects: movie.exportPDF(): this movie has no stops, so there are no pages; add `stops` to the composition (or build it with deck())");
|
|
2402
2541
|
const scale = opts.scale ?? 1;
|
|
@@ -2419,7 +2558,7 @@ var Movie = class {
|
|
|
2419
2558
|
return new Blob([buildPdf(pages, { title: opts.title })], { type: "application/pdf" });
|
|
2420
2559
|
}
|
|
2421
2560
|
async onionSkin(opts = {}) {
|
|
2422
|
-
|
|
2561
|
+
chunkWTRKDIKH_cjs.warnUnknownOptions("movie.onionSkin()", opts, ["from", "to", "count", "scale", "as", "motionBlur"]);
|
|
2423
2562
|
this._requireReady("onionSkin");
|
|
2424
2563
|
const from = opts.from ?? 0, to = opts.to ?? this.duration, count = opts.count ?? 8, scale = opts.scale ?? 1;
|
|
2425
2564
|
if (!(Number.isInteger(count) && count >= 1 && count <= 64)) throw new Error(`pixi-effects: movie.onionSkin(): count must be a whole number from 1 to 64, got ${count}`);
|
|
@@ -2450,7 +2589,7 @@ var Movie = class {
|
|
|
2450
2589
|
return encodeCanvas(out, "image/png", opts.as ?? "blob");
|
|
2451
2590
|
}
|
|
2452
2591
|
async contactSheet(opts = {}) {
|
|
2453
|
-
|
|
2592
|
+
chunkWTRKDIKH_cjs.warnUnknownOptions("movie.contactSheet()", opts, ["frames", "times", "count", "columns", "cellWidth", "as", "motionBlur"]);
|
|
2454
2593
|
this._requireReady("contactSheet");
|
|
2455
2594
|
const mb = this._blurFor(opts.motionBlur, "movie.contactSheet()");
|
|
2456
2595
|
const blurred = mb ? this._blurCanvas() : null;
|
|
@@ -2487,7 +2626,7 @@ var Movie = class {
|
|
|
2487
2626
|
* the canvas, cut by an edge, empty, or overlapping other text. Seeks there and stays there.
|
|
2488
2627
|
*/
|
|
2489
2628
|
async inspect(frame = this.currentFrame, opts = { layers: "visible" }) {
|
|
2490
|
-
|
|
2629
|
+
chunkWTRKDIKH_cjs.warnUnknownOptions("movie.inspect()", opts, ["layers"]);
|
|
2491
2630
|
this._requireReady("inspect");
|
|
2492
2631
|
const f = clampFrame(frame, this.totalFrames);
|
|
2493
2632
|
await this.gotoFrame(f, true);
|
|
@@ -2503,12 +2642,12 @@ var Movie = class {
|
|
|
2503
2642
|
}
|
|
2504
2643
|
/** The timeline as one self-contained HTML page (an inline SVG, no scripts): layers as bars on a time axis, ◆ keyframes, transition bands. Open it in a browser. */
|
|
2505
2644
|
timelineChart(opts = {}) {
|
|
2506
|
-
|
|
2645
|
+
chunkWTRKDIKH_cjs.warnUnknownOptions("movie.timelineChart()", opts, ["title"]);
|
|
2507
2646
|
return timelineHtml(this.timelineData(), opts);
|
|
2508
2647
|
}
|
|
2509
2648
|
/** Just the chart: one `<svg>` whose geometry is in `data-*` attributes (a viewer puts a playhead on it: `pixi-effects-view`). */
|
|
2510
2649
|
timelineSvg(opts = {}) {
|
|
2511
|
-
|
|
2650
|
+
chunkWTRKDIKH_cjs.warnUnknownOptions("movie.timelineSvg()", opts, ["chartWidth", "labels"]);
|
|
2512
2651
|
return timelineSvg(this.timelineData(), opts);
|
|
2513
2652
|
}
|
|
2514
2653
|
/**
|
|
@@ -2525,7 +2664,7 @@ var Movie = class {
|
|
|
2525
2664
|
* scene's first and last frame and a frame every 0.25 s), fonts and the sound. See `ReviewReport`. Page warnings are in `window.__logs`. The movie is left as it was.
|
|
2526
2665
|
*/
|
|
2527
2666
|
async review(opts = {}) {
|
|
2528
|
-
|
|
2667
|
+
chunkWTRKDIKH_cjs.warnUnknownOptions("movie.review()", opts, ["at", "strict"]);
|
|
2529
2668
|
this._requireReady("review");
|
|
2530
2669
|
const back = this.currentFrame, wasAtPoster = this._atPoster;
|
|
2531
2670
|
try {
|
|
@@ -2545,7 +2684,7 @@ var Movie = class {
|
|
|
2545
2684
|
return inspectFonts(this._rootSequence);
|
|
2546
2685
|
}
|
|
2547
2686
|
inspectAudio(opts = {}) {
|
|
2548
|
-
|
|
2687
|
+
chunkWTRKDIKH_cjs.warnUnknownOptions("movie.inspectAudio()", opts, ["window", "scenes"]);
|
|
2549
2688
|
this._requireReady("inspectAudio");
|
|
2550
2689
|
const scenes = opts.scenes ?? namedScenes(this.timelineData().rows);
|
|
2551
2690
|
return analyzeAudio(this.audioBuffer, this._audioSources, this._mixStats, this.duration, { ...opts, scenes });
|
|
@@ -2562,6 +2701,7 @@ var Movie = class {
|
|
|
2562
2701
|
if (!app?.renderer) return;
|
|
2563
2702
|
if (!this._synced) this._rootSequence?.syncFrame();
|
|
2564
2703
|
this._synced = false;
|
|
2704
|
+
this._feedTimeFilters();
|
|
2565
2705
|
PIXI.Culler.shared.cull(app.stage, app.renderer.screen, false);
|
|
2566
2706
|
app.renderer.render({ container: app.stage });
|
|
2567
2707
|
}
|
|
@@ -2578,6 +2718,7 @@ var Movie = class {
|
|
|
2578
2718
|
* the frame before (after a jump seek, a card whose children were animated showed a stale picture).
|
|
2579
2719
|
*/
|
|
2580
2720
|
_updateSpace(t = this._timeOf(this.currentFrame)) {
|
|
2721
|
+
this._feedTimeFilters();
|
|
2581
2722
|
if (!this._rootSequence || !this.app) return;
|
|
2582
2723
|
this._rootSequence.syncFrame();
|
|
2583
2724
|
this._synced = true;
|
|
@@ -2596,15 +2737,20 @@ var Movie = class {
|
|
|
2596
2737
|
const stage = this.app.canvas;
|
|
2597
2738
|
this._atPoster = false;
|
|
2598
2739
|
const times = blurTimes(frame, this.frameRate, mb, Math.max(0, this.duration - END_MARGIN));
|
|
2599
|
-
|
|
2600
|
-
|
|
2601
|
-
|
|
2602
|
-
|
|
2603
|
-
|
|
2604
|
-
|
|
2605
|
-
|
|
2606
|
-
|
|
2607
|
-
|
|
2740
|
+
this._nominalTime = this._timeOf(Math.max(0, Math.min(frame, this.totalFrames)));
|
|
2741
|
+
try {
|
|
2742
|
+
for (let k = 0; k < times.length; k++) {
|
|
2743
|
+
const t = times[k];
|
|
2744
|
+
this.timeline.time(t);
|
|
2745
|
+
await this._awaitVideoFrames(t);
|
|
2746
|
+
this._updateSpace(t);
|
|
2747
|
+
this._renderNow();
|
|
2748
|
+
if (k === 0) g.clearRect(0, 0, target.width, target.height);
|
|
2749
|
+
g.globalAlpha = 1 / (k + 1);
|
|
2750
|
+
g.drawImage(stage, 0, 0, target.width, target.height);
|
|
2751
|
+
}
|
|
2752
|
+
} finally {
|
|
2753
|
+
this._nominalTime = null;
|
|
2608
2754
|
}
|
|
2609
2755
|
g.globalAlpha = 1;
|
|
2610
2756
|
if (settle) await this._goto(frame);
|
|
@@ -2816,7 +2962,7 @@ var Movie = class {
|
|
|
2816
2962
|
return this.muted;
|
|
2817
2963
|
}
|
|
2818
2964
|
async render(options) {
|
|
2819
|
-
|
|
2965
|
+
chunkWTRKDIKH_cjs.warnUnknownOptions("movie.render()", options, ["format", "video", "audio", "motionBlur", "range", "scale", "draft"]);
|
|
2820
2966
|
try {
|
|
2821
2967
|
return await this._quietly(() => exportFrames(this, options));
|
|
2822
2968
|
} catch (err) {
|
|
@@ -2826,6 +2972,7 @@ var Movie = class {
|
|
|
2826
2972
|
}
|
|
2827
2973
|
async destroy() {
|
|
2828
2974
|
safeRun(() => this.pause());
|
|
2975
|
+
this._timeFilters = [];
|
|
2829
2976
|
safeRun(() => this._rootSequence?.destroy());
|
|
2830
2977
|
this._rootSequence = null;
|
|
2831
2978
|
safeRun(() => this.timeline?.kill());
|
|
@@ -2854,13 +3001,15 @@ function safeRun(fn) {
|
|
|
2854
3001
|
console.warn("pixi-effects: cleanup step threw, continuing:", e);
|
|
2855
3002
|
}
|
|
2856
3003
|
}
|
|
2857
|
-
function collectVideoSequences(seq, out) {
|
|
3004
|
+
function collectVideoSequences(seq, out, clocks, clock = null) {
|
|
2858
3005
|
if (typeof seq.awaitFrameAt === "function") {
|
|
2859
3006
|
out.push(seq);
|
|
3007
|
+
if (clock && clocks) clocks.set(seq, clock);
|
|
2860
3008
|
}
|
|
2861
|
-
if (seq.maskSequence) collectVideoSequences(seq.maskSequence, out);
|
|
3009
|
+
if (seq.maskSequence) collectVideoSequences(seq.maskSequence, out, clocks, clock);
|
|
3010
|
+
const own = seq.localClock?.() ?? clock;
|
|
2862
3011
|
for (const child of seq._children ?? []) {
|
|
2863
|
-
collectVideoSequences(child, out);
|
|
3012
|
+
collectVideoSequences(child, out, clocks, own);
|
|
2864
3013
|
}
|
|
2865
3014
|
}
|
|
2866
3015
|
var BY = ["chars", "words", "lines"];
|
|
@@ -2871,16 +3020,16 @@ function measureText(text, style = {}) {
|
|
|
2871
3020
|
return { width: m.width, height: m.height, lines: text.split("\n").length };
|
|
2872
3021
|
}
|
|
2873
3022
|
function splitText(text, style = {}, opts = {}) {
|
|
2874
|
-
|
|
3023
|
+
chunkWTRKDIKH_cjs.warnUnknownOptions("splitText()", opts, ["by", "x", "y", "align"]);
|
|
2875
3024
|
let by = opts.by ?? "chars";
|
|
2876
3025
|
if (!BY.includes(by)) {
|
|
2877
|
-
const g =
|
|
3026
|
+
const g = chunkWTRKDIKH_cjs.suggestName(String(by), BY);
|
|
2878
3027
|
console.warn(`pixi-effects: splitText(): by "${by}" is not one of ${BY.map((b) => `"${b}"`).join(", ")}${g ? ` \u2014 did you mean "${g}"?` : ""}; using "chars"`);
|
|
2879
3028
|
by = "chars";
|
|
2880
3029
|
}
|
|
2881
3030
|
let align = opts.align ?? "left";
|
|
2882
3031
|
if (!ALIGN.includes(align)) {
|
|
2883
|
-
const g =
|
|
3032
|
+
const g = chunkWTRKDIKH_cjs.suggestName(String(align), ALIGN);
|
|
2884
3033
|
console.warn(`pixi-effects: splitText(): align "${align}" is not one of ${ALIGN.join(", ")}${g ? ` \u2014 did you mean "${g}"?` : ""}; using "left"`);
|
|
2885
3034
|
align = "left";
|
|
2886
3035
|
}
|
|
@@ -2917,7 +3066,7 @@ function splitText(text, style = {}, opts = {}) {
|
|
|
2917
3066
|
// src/presets/kenBurns.ts
|
|
2918
3067
|
var KEN_BURNS_KEYS = ["asset", "name", "at", "duration", "fit", "ease", "motion", "origin", "zoom", "direction", "angle", "from", "to"];
|
|
2919
3068
|
function kenBurns(opts) {
|
|
2920
|
-
|
|
3069
|
+
chunkWTRKDIKH_cjs.warnUnknownOptions("kenBurns()", opts, KEN_BURNS_KEYS);
|
|
2921
3070
|
const {
|
|
2922
3071
|
asset,
|
|
2923
3072
|
name,
|
|
@@ -3027,14 +3176,14 @@ function clamp(v, lo, hi) {
|
|
|
3027
3176
|
return Math.max(lo, Math.min(hi, v));
|
|
3028
3177
|
}
|
|
3029
3178
|
function parseEase(name) {
|
|
3030
|
-
|
|
3179
|
+
chunkNO26HWR7_cjs.checkEase(name, "a preset");
|
|
3031
3180
|
return gsap.gsap.parseEase(name);
|
|
3032
3181
|
}
|
|
3033
3182
|
|
|
3034
3183
|
// src/presets/orbit.ts
|
|
3035
3184
|
var ORBIT_KEYS = ["duration", "degrees", "start", "radius", "center", "width", "height", "fov", "ease", "dollyZoom", "at", "name", "stepsPerSecond"];
|
|
3036
3185
|
function orbit(opts) {
|
|
3037
|
-
|
|
3186
|
+
chunkWTRKDIKH_cjs.warnUnknownOptions("orbit()", opts, ORBIT_KEYS);
|
|
3038
3187
|
const {
|
|
3039
3188
|
duration,
|
|
3040
3189
|
degrees,
|
|
@@ -3050,17 +3199,17 @@ function orbit(opts) {
|
|
|
3050
3199
|
throw new Error("pixi-effects: orbit() cannot combine `radius` with `dollyZoom` \u2014 the radius follows the animated fov");
|
|
3051
3200
|
}
|
|
3052
3201
|
const [cx, cy] = opts.center ?? [width / 2, height / 2];
|
|
3053
|
-
const fixedR = opts.radius ??
|
|
3202
|
+
const fixedR = opts.radius ?? chunkNO26HWR7_cjs.homeDistance(height, fov ?? chunkNO26HWR7_cjs.DEFAULT_FOV);
|
|
3054
3203
|
const start = opts.start ?? -degrees / 2;
|
|
3055
3204
|
const steps = Math.max(1, Math.round(duration * stepsPerSecond));
|
|
3056
3205
|
const easeFn = parseEase(ease);
|
|
3057
3206
|
const dollyEase = dolly ? parseEase(dolly.ease ?? ease) : null;
|
|
3058
3207
|
const pos = (i) => {
|
|
3059
3208
|
const p = i / steps;
|
|
3060
|
-
const a = (start + degrees * easeFn(p)) *
|
|
3209
|
+
const a = (start + degrees * easeFn(p)) * chunkNO26HWR7_cjs.DEG;
|
|
3061
3210
|
if (!dolly) return { x: cx + fixedR * Math.sin(a), z: fixedR * Math.cos(a) };
|
|
3062
3211
|
const f = dolly.from + (dolly.to - dolly.from) * dollyEase(p);
|
|
3063
|
-
const R =
|
|
3212
|
+
const R = chunkNO26HWR7_cjs.homeDistance(height, f);
|
|
3064
3213
|
return { x: cx + R * Math.sin(a), z: R * Math.cos(a), fov: f };
|
|
3065
3214
|
};
|
|
3066
3215
|
const keyframes = [];
|
|
@@ -3092,7 +3241,7 @@ var KEYS2 = ["count", "at", "emit", "life", "area", "angle", "speed", "gravity",
|
|
|
3092
3241
|
var SHAPES = ["circle", "rect", "star"];
|
|
3093
3242
|
var MAX_KEYFRAMES = 3e4;
|
|
3094
3243
|
function particles(opts) {
|
|
3095
|
-
|
|
3244
|
+
chunkWTRKDIKH_cjs.warnUnknownOptions("particles()", opts, KEYS2);
|
|
3096
3245
|
const { count, at = 0, emit = 0, gravity = 0, wind = 0, drag = 0, sway, fade, colors = ["#ffffff"], shape = "circle", seed = 0, name = "particle", template, sampleRate = 20 } = opts;
|
|
3097
3246
|
if (!(Number.isInteger(count) && count > 0)) throw new Error(`particles(): count must be a whole number of particles (at least 1), got ${count}`);
|
|
3098
3247
|
const life = range("life", opts.life, 1e-6);
|
|
@@ -3100,7 +3249,7 @@ function particles(opts) {
|
|
|
3100
3249
|
if (!(Number.isFinite(emit) && emit >= 0)) throw new Error(`particles(): emit must be a number of seconds >= 0, got ${emit}`);
|
|
3101
3250
|
if (!(Number.isFinite(sampleRate) && sampleRate > 0)) throw new Error(`particles(): sampleRate must be a positive number (samples per second), got ${sampleRate}`);
|
|
3102
3251
|
if (!SHAPES.includes(shape)) {
|
|
3103
|
-
const g =
|
|
3252
|
+
const g = chunkWTRKDIKH_cjs.suggestName(String(shape), SHAPES);
|
|
3104
3253
|
throw new Error(`particles(): shape "${shape}" is not one of ${SHAPES.map((s) => `"${s}"`).join(", ")}${g ? `; did you mean "${g}"?` : ""}`);
|
|
3105
3254
|
}
|
|
3106
3255
|
const angle = range("angle", opts.angle ?? [0, 360], -Infinity);
|
|
@@ -3115,7 +3264,7 @@ function particles(opts) {
|
|
|
3115
3264
|
const round3 = (v) => Math.round(v * 1e6) / 1e6;
|
|
3116
3265
|
const out = [];
|
|
3117
3266
|
for (let i = 0; i < count; i++) {
|
|
3118
|
-
const r =
|
|
3267
|
+
const r = chunkNO26HWR7_cjs.random(seed * 1000003 + i * 7919 + 17);
|
|
3119
3268
|
const pick = ([a2, b]) => a2 + r() * (b - a2);
|
|
3120
3269
|
const born = at + r() * emit;
|
|
3121
3270
|
const lifetime = pick(life);
|
|
@@ -3128,7 +3277,7 @@ function particles(opts) {
|
|
|
3128
3277
|
const turn = spin ? pick(spin) : 0;
|
|
3129
3278
|
const startAngle = spin ? r() * 360 : 0;
|
|
3130
3279
|
const swayAmp = sway?.amp ?? 0, swayFreq = sway?.freq ?? 1;
|
|
3131
|
-
const n0 = sway ?
|
|
3280
|
+
const n0 = sway ? chunkNO26HWR7_cjs.noise(0, seed * 1000003 + i) : 0;
|
|
3132
3281
|
const at_ = (t) => {
|
|
3133
3282
|
const axis = (p0, v0, acc) => {
|
|
3134
3283
|
if (drag > 0) {
|
|
@@ -3137,7 +3286,7 @@ function particles(opts) {
|
|
|
3137
3286
|
}
|
|
3138
3287
|
return p0 + v0 * t + 0.5 * acc * t * t;
|
|
3139
3288
|
};
|
|
3140
|
-
const sw = sway ? swayAmp * (
|
|
3289
|
+
const sw = sway ? swayAmp * (chunkNO26HWR7_cjs.noise(t * swayFreq, seed * 1000003 + i) - n0) : 0;
|
|
3141
3290
|
return { x: axis(x0, vx, wind) + sw, y: axis(y0, vy, gravity) };
|
|
3142
3291
|
};
|
|
3143
3292
|
const kfs = [];
|
|
@@ -3187,7 +3336,7 @@ function range(name, v, min) {
|
|
|
3187
3336
|
var KEYS3 = ["d", "at", "duration", "ease", "from", "to", "orient", "rotate", "frameRate"];
|
|
3188
3337
|
var MAX_STEPS = 2e3;
|
|
3189
3338
|
function followPath(opts) {
|
|
3190
|
-
|
|
3339
|
+
chunkWTRKDIKH_cjs.warnUnknownOptions("followPath()", opts, KEYS3);
|
|
3191
3340
|
const { d, at = 0, duration, ease = "none", from = 0, to = 1, orient = false, rotate = 0, frameRate = 30 } = opts;
|
|
3192
3341
|
if (typeof d !== "string" || d.trim() === "") throw new Error('followPath(): d must be SVG path data, e.g. "M 100 600 C 300 100 900 100 1180 600"');
|
|
3193
3342
|
if (!(Number.isFinite(duration) && duration > 0)) throw new Error(`followPath(): duration must be a positive number of seconds, got ${duration}`);
|
|
@@ -3199,7 +3348,7 @@ function followPath(opts) {
|
|
|
3199
3348
|
if (steps > MAX_STEPS) throw new Error(`followPath(): ${steps} samples is too many (max ${MAX_STEPS}); lower frameRate or duration`);
|
|
3200
3349
|
const segments = [];
|
|
3201
3350
|
let total = 0;
|
|
3202
|
-
for (const line of
|
|
3351
|
+
for (const line of chunkNO26HWR7_cjs.flattenSvgPath(d)) {
|
|
3203
3352
|
const p = line.closed ? [...line.pts, line.pts[0], line.pts[1]] : line.pts;
|
|
3204
3353
|
for (let i = 2; i < p.length; i += 2) {
|
|
3205
3354
|
const len = Math.hypot(p[i] - p[i - 2], p[i + 1] - p[i - 1]);
|
|
@@ -3254,7 +3403,7 @@ var KEYS4 = ["points", "at", "duration", "ease", "look", "lookAhead", "smooth",
|
|
|
3254
3403
|
var MAX_STEPS2 = 4e3;
|
|
3255
3404
|
var PER_SPAN = 48;
|
|
3256
3405
|
function cameraPath(opts) {
|
|
3257
|
-
|
|
3406
|
+
chunkWTRKDIKH_cjs.warnUnknownOptions("cameraPath()", opts, KEYS4);
|
|
3258
3407
|
const { points, at = 0, duration, ease = "none", look = "ahead", lookAhead = 0.08, smooth = true, from = 0, to = 1, frameRate = 30 } = opts;
|
|
3259
3408
|
if (!Array.isArray(points) || points.length < 2) throw new Error("cameraPath(): points needs at least two points: [[x, y, z], [x, y, z], \u2026]");
|
|
3260
3409
|
points.forEach((p, i) => {
|
|
@@ -3328,7 +3477,7 @@ function stagger(items, options = {}) {
|
|
|
3328
3477
|
const isCount = typeof items === "number";
|
|
3329
3478
|
const n = isCount ? items : items.length;
|
|
3330
3479
|
if (!Number.isInteger(n) || n < 0) throw new Error(`stagger(): count must be a whole number of items, got ${n}`);
|
|
3331
|
-
|
|
3480
|
+
chunkWTRKDIKH_cjs.warnUnknownOptions("stagger()", options, STAGGER_KEYS);
|
|
3332
3481
|
const { each, amount, from = "start", grid, ease = "none", seed = 0 } = options;
|
|
3333
3482
|
if (each !== void 0 && amount !== void 0) throw new Error("stagger(): give `each` (seconds between neighbours) or `amount` (seconds in total), not both");
|
|
3334
3483
|
if (each !== void 0 && !(Number.isFinite(each) && each >= 0)) throw new Error(`stagger(): each must be a number of seconds >= 0, got ${each}`);
|
|
@@ -3344,7 +3493,8 @@ function stagger(items, options = {}) {
|
|
|
3344
3493
|
const max = dist2.reduce((m, d) => Math.max(m, d), 0);
|
|
3345
3494
|
const total = amount !== void 0 ? amount : (each ?? 0.1) * max;
|
|
3346
3495
|
const shape = parseEase(ease);
|
|
3347
|
-
const
|
|
3496
|
+
const clamp01 = (v) => Math.min(1, Math.max(0, v));
|
|
3497
|
+
const delays = dist2.map((d) => max === 0 ? 0 : Math.round(total * clamp01(shape(d / max)) * 1e6) / 1e6);
|
|
3348
3498
|
if (isCount) return delays;
|
|
3349
3499
|
return items.map((layer, i) => ({ ...layer, at: Math.round(((layer.at ?? 0) + delays[i]) * 1e6) / 1e6 }));
|
|
3350
3500
|
}
|
|
@@ -3352,7 +3502,7 @@ function distances(n, from, grid, seed) {
|
|
|
3352
3502
|
if (n === 0) return [];
|
|
3353
3503
|
if (from === "random") {
|
|
3354
3504
|
const order = Array.from({ length: n }, (_, i) => i);
|
|
3355
|
-
const r =
|
|
3505
|
+
const r = chunkNO26HWR7_cjs.random(seed);
|
|
3356
3506
|
for (let i = n - 1; i > 0; i--) {
|
|
3357
3507
|
const j = Math.floor(r() * (i + 1));
|
|
3358
3508
|
[order[i], order[j]] = [order[j], order[i]];
|
|
@@ -3389,7 +3539,7 @@ function distances(n, from, grid, seed) {
|
|
|
3389
3539
|
var WIGGLE_KEYS = ["at", "duration", "freq", "seed", "ease", "props"];
|
|
3390
3540
|
var MAX_STEPS3 = 2e3;
|
|
3391
3541
|
function wiggle(opts) {
|
|
3392
|
-
|
|
3542
|
+
chunkWTRKDIKH_cjs.warnUnknownOptions("wiggle()", opts, WIGGLE_KEYS);
|
|
3393
3543
|
const { at = 0, duration, freq = 3, seed = 0, ease = "sine.inOut", props } = opts;
|
|
3394
3544
|
if (!(Number.isFinite(duration) && duration > 0)) throw new Error(`wiggle(): duration must be a positive number of seconds, got ${duration}`);
|
|
3395
3545
|
if (!(Number.isFinite(freq) && freq > 0)) throw new Error(`wiggle(): freq must be a positive number (steps per second), got ${freq}`);
|
|
@@ -3414,7 +3564,7 @@ function wiggle(opts) {
|
|
|
3414
3564
|
to[n] = p.around;
|
|
3415
3565
|
return;
|
|
3416
3566
|
}
|
|
3417
|
-
const off = (
|
|
3567
|
+
const off = (chunkNO26HWR7_cjs.rand(seed * 7919 + pi * 104729 + s * 31 + 1) * 2 - 1) * p.amp;
|
|
3418
3568
|
to[n] = typeof p.around === "number" ? p.around + off : `(${p.around}) ${off < 0 ? "-" : "+"} ${Math.abs(off)}`;
|
|
3419
3569
|
});
|
|
3420
3570
|
out.push({ at: at + s * stepLen, to, duration: stepLen, ease });
|
|
@@ -3437,7 +3587,7 @@ var PRESETS = {
|
|
|
3437
3587
|
};
|
|
3438
3588
|
var PRESET_NAMES = Object.keys(PRESETS);
|
|
3439
3589
|
function animateText(text, style, options) {
|
|
3440
|
-
|
|
3590
|
+
chunkWTRKDIKH_cjs.warnUnknownOptions("animateText()", options, KEYS5);
|
|
3441
3591
|
const { by = "chars", x = 0, y = 0, align = "left", name = "text", at = 0, duration, idle, styleFor } = options;
|
|
3442
3592
|
for (const [n, v] of [["x", x], ["y", y]]) {
|
|
3443
3593
|
if (typeof v !== "number" || !Number.isFinite(v)) {
|
|
@@ -3513,11 +3663,11 @@ function resolveTween(spec, which) {
|
|
|
3513
3663
|
if (TWEEN_KEYS.includes(key)) continue;
|
|
3514
3664
|
if (TIME_KEYS.includes(key)) {
|
|
3515
3665
|
console.warn(`pixi-effects: animateText(): ${which}.${key} ("${key}") is ignored: ${which === "out" ? "an out leaves from the END of the layer (at + duration), so to make the text gone at a time T set duration to T \u2212 at" : "the entrance starts when the piece starts (the options' at, plus the stagger)"}`);
|
|
3516
|
-
} else
|
|
3666
|
+
} else chunkWTRKDIKH_cjs.warnUnknownOptions(`animateText() ${which}`, { [key]: 1 }, TWEEN_KEYS);
|
|
3517
3667
|
}
|
|
3518
3668
|
}
|
|
3519
3669
|
if (t.preset !== void 0 && !(t.preset in PRESETS)) {
|
|
3520
|
-
const guess =
|
|
3670
|
+
const guess = chunkWTRKDIKH_cjs.suggestName(String(t.preset), PRESET_NAMES);
|
|
3521
3671
|
throw new Error(`animateText(): ${which} "${t.preset}" is not a preset${guess ? `; did you mean "${guess}"?` : ""} (presets: ${PRESET_NAMES.map((n) => `"${n}"`).join(", ")})`);
|
|
3522
3672
|
}
|
|
3523
3673
|
const base = t.preset ? PRESETS[t.preset] : void 0;
|
|
@@ -3538,7 +3688,7 @@ var KEYS6 = ["at", "duration", "props", "audioOffset", "loop", "frameRate"];
|
|
|
3538
3688
|
var PROP_KEYS = ["base", "amount", "band", "beats", "decay", "attack", "release", "invert", "curve"];
|
|
3539
3689
|
var MAX_STEPS4 = 4e3;
|
|
3540
3690
|
function react(env, options) {
|
|
3541
|
-
|
|
3691
|
+
chunkWTRKDIKH_cjs.warnUnknownOptions("react()", options, KEYS6);
|
|
3542
3692
|
const { at = 0, duration, props, audioOffset = 0, loop = false } = options;
|
|
3543
3693
|
const frameRate = options.frameRate ?? env.frameRate;
|
|
3544
3694
|
if (!(Number.isFinite(duration) && duration > 0)) throw new Error(`react(): duration must be a positive number of seconds, got ${duration}`);
|
|
@@ -3547,7 +3697,7 @@ function react(env, options) {
|
|
|
3547
3697
|
if (names.length === 0) throw new Error("react(): props is empty; name at least one property, e.g. props: { scale: { base: 1, amount: 0.3 } }");
|
|
3548
3698
|
for (const n of names) {
|
|
3549
3699
|
const p = props[n];
|
|
3550
|
-
|
|
3700
|
+
chunkWTRKDIKH_cjs.warnUnknownOptions(`react() props.${n}`, p, PROP_KEYS);
|
|
3551
3701
|
if (!Number.isFinite(p.amount)) throw new Error(`react(): props.${n}.amount must be a number, got ${p.amount}`);
|
|
3552
3702
|
if (!p.beats && p.band !== void 0 && !env.series[p.band]) throw new Error(`react(): props.${n}: band "${p.band}" is not in this envelope (it has: ${Object.keys(env.series).join(", ")})`);
|
|
3553
3703
|
if (p.beats && !(p.decay === void 0 || Number.isFinite(p.decay) && p.decay > 0)) throw new Error(`react(): props.${n}.decay must be a positive number of seconds, got ${p.decay}`);
|
|
@@ -3654,7 +3804,7 @@ function tempo(beats) {
|
|
|
3654
3804
|
return Math.round(60 / median * 10) / 10;
|
|
3655
3805
|
}
|
|
3656
3806
|
function computeEnvelope(audio, options = {}) {
|
|
3657
|
-
|
|
3807
|
+
chunkWTRKDIKH_cjs.warnUnknownOptions("audioEnvelope()", options, OPTION_KEYS);
|
|
3658
3808
|
const frameRate = options.frameRate ?? 30;
|
|
3659
3809
|
if (!(Number.isFinite(frameRate) && frameRate > 0)) throw new Error(`pixi-effects: audioEnvelope(): frameRate must be a positive number, got ${frameRate}`);
|
|
3660
3810
|
const bands = options.bands ?? DEFAULT_BANDS;
|
|
@@ -3778,7 +3928,7 @@ async function audioEnvelope(source, options = {}) {
|
|
|
3778
3928
|
|
|
3779
3929
|
// src/audio/musicEnvelope.ts
|
|
3780
3930
|
async function musicEnvelope(music, options = {}) {
|
|
3781
|
-
const { resolveMusic, renderMusic, musicLength, musicBeatTimes, TempoMap } = await import('./music-
|
|
3931
|
+
const { resolveMusic, renderMusic, musicLength, musicBeatTimes, TempoMap } = await import('./music-UAN7DXK4.cjs');
|
|
3782
3932
|
const messages = [];
|
|
3783
3933
|
const m = resolveMusic(music, "musicEnvelope()", (msg) => messages.push(msg));
|
|
3784
3934
|
if (!m) throw new Error(`pixi-effects: musicEnvelope(): ${messages.join(" ") || "the music has nothing to play"}`);
|
|
@@ -3791,7 +3941,7 @@ async function musicEnvelope(music, options = {}) {
|
|
|
3791
3941
|
|
|
3792
3942
|
// src/audio/musicBuffer.ts
|
|
3793
3943
|
async function musicBuffer(music, options = {}) {
|
|
3794
|
-
const { resolveMusic, renderMusic, musicLength } = await import('./music-
|
|
3944
|
+
const { resolveMusic, renderMusic, musicLength } = await import('./music-UAN7DXK4.cjs');
|
|
3795
3945
|
const messages = [];
|
|
3796
3946
|
const m = resolveMusic(music, "musicBuffer()", (msg) => messages.push(msg));
|
|
3797
3947
|
if (!m) throw new Error(`pixi-effects: musicBuffer(): ${messages.join(" ") || "the music has nothing to play"}`);
|
|
@@ -3811,11 +3961,11 @@ var PAGE_KEYS = ["name", "duration", "sequences", "stops", "notes", "advance", "
|
|
|
3811
3961
|
var DECK_KEYS = ["pages", "transition", "width", "height", "frameRate", "background", "canvas", "assets", "poster", "motionBlur", "loader"];
|
|
3812
3962
|
function deck(options) {
|
|
3813
3963
|
if (!options || !Array.isArray(options.pages) || options.pages.length === 0) throw new Error("deck(): pages must be a list with at least one page: { pages: [{ name, duration, stops, sequences }] }");
|
|
3814
|
-
|
|
3964
|
+
chunkWTRKDIKH_cjs.warnUnknownOptions("deck()", options, DECK_KEYS);
|
|
3815
3965
|
const { pages, transition, ...movieOptions } = options;
|
|
3816
3966
|
pages.forEach((p, i) => {
|
|
3817
3967
|
if (!p || typeof p !== "object") throw new Error(`deck(): pages[${i}] must be an object`);
|
|
3818
|
-
|
|
3968
|
+
chunkWTRKDIKH_cjs.warnUnknownOptions(`deck() pages[${i}]`, p, PAGE_KEYS);
|
|
3819
3969
|
if (!(typeof p.duration === "number" && Number.isFinite(p.duration) && p.duration > 0)) throw new Error(`deck(): pages[${i}].duration must be a positive number of seconds, got ${String(p.duration)}`);
|
|
3820
3970
|
if (!Array.isArray(p.sequences)) throw new Error(`deck(): pages[${i}].sequences must be a list of layers (it may be empty), got ${typeof p.sequences}`);
|
|
3821
3971
|
});
|
|
@@ -3835,7 +3985,7 @@ function deck(options) {
|
|
|
3835
3985
|
const label = page.name ? `"${page.name}"` : `pages[${i}]`;
|
|
3836
3986
|
const isLast = i === pages.length - 1;
|
|
3837
3987
|
const entries = (page.stops ?? [isLast ? page.duration : page.duration - overlap]).map((e, k) => {
|
|
3838
|
-
if (e && typeof e === "object")
|
|
3988
|
+
if (e && typeof e === "object") chunkWTRKDIKH_cjs.warnUnknownOptions(`deck() page ${label} stops[${k}]`, e, ["at", "pdf"]);
|
|
3839
3989
|
return typeof e === "object" && e !== null ? e : { at: e };
|
|
3840
3990
|
});
|
|
3841
3991
|
const local = entries.map((e) => e.at);
|
|
@@ -3869,7 +4019,7 @@ var round2 = (v) => Math.round(v * 1e6) / 1e6;
|
|
|
3869
4019
|
|
|
3870
4020
|
// src/transforms/withFade.ts
|
|
3871
4021
|
function withFade(spec, opts) {
|
|
3872
|
-
|
|
4022
|
+
chunkWTRKDIKH_cjs.warnUnknownOptions("withFade()", opts, ["in", "out"]);
|
|
3873
4023
|
if (opts.in != null && opts.in > 0) {
|
|
3874
4024
|
spec.initial = { ...spec.initial ?? {}, alpha: 0 };
|
|
3875
4025
|
const kf = { at: 0, to: { alpha: 1 }, duration: opts.in };
|
|
@@ -3889,19 +4039,19 @@ function withFade(spec, opts) {
|
|
|
3889
4039
|
|
|
3890
4040
|
Object.defineProperty(exports, "noise", {
|
|
3891
4041
|
enumerable: true,
|
|
3892
|
-
get: function () { return
|
|
4042
|
+
get: function () { return chunkNO26HWR7_cjs.noise; }
|
|
3893
4043
|
});
|
|
3894
4044
|
Object.defineProperty(exports, "rand", {
|
|
3895
4045
|
enumerable: true,
|
|
3896
|
-
get: function () { return
|
|
4046
|
+
get: function () { return chunkNO26HWR7_cjs.rand; }
|
|
3897
4047
|
});
|
|
3898
4048
|
Object.defineProperty(exports, "random", {
|
|
3899
4049
|
enumerable: true,
|
|
3900
|
-
get: function () { return
|
|
4050
|
+
get: function () { return chunkNO26HWR7_cjs.random; }
|
|
3901
4051
|
});
|
|
3902
4052
|
Object.defineProperty(exports, "registerSequenceType", {
|
|
3903
4053
|
enumerable: true,
|
|
3904
|
-
get: function () { return
|
|
4054
|
+
get: function () { return chunkNO26HWR7_cjs.registerSequenceType; }
|
|
3905
4055
|
});
|
|
3906
4056
|
exports.Movie = Movie;
|
|
3907
4057
|
exports.animateText = animateText;
|