pixi-effects 0.26.3 → 0.27.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 +24 -0
- package/README.md +12 -10
- package/ai/CHAT.md +1 -1
- package/ai/chat-template.html +4 -6
- package/dist/{Base-CpdDs4HT.d.ts → Base-CKGl6jCo.d.ts} +2 -4
- package/dist/{Base-TbBhHPrG.d.cts → Base-DjhdL8B1.d.cts} +2 -4
- package/dist/Composition-BJVY5HP7.js +7 -0
- package/dist/{Composition-3O7L2VL5.js.map → Composition-BJVY5HP7.js.map} +1 -1
- package/dist/Composition-YW2G6EXL.cjs +16 -0
- package/dist/{Composition-EE3KEE2L.cjs.map → Composition-YW2G6EXL.cjs.map} +1 -1
- package/dist/Controller.d.cts +2 -3
- package/dist/Controller.d.ts +2 -3
- package/dist/{Movie-BkP82KXS.d.ts → Movie-CbYwTs6U.d.cts} +2 -3
- package/dist/{Movie-BWLLWRRe.d.cts → Movie-ILKq2fw_.d.ts} +2 -3
- package/dist/Presenter.d.cts +2 -3
- package/dist/Presenter.d.ts +2 -3
- package/dist/{blendModes-YV43K6E7.cjs → blendModes-HDOP6R7T.cjs} +5 -5
- package/dist/{blendModes-YV43K6E7.cjs.map → blendModes-HDOP6R7T.cjs.map} +1 -1
- package/dist/{blendModes-G3NOAU3T.js → blendModes-PAVTW3BO.js} +4 -4
- package/dist/{blendModes-G3NOAU3T.js.map → blendModes-PAVTW3BO.js.map} +1 -1
- package/dist/{chunk-TLYTYBWX.js → chunk-45QKLD6M.js} +9 -11
- package/dist/chunk-45QKLD6M.js.map +1 -0
- package/dist/{chunk-WMMZDPWK.js → chunk-AR3HVHKF.js} +7 -11
- package/dist/chunk-AR3HVHKF.js.map +1 -0
- package/dist/{chunk-A225HYSY.cjs → chunk-ETKTRQL2.cjs} +970 -258
- package/dist/chunk-ETKTRQL2.cjs.map +1 -0
- package/dist/{chunk-3DLYAPK7.cjs → chunk-P4GY3Z4G.cjs} +5 -5
- package/dist/{chunk-3DLYAPK7.cjs.map → chunk-P4GY3Z4G.cjs.map} +1 -1
- package/dist/{chunk-AXZUKNXF.js → chunk-TYWFKCPY.js} +4 -4
- package/dist/{chunk-AXZUKNXF.js.map → chunk-TYWFKCPY.js.map} +1 -1
- package/dist/{chunk-IIDBEYQH.cjs → chunk-VH5R473P.cjs} +91 -95
- package/dist/chunk-VH5R473P.cjs.map +1 -0
- package/dist/{chunk-FXAHNPBP.js → chunk-X42BGR6P.js} +950 -241
- package/dist/chunk-X42BGR6P.js.map +1 -0
- package/dist/{chunk-ECA2WNRX.cjs → chunk-ZMAD3KJU.cjs} +9 -11
- package/dist/chunk-ZMAD3KJU.cjs.map +1 -0
- package/dist/index.cjs +102 -105
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +16 -14
- package/dist/index.d.ts +16 -14
- package/dist/index.js +48 -33
- package/dist/index.js.map +1 -1
- package/dist/loader.css +1 -1
- package/dist/{music-3O5MDQXY.js → music-JVRNXHQ5.js} +34 -7
- package/dist/music-JVRNXHQ5.js.map +1 -0
- package/dist/{music-4O367SPR.cjs → music-YPUZTWTN.cjs} +34 -6
- package/dist/music-YPUZTWTN.cjs.map +1 -0
- package/dist/three.cjs +6 -6
- package/dist/three.d.cts +2 -3
- package/dist/three.d.ts +2 -3
- package/dist/three.js +2 -2
- package/dist/{types-DSGwN5w1.d.cts → types-BNVsBBZf.d.cts} +130 -3
- package/dist/{types-DSGwN5w1.d.ts → types-BNVsBBZf.d.ts} +130 -3
- package/docs/api.md +5 -1
- package/docs/dsl.md +13 -15
- package/llms-full.txt +24 -22
- package/llms.txt +1 -1
- package/package.json +4 -5
- package/skills/pixi-effects/SKILL.md +1 -1
- package/skills/pixi-effects/reference/cheatsheet.md +1 -1
- package/skills/pixi-effects/reference/pitfalls.md +3 -3
- package/skills/pixi-effects/reference/recipes.md +1 -1
- package/skills/pixi-effects/template.html +6 -8
- package/dist/Composition-3O7L2VL5.js +0 -7
- package/dist/Composition-EE3KEE2L.cjs +0 -16
- package/dist/chunk-A225HYSY.cjs.map +0 -1
- package/dist/chunk-ECA2WNRX.cjs.map +0 -1
- package/dist/chunk-FXAHNPBP.js.map +0 -1
- package/dist/chunk-IIDBEYQH.cjs.map +0 -1
- package/dist/chunk-TLYTYBWX.js.map +0 -1
- package/dist/chunk-WMMZDPWK.js.map +0 -1
- package/dist/music-3O5MDQXY.js.map +0 -1
- package/dist/music-4O367SPR.cjs.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -1,41 +1,19 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
var
|
|
3
|
+
var chunkVH5R473P_cjs = require('./chunk-VH5R473P.cjs');
|
|
4
|
+
var chunkETKTRQL2_cjs = require('./chunk-ETKTRQL2.cjs');
|
|
5
|
+
var chunkP4GY3Z4G_cjs = require('./chunk-P4GY3Z4G.cjs');
|
|
6
|
+
var chunkZMAD3KJU_cjs = require('./chunk-ZMAD3KJU.cjs');
|
|
7
7
|
var chunkTWZNOUM7_cjs = require('./chunk-TWZNOUM7.cjs');
|
|
8
|
-
var
|
|
9
|
-
var gsap = require('gsap');
|
|
10
|
-
var PixiPlugin = require('gsap/PixiPlugin');
|
|
8
|
+
var pixi_js = require('pixi.js');
|
|
11
9
|
var mediabunny = require('mediabunny');
|
|
12
10
|
|
|
13
|
-
function _interopNamespace(e) {
|
|
14
|
-
if (e && e.__esModule) return e;
|
|
15
|
-
var n = Object.create(null);
|
|
16
|
-
if (e) {
|
|
17
|
-
Object.keys(e).forEach(function (k) {
|
|
18
|
-
if (k !== 'default') {
|
|
19
|
-
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
20
|
-
Object.defineProperty(n, k, d.get ? d : {
|
|
21
|
-
enumerable: true,
|
|
22
|
-
get: function () { return e[k]; }
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
n.default = e;
|
|
28
|
-
return Object.freeze(n);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
var PIXI__namespace = /*#__PURE__*/_interopNamespace(PIXI);
|
|
32
|
-
|
|
33
11
|
var registered = false;
|
|
34
12
|
function ensureLoadersRegistered(audioContext) {
|
|
35
13
|
if (registered) return;
|
|
36
14
|
registered = true;
|
|
37
|
-
|
|
38
|
-
extension: { type:
|
|
15
|
+
pixi_js.extensions.add({
|
|
16
|
+
extension: { type: pixi_js.ExtensionType.LoadParser, name: "pixi-effects-audio" },
|
|
39
17
|
test: (url) => /\.(mp3|wav|ogg)$/i.test(url),
|
|
40
18
|
async load(url) {
|
|
41
19
|
const res = await fetch(url);
|
|
@@ -45,8 +23,8 @@ function ensureLoadersRegistered(audioContext) {
|
|
|
45
23
|
return { audioBuffer, duration: audioBuffer.duration };
|
|
46
24
|
}
|
|
47
25
|
});
|
|
48
|
-
|
|
49
|
-
extension: { type:
|
|
26
|
+
pixi_js.extensions.add({
|
|
27
|
+
extension: { type: pixi_js.ExtensionType.LoadParser, name: "pixi-effects-video", priority: 1 },
|
|
50
28
|
test: (url) => /\.(mp4|webm|mov|mkv)$/i.test(url),
|
|
51
29
|
async load(url) {
|
|
52
30
|
const blob = await fetch(url).then((r) => r.blob());
|
|
@@ -83,8 +61,8 @@ function ensureLoadersRegistered(audioContext) {
|
|
|
83
61
|
async function loadAssetBundle(assets, audioContext, onProgress) {
|
|
84
62
|
ensureLoadersRegistered(audioContext);
|
|
85
63
|
const bundle = assets.map((a) => ({ alias: a.name, src: a.src }));
|
|
86
|
-
|
|
87
|
-
return await
|
|
64
|
+
pixi_js.Assets.addBundle("pixi-effects", bundle);
|
|
65
|
+
return await pixi_js.Assets.loadBundle("pixi-effects", onProgress);
|
|
88
66
|
}
|
|
89
67
|
|
|
90
68
|
// src/core/audioRemap.ts
|
|
@@ -167,16 +145,19 @@ function clockReach(a, total) {
|
|
|
167
145
|
}
|
|
168
146
|
|
|
169
147
|
// src/core/AudioMixer.ts
|
|
170
|
-
async function mixdown(audios, totalDuration, sampleRate = 44100) {
|
|
148
|
+
async function mixdown(audios, totalDuration, sampleRate = 44100, pace) {
|
|
171
149
|
if (audios.length === 0) return null;
|
|
150
|
+
const weight = (a) => a.synth ? Math.max(1, a.end - a.start) : 0.2;
|
|
151
|
+
const all = audios.reduce((s, a) => s + weight(a), 0) + 0.5;
|
|
152
|
+
let made = 0;
|
|
172
153
|
const ctx = new OfflineAudioContext(2, Math.ceil(sampleRate * totalDuration), sampleRate);
|
|
173
154
|
const synthesised = /* @__PURE__ */ new Map();
|
|
174
|
-
const bufferOf = (a) => {
|
|
155
|
+
const bufferOf = async (a, inner) => {
|
|
175
156
|
if (a.buffer) return a.buffer;
|
|
176
157
|
if (!a.synth) return null;
|
|
177
158
|
let buf = synthesised.get(a.synth.key);
|
|
178
159
|
if (!buf) {
|
|
179
|
-
const [left, right] = a.synth.render(sampleRate);
|
|
160
|
+
const [left, right] = a.synth.renderAsync ? await a.synth.renderAsync(sampleRate, inner) : a.synth.render(sampleRate);
|
|
180
161
|
buf = ctx.createBuffer(2, left.length, sampleRate);
|
|
181
162
|
buf.getChannelData(0).set(left);
|
|
182
163
|
buf.getChannelData(1).set(right);
|
|
@@ -185,7 +166,10 @@ async function mixdown(audios, totalDuration, sampleRate = 44100) {
|
|
|
185
166
|
return buf;
|
|
186
167
|
};
|
|
187
168
|
for (const a of audios) {
|
|
188
|
-
const
|
|
169
|
+
const w = weight(a), base = made;
|
|
170
|
+
const buffer = await bufferOf(a, pace ? (f) => pace((base + w * f) / all) : void 0);
|
|
171
|
+
made += w;
|
|
172
|
+
if (pace) await pace(made / all);
|
|
189
173
|
if (!buffer) continue;
|
|
190
174
|
if (a.warp || a.sourceMap) {
|
|
191
175
|
const r = resampleThrough(a, buffer.getChannelData(0), buffer.numberOfChannels > 1 ? buffer.getChannelData(1) : buffer.getChannelData(0), buffer.sampleRate, sampleRate, totalDuration);
|
|
@@ -1267,7 +1251,7 @@ fn mainFragment(@location(0) uv : vec2<f32>) -> @location(0) vec4<f32> {
|
|
|
1267
1251
|
return raw * reveal;
|
|
1268
1252
|
}
|
|
1269
1253
|
`;
|
|
1270
|
-
var TransitionMaskFilter = class extends
|
|
1254
|
+
var TransitionMaskFilter = class extends pixi_js.Filter {
|
|
1271
1255
|
constructor(options = {}) {
|
|
1272
1256
|
const mode = options.mode ?? "wipe-left";
|
|
1273
1257
|
const smoothing = options.smoothing ?? 0.02;
|
|
@@ -1276,17 +1260,17 @@ var TransitionMaskFilter = class extends PIXI.Filter {
|
|
|
1276
1260
|
const scale = options.scale ?? 30;
|
|
1277
1261
|
const seed = options.seed ?? 0;
|
|
1278
1262
|
super({
|
|
1279
|
-
glProgram:
|
|
1280
|
-
vertex:
|
|
1263
|
+
glProgram: pixi_js.GlProgram.from({
|
|
1264
|
+
vertex: pixi_js.defaultFilterVert,
|
|
1281
1265
|
fragment: GL_FRAGMENT,
|
|
1282
1266
|
name: "transition-mask-filter"
|
|
1283
1267
|
}),
|
|
1284
|
-
gpuProgram:
|
|
1268
|
+
gpuProgram: pixi_js.GpuProgram.from({
|
|
1285
1269
|
vertex: { source: WGSL_SOURCE, entryPoint: "mainVertex" },
|
|
1286
1270
|
fragment: { source: WGSL_SOURCE, entryPoint: "mainFragment" }
|
|
1287
1271
|
}),
|
|
1288
1272
|
resources: {
|
|
1289
|
-
transitionUniforms: new
|
|
1273
|
+
transitionUniforms: new pixi_js.UniformGroup({
|
|
1290
1274
|
uProgress: { value: progress, type: "f32" },
|
|
1291
1275
|
uMode: { value: MODE_CODES[mode], type: "f32" },
|
|
1292
1276
|
uSmoothing: { value: smoothing, type: "f32" },
|
|
@@ -1413,19 +1397,19 @@ fn mainFragment(@location(0) uv : vec2<f32>) -> @location(0) vec4<f32> {
|
|
|
1413
1397
|
if (lumaUniforms.uInvert > 0.5) { reveal = 1.0 - step(0.99, reveal); }
|
|
1414
1398
|
return raw * reveal;
|
|
1415
1399
|
}`;
|
|
1416
|
-
var LumaWipeFilter = class extends
|
|
1400
|
+
var LumaWipeFilter = class extends pixi_js.Filter {
|
|
1417
1401
|
_mapName;
|
|
1418
1402
|
_builtIn;
|
|
1419
1403
|
_resolved = false;
|
|
1420
1404
|
_warned = false;
|
|
1421
1405
|
constructor({ map, softness = 0.1, progress = 0, invert = false, flip = false }) {
|
|
1422
|
-
const t =
|
|
1406
|
+
const t = pixi_js.Texture.WHITE;
|
|
1423
1407
|
const mode = LUMA_MAPS.indexOf(map) + 1;
|
|
1424
1408
|
super({
|
|
1425
|
-
glProgram:
|
|
1426
|
-
gpuProgram:
|
|
1409
|
+
glProgram: pixi_js.GlProgram.from({ vertex: pixi_js.defaultFilterVert, fragment: GL, name: "pe-luma-wipe" }),
|
|
1410
|
+
gpuProgram: pixi_js.GpuProgram.from({ vertex: { source: WGSL, entryPoint: "mainVertex" }, fragment: { source: WGSL, entryPoint: "mainFragment" } }),
|
|
1427
1411
|
resources: {
|
|
1428
|
-
lumaUniforms: new
|
|
1412
|
+
lumaUniforms: new pixi_js.UniformGroup({
|
|
1429
1413
|
uProgress: { value: progress, type: "f32" },
|
|
1430
1414
|
uSoftness: { value: softness, type: "f32" },
|
|
1431
1415
|
uInvert: { value: invert ? 1 : 0, type: "f32" },
|
|
@@ -1447,7 +1431,7 @@ var LumaWipeFilter = class extends PIXI.Filter {
|
|
|
1447
1431
|
}
|
|
1448
1432
|
apply(fm, input, output, clear) {
|
|
1449
1433
|
if (!this._builtIn && !this._resolved) {
|
|
1450
|
-
const t =
|
|
1434
|
+
const t = pixi_js.Assets.get(this._mapName);
|
|
1451
1435
|
if (t) {
|
|
1452
1436
|
this.resources.uMap = t.source;
|
|
1453
1437
|
this.resources.uMapSampler = t.source.style;
|
|
@@ -1501,8 +1485,8 @@ function expandTransitions(spec) {
|
|
|
1501
1485
|
}
|
|
1502
1486
|
const transitions = out.transitions;
|
|
1503
1487
|
const sequences = out.sequences ?? [];
|
|
1504
|
-
const remap = out.duration !== void 0 ?
|
|
1505
|
-
const parentDuration = remap ?
|
|
1488
|
+
const remap = out.duration !== void 0 ? chunkETKTRQL2_cjs.timeRemapOf(out) : null;
|
|
1489
|
+
const parentDuration = remap ? chunkETKTRQL2_cjs.contentLength(remap, out.duration) : out.duration ?? Infinity;
|
|
1506
1490
|
const compW = out.width;
|
|
1507
1491
|
const compH = out.height;
|
|
1508
1492
|
const threeDByName = new Set(sequences.filter((s) => s.name && s.threeD).map((s) => s.name));
|
|
@@ -1570,16 +1554,16 @@ function expandTransitions(spec) {
|
|
|
1570
1554
|
if (toUses > 1) {
|
|
1571
1555
|
throw new Error(`pixi-effects: ${tag} sequence "${t.to}" is used as \`to\` in more than one transition`);
|
|
1572
1556
|
}
|
|
1573
|
-
const tStart =
|
|
1557
|
+
const tStart = chunkETKTRQL2_cjs.resolveAt(t.at, parentDuration);
|
|
1574
1558
|
const tEnd = tStart + t.duration;
|
|
1575
1559
|
const fromSeq = fromEntry.seq;
|
|
1576
|
-
const fromStart =
|
|
1560
|
+
const fromStart = chunkETKTRQL2_cjs.resolveAt(fromSeq.at, parentDuration);
|
|
1577
1561
|
const fromEnd = fromStart + (fromSeq.duration ?? parentDuration);
|
|
1578
1562
|
if (tStart < fromStart - EPS || tEnd > fromEnd + EPS) {
|
|
1579
1563
|
throw new Error(`pixi-effects: ${tag} window [${tStart}, ${tEnd}] is not covered by \`from\` "${t.from}" (lives [${fromStart}, ${fromEnd}], so it ends at ${fromEnd})`);
|
|
1580
1564
|
}
|
|
1581
1565
|
const toSeq = toEntry.seq;
|
|
1582
|
-
const toStart =
|
|
1566
|
+
const toStart = chunkETKTRQL2_cjs.resolveAt(toSeq.at, parentDuration);
|
|
1583
1567
|
const toEnd = toStart + (toSeq.duration ?? parentDuration);
|
|
1584
1568
|
if (tStart < toStart - EPS || tEnd > toEnd + EPS) {
|
|
1585
1569
|
throw new Error(`pixi-effects: ${tag} window [${tStart}, ${tEnd}] is not covered by \`to\` "${t.to}" (lives [${toStart}, ${toEnd}], so it starts at ${toStart})`);
|
|
@@ -1639,7 +1623,7 @@ function wrapAsFullComposition(seq, compW, compH) {
|
|
|
1639
1623
|
delete inner.at;
|
|
1640
1624
|
delete inner.duration;
|
|
1641
1625
|
const m = inner.mask;
|
|
1642
|
-
const carriesMatte = m !== void 0 &&
|
|
1626
|
+
const carriesMatte = m !== void 0 && chunkVH5R473P_cjs.maskSourceOf(m).kind === "refs";
|
|
1643
1627
|
if (carriesMatte) delete inner.mask;
|
|
1644
1628
|
return {
|
|
1645
1629
|
...carriesMatte ? { mask: m } : {},
|
|
@@ -1941,9 +1925,9 @@ function inspectScene(root, frame, time, canvas, opts = {}) {
|
|
|
1941
1925
|
onCanvas = inter === 0 && area > 0 ? "none" : inter >= area - 1e-6 ? "full" : "partial";
|
|
1942
1926
|
if (area === 0) onCanvas = "none";
|
|
1943
1927
|
}
|
|
1944
|
-
const keys =
|
|
1928
|
+
const keys = chunkZMAD3KJU_cjs.collectPropKeys(seq.spec);
|
|
1945
1929
|
const carried = carriers.some((c) => {
|
|
1946
|
-
const k =
|
|
1930
|
+
const k = chunkZMAD3KJU_cjs.collectPropKeys(c.spec);
|
|
1947
1931
|
return (c.spec.keyframes ?? []).length > 0 && (k.has("x") || k.has("y") || k.has("rotation") || k.has("scale"));
|
|
1948
1932
|
});
|
|
1949
1933
|
const moving = parentMoving || carried || (seq.spec.keyframes ?? []).length > 0 && (keys.has("x") || keys.has("y"));
|
|
@@ -1966,7 +1950,7 @@ function inspectScene(root, frame, time, canvas, opts = {}) {
|
|
|
1966
1950
|
const group = parentScene ?? (name !== void 0 && blending.has(name) ? name : void 0);
|
|
1967
1951
|
if (group) scene.set(info, group);
|
|
1968
1952
|
if (zero || seq.showsNothingYet) scaledToNothing.add(info);
|
|
1969
|
-
if (seq instanceof
|
|
1953
|
+
if (seq instanceof chunkVH5R473P_cjs.CompositionSequence) walk2(seq, prefix + label + "/", insideThreeD || threeD, visible, group, moving, zero);
|
|
1970
1954
|
});
|
|
1971
1955
|
};
|
|
1972
1956
|
walk2(root, "", false, true);
|
|
@@ -2027,10 +2011,10 @@ function walk(comp, parentStart, parentEnd, depth, prefix, rows, transitions, lo
|
|
|
2027
2011
|
const start = parentStart + (seq.at ?? 0);
|
|
2028
2012
|
const end = Math.min(parentEnd, seq.duration !== void 0 ? start + seq.duration : parentEnd);
|
|
2029
2013
|
const span = end - start;
|
|
2030
|
-
const keys = (seq.spec.keyframes ?? []).map((kf) => round(start +
|
|
2014
|
+
const keys = (seq.spec.keyframes ?? []).map((kf) => round(start + chunkETKTRQL2_cjs.resolveAt(kf.at, span))).sort((a, b) => a - b).slice(0, MAX_KEYS);
|
|
2031
2015
|
const row = { path: prefix + name, name, type: seq.spec.type, depth, start: round(start), end: round(end), keys, detail: detailOf(seq), ...local ? { local } : {} };
|
|
2032
2016
|
const inner = [];
|
|
2033
|
-
const isComp = seq instanceof
|
|
2017
|
+
const isComp = seq instanceof chunkVH5R473P_cjs.CompositionSequence;
|
|
2034
2018
|
if (isComp) {
|
|
2035
2019
|
const label = seq.remapLabel();
|
|
2036
2020
|
walk(seq, label ? 0 : start, label ? seq.contentSpan : end, depth + 1, prefix + name + "/", inner, transitions, label ? `${name} ${label}` : local);
|
|
@@ -2429,6 +2413,7 @@ var LoadProgress = class {
|
|
|
2429
2413
|
_onChange;
|
|
2430
2414
|
_stage = null;
|
|
2431
2415
|
_loaded = 0;
|
|
2416
|
+
_part = 0;
|
|
2432
2417
|
_total = 0;
|
|
2433
2418
|
_high = 0;
|
|
2434
2419
|
_started = 0;
|
|
@@ -2446,6 +2431,7 @@ var LoadProgress = class {
|
|
|
2446
2431
|
this._closeTiming();
|
|
2447
2432
|
this._stage = stage;
|
|
2448
2433
|
this._loaded = 0;
|
|
2434
|
+
this._part = 0;
|
|
2449
2435
|
this._total = Math.max(0, total);
|
|
2450
2436
|
this._started = this._now();
|
|
2451
2437
|
this._emit();
|
|
@@ -2453,6 +2439,13 @@ var LoadProgress = class {
|
|
|
2453
2439
|
tick(n = 1) {
|
|
2454
2440
|
if (!this._stage) return;
|
|
2455
2441
|
this._loaded = Math.min(this._total, this._loaded + n);
|
|
2442
|
+
this._part = 0;
|
|
2443
|
+
this._emit();
|
|
2444
|
+
}
|
|
2445
|
+
/** How much of the item being worked on is done (0..1), for an item that takes long: the number moves between two `tick`s. */
|
|
2446
|
+
part(done) {
|
|
2447
|
+
if (!this._stage) return;
|
|
2448
|
+
this._part = Math.min(1, Math.max(0, done));
|
|
2456
2449
|
this._emit();
|
|
2457
2450
|
}
|
|
2458
2451
|
/** Everything is done: 1, whatever stage it was in. */
|
|
@@ -2484,7 +2477,7 @@ var LoadProgress = class {
|
|
|
2484
2477
|
if (s === stage) break;
|
|
2485
2478
|
done += WEIGHT[s];
|
|
2486
2479
|
}
|
|
2487
|
-
const within = this._total > 0 ? this._loaded / this._total : 1;
|
|
2480
|
+
const within = this._total > 0 ? Math.min(1, (this._loaded + this._part) / this._total) : 1;
|
|
2488
2481
|
this._high = Math.min(1, Math.max(this._high, done + WEIGHT[stage] * within));
|
|
2489
2482
|
this._onChange({ stage, loaded: this._loaded, total: this._total, progress: this._high });
|
|
2490
2483
|
}
|
|
@@ -2542,9 +2535,7 @@ function setLoaderProgress(loader, state) {
|
|
|
2542
2535
|
}
|
|
2543
2536
|
|
|
2544
2537
|
// src/core/Movie.ts
|
|
2545
|
-
|
|
2546
|
-
gsap.gsap.registerPlugin(PixiPlugin.PixiPlugin);
|
|
2547
|
-
PixiPlugin.PixiPlugin.registerPIXI(PIXI__namespace);
|
|
2538
|
+
pixi_js.extensions.add(pixi_js.CullerPlugin);
|
|
2548
2539
|
var Movie = class {
|
|
2549
2540
|
_events = {};
|
|
2550
2541
|
_initState = "idle";
|
|
@@ -2680,8 +2671,8 @@ var Movie = class {
|
|
|
2680
2671
|
this.stops = normalizeStops(options.composition?.stops, this.duration, this.frameRate);
|
|
2681
2672
|
this._posterFrame = poster.frame;
|
|
2682
2673
|
this.background = options.background ?? "#000000";
|
|
2683
|
-
this.timeline =
|
|
2684
|
-
this.timeline
|
|
2674
|
+
this.timeline = chunkETKTRQL2_cjs.createTimeline({ paused: true, defaults: { ease: "none" } });
|
|
2675
|
+
chunkETKTRQL2_cjs.lengthen(this.timeline, this.duration);
|
|
2685
2676
|
const baseAppOptions = {
|
|
2686
2677
|
width: this.width,
|
|
2687
2678
|
height: this.height,
|
|
@@ -2692,19 +2683,19 @@ var Movie = class {
|
|
|
2692
2683
|
preserveDrawingBuffer: true,
|
|
2693
2684
|
canvas: options.canvas
|
|
2694
2685
|
};
|
|
2695
|
-
this.app = new
|
|
2686
|
+
this.app = new pixi_js.Application();
|
|
2696
2687
|
try {
|
|
2697
2688
|
await this.app.init({ ...baseAppOptions, preference: "webgpu" });
|
|
2698
2689
|
} catch (err) {
|
|
2699
2690
|
console.warn("pixi-effects: WebGPU init failed, falling back to WebGL \u2014", err);
|
|
2700
|
-
this.app = new
|
|
2691
|
+
this.app = new pixi_js.Application();
|
|
2701
2692
|
await this.app.init({ ...baseAppOptions, preference: "webgl" });
|
|
2702
2693
|
}
|
|
2703
|
-
if (
|
|
2704
|
-
const root = new
|
|
2694
|
+
if (chunkP4GY3Z4G_cjs.usesAdvancedBlend(options.composition)) await chunkP4GY3Z4G_cjs.enableAdvancedBlend(this.app.renderer);
|
|
2695
|
+
const root = new pixi_js.Container();
|
|
2705
2696
|
root.cullable = true;
|
|
2706
2697
|
root.cullableChildren = true;
|
|
2707
|
-
root.cullArea = new
|
|
2698
|
+
root.cullArea = new pixi_js.Rectangle(0, 0, this.width, this.height);
|
|
2708
2699
|
this.app.stage.addChild(root);
|
|
2709
2700
|
this._rootContainer = root;
|
|
2710
2701
|
const audioContext = this._ensureAudioContext();
|
|
@@ -2740,7 +2731,7 @@ var Movie = class {
|
|
|
2740
2731
|
height: options.composition.height ?? this.height,
|
|
2741
2732
|
duration: options.composition.duration ?? this.duration
|
|
2742
2733
|
} : void 0;
|
|
2743
|
-
await
|
|
2734
|
+
await chunkETKTRQL2_cjs.ensureFilterLibrary(seededComposition);
|
|
2744
2735
|
const userComposition = seededComposition ? expandTransitions(seededComposition) : void 0;
|
|
2745
2736
|
const rootSeqSpec = {
|
|
2746
2737
|
type: "composition",
|
|
@@ -2750,7 +2741,7 @@ var Movie = class {
|
|
|
2750
2741
|
...userComposition
|
|
2751
2742
|
};
|
|
2752
2743
|
if (userComposition) carryTransitionWindows(userComposition, rootSeqSpec);
|
|
2753
|
-
const composition = new
|
|
2744
|
+
const composition = new chunkVH5R473P_cjs.CompositionSequence(rootSeqSpec, null, rootShape);
|
|
2754
2745
|
lp.begin("build", countLayers(rootSeqSpec));
|
|
2755
2746
|
await composition.build();
|
|
2756
2747
|
this._rootSequence = composition;
|
|
@@ -2759,15 +2750,18 @@ var Movie = class {
|
|
|
2759
2750
|
this._timeFilters = collectTimeFilters(composition);
|
|
2760
2751
|
const audios = [];
|
|
2761
2752
|
composition.collectAudio(audios, 0);
|
|
2762
|
-
lp.begin("sound",
|
|
2753
|
+
lp.begin("sound", 1);
|
|
2763
2754
|
if (audios.length > 0) {
|
|
2764
|
-
this.audioBuffer = await mixdown(audios, this.duration, audioContext.sampleRate)
|
|
2765
|
-
|
|
2755
|
+
this.audioBuffer = await mixdown(audios, this.duration, audioContext.sampleRate, async (done) => {
|
|
2756
|
+
lp.part(done);
|
|
2757
|
+
await lp.yieldIfDue();
|
|
2758
|
+
});
|
|
2759
|
+
lp.tick();
|
|
2766
2760
|
if (this.audioBuffer) this._mixStats = limitMix(this.audioBuffer, audios);
|
|
2767
2761
|
}
|
|
2768
2762
|
this._audioSources = audios;
|
|
2769
|
-
this.timeline.progress(1).progress(0);
|
|
2770
2763
|
lp.begin("frames", 0);
|
|
2764
|
+
this.timeline.time(this._timeOf(0));
|
|
2771
2765
|
await this._awaitVideoFrames();
|
|
2772
2766
|
this._updateSpace();
|
|
2773
2767
|
this._renderNow();
|
|
@@ -3102,7 +3096,7 @@ var Movie = class {
|
|
|
3102
3096
|
if (!this._synced) this._rootSequence?.syncFrame();
|
|
3103
3097
|
this._synced = false;
|
|
3104
3098
|
this._feedTimeFilters();
|
|
3105
|
-
|
|
3099
|
+
pixi_js.Culler.shared.cull(app.stage, app.renderer.screen, false);
|
|
3106
3100
|
app.renderer.render({ container: app.stage });
|
|
3107
3101
|
}
|
|
3108
3102
|
_requireReady(what) {
|
|
@@ -3423,9 +3417,9 @@ function countLayers(spec) {
|
|
|
3423
3417
|
}
|
|
3424
3418
|
var BY = ["chars", "words", "lines"];
|
|
3425
3419
|
var ALIGN = ["left", "center", "right"];
|
|
3426
|
-
var widthOf = (text, style) =>
|
|
3420
|
+
var widthOf = (text, style) => pixi_js.CanvasTextMetrics.measureText(text, style).width;
|
|
3427
3421
|
function measureText(text, style = {}) {
|
|
3428
|
-
const m =
|
|
3422
|
+
const m = pixi_js.CanvasTextMetrics.measureText(text, new pixi_js.TextStyle(style));
|
|
3429
3423
|
return { width: m.width, height: m.height, lines: text.split("\n").length };
|
|
3430
3424
|
}
|
|
3431
3425
|
function splitText(text, style = {}, opts = {}) {
|
|
@@ -3447,8 +3441,8 @@ function splitText(text, style = {}, opts = {}) {
|
|
|
3447
3441
|
if (typeof v !== "number" || !Number.isFinite(v)) throw new Error(`splitText(): ${n} must be a number of pixels (e.g. ${n}: 640), got ${JSON.stringify(v)}: the pieces are placed by measuring, so an expression such as 'GW/2' cannot be used here. \`y\` is the top of the line.`);
|
|
3448
3442
|
}
|
|
3449
3443
|
if (text === "") return [];
|
|
3450
|
-
const ts = new
|
|
3451
|
-
const lineHeight =
|
|
3444
|
+
const ts = new pixi_js.TextStyle(style);
|
|
3445
|
+
const lineHeight = pixi_js.CanvasTextMetrics.measureText("M", ts).lineHeight ?? pixi_js.CanvasTextMetrics.measureText("M", ts).height;
|
|
3452
3446
|
const sentinel = widthOf("|", ts);
|
|
3453
3447
|
const out = [];
|
|
3454
3448
|
text.split("\n").forEach((line, lineNo) => {
|
|
@@ -3472,6 +3466,12 @@ function splitText(text, style = {}, opts = {}) {
|
|
|
3472
3466
|
return out;
|
|
3473
3467
|
}
|
|
3474
3468
|
|
|
3469
|
+
// src/presets/_ease.ts
|
|
3470
|
+
function parseEase2(name) {
|
|
3471
|
+
chunkETKTRQL2_cjs.checkEase(name, "a preset");
|
|
3472
|
+
return chunkETKTRQL2_cjs.parseEase(name);
|
|
3473
|
+
}
|
|
3474
|
+
|
|
3475
3475
|
// src/presets/kenBurns.ts
|
|
3476
3476
|
var KEN_BURNS_KEYS = ["asset", "name", "at", "duration", "fit", "ease", "motion", "origin", "zoom", "direction", "angle", "from", "to"];
|
|
3477
3477
|
function kenBurns(opts) {
|
|
@@ -3584,10 +3584,6 @@ function kenBurns(opts) {
|
|
|
3584
3584
|
function clamp(v, lo, hi) {
|
|
3585
3585
|
return Math.max(lo, Math.min(hi, v));
|
|
3586
3586
|
}
|
|
3587
|
-
function parseEase(name) {
|
|
3588
|
-
chunkA225HYSY_cjs.checkEase(name, "a preset");
|
|
3589
|
-
return gsap.gsap.parseEase(name);
|
|
3590
|
-
}
|
|
3591
3587
|
|
|
3592
3588
|
// src/presets/orbit.ts
|
|
3593
3589
|
var ORBIT_KEYS = ["duration", "degrees", "start", "radius", "center", "width", "height", "fov", "ease", "dollyZoom", "at", "name", "stepsPerSecond"];
|
|
@@ -3608,17 +3604,17 @@ function orbit(opts) {
|
|
|
3608
3604
|
throw new Error("pixi-effects: orbit() cannot combine `radius` with `dollyZoom` \u2014 the radius follows the animated fov");
|
|
3609
3605
|
}
|
|
3610
3606
|
const [cx, cy] = opts.center ?? [width / 2, height / 2];
|
|
3611
|
-
const fixedR = opts.radius ??
|
|
3607
|
+
const fixedR = opts.radius ?? chunkETKTRQL2_cjs.homeDistance(height, fov ?? chunkETKTRQL2_cjs.DEFAULT_FOV);
|
|
3612
3608
|
const start = opts.start ?? -degrees / 2;
|
|
3613
3609
|
const steps = Math.max(1, Math.round(duration * stepsPerSecond));
|
|
3614
|
-
const easeFn =
|
|
3615
|
-
const dollyEase = dolly ?
|
|
3610
|
+
const easeFn = parseEase2(ease);
|
|
3611
|
+
const dollyEase = dolly ? parseEase2(dolly.ease ?? ease) : null;
|
|
3616
3612
|
const pos = (i) => {
|
|
3617
3613
|
const p = i / steps;
|
|
3618
|
-
const a = (start + degrees * easeFn(p)) *
|
|
3614
|
+
const a = (start + degrees * easeFn(p)) * chunkETKTRQL2_cjs.DEG;
|
|
3619
3615
|
if (!dolly) return { x: cx + fixedR * Math.sin(a), z: fixedR * Math.cos(a) };
|
|
3620
3616
|
const f = dolly.from + (dolly.to - dolly.from) * dollyEase(p);
|
|
3621
|
-
const R =
|
|
3617
|
+
const R = chunkETKTRQL2_cjs.homeDistance(height, f);
|
|
3622
3618
|
return { x: cx + R * Math.sin(a), z: R * Math.cos(a), fov: f };
|
|
3623
3619
|
};
|
|
3624
3620
|
const keyframes = [];
|
|
@@ -3673,7 +3669,7 @@ function particles(opts) {
|
|
|
3673
3669
|
const round3 = (v) => Math.round(v * 1e6) / 1e6;
|
|
3674
3670
|
const out = [];
|
|
3675
3671
|
for (let i = 0; i < count; i++) {
|
|
3676
|
-
const r =
|
|
3672
|
+
const r = chunkETKTRQL2_cjs.random(seed * 1000003 + i * 7919 + 17);
|
|
3677
3673
|
const pick = ([a2, b]) => a2 + r() * (b - a2);
|
|
3678
3674
|
const born = at + r() * emit;
|
|
3679
3675
|
const lifetime = pick(life);
|
|
@@ -3686,7 +3682,7 @@ function particles(opts) {
|
|
|
3686
3682
|
const turn = spin ? pick(spin) : 0;
|
|
3687
3683
|
const startAngle = spin ? r() * 360 : 0;
|
|
3688
3684
|
const swayAmp = sway?.amp ?? 0, swayFreq = sway?.freq ?? 1;
|
|
3689
|
-
const n0 = sway ?
|
|
3685
|
+
const n0 = sway ? chunkETKTRQL2_cjs.noise(0, seed * 1000003 + i) : 0;
|
|
3690
3686
|
const at_ = (t) => {
|
|
3691
3687
|
const axis = (p0, v0, acc) => {
|
|
3692
3688
|
if (drag > 0) {
|
|
@@ -3695,7 +3691,7 @@ function particles(opts) {
|
|
|
3695
3691
|
}
|
|
3696
3692
|
return p0 + v0 * t + 0.5 * acc * t * t;
|
|
3697
3693
|
};
|
|
3698
|
-
const sw = sway ? swayAmp * (
|
|
3694
|
+
const sw = sway ? swayAmp * (chunkETKTRQL2_cjs.noise(t * swayFreq, seed * 1000003 + i) - n0) : 0;
|
|
3699
3695
|
return { x: axis(x0, vx, wind) + sw, y: axis(y0, vy, gravity) };
|
|
3700
3696
|
};
|
|
3701
3697
|
const kfs = [];
|
|
@@ -3757,7 +3753,7 @@ function followPath(opts) {
|
|
|
3757
3753
|
if (steps > MAX_STEPS) throw new Error(`followPath(): ${steps} samples is too many (max ${MAX_STEPS}); lower frameRate or duration`);
|
|
3758
3754
|
const segments = [];
|
|
3759
3755
|
let total = 0;
|
|
3760
|
-
for (const line of
|
|
3756
|
+
for (const line of chunkETKTRQL2_cjs.flattenSvgPath(d)) {
|
|
3761
3757
|
const p = line.closed ? [...line.pts, line.pts[0], line.pts[1]] : line.pts;
|
|
3762
3758
|
for (let i = 2; i < p.length; i += 2) {
|
|
3763
3759
|
const len = Math.hypot(p[i] - p[i - 2], p[i + 1] - p[i - 1]);
|
|
@@ -3782,7 +3778,7 @@ function followPath(opts) {
|
|
|
3782
3778
|
const t = Math.min(Math.max((s - g.start) / g.len, 0), 1);
|
|
3783
3779
|
return { x: g.x0 + (g.x1 - g.x0) * t, y: g.y0 + (g.y1 - g.y0) * t, heading: Math.atan2(g.y1 - g.y0, g.x1 - g.x0) * 180 / Math.PI };
|
|
3784
3780
|
};
|
|
3785
|
-
const shape =
|
|
3781
|
+
const shape = parseEase2(ease);
|
|
3786
3782
|
const round3 = (v) => Math.round(v * 1e6) / 1e6;
|
|
3787
3783
|
let turn = 0;
|
|
3788
3784
|
const sample = (k) => {
|
|
@@ -3859,7 +3855,7 @@ function cameraPath(opts) {
|
|
|
3859
3855
|
const a = curve[i], b = curve[i + 1];
|
|
3860
3856
|
return [a[0] + (b[0] - a[0]) * t, a[1] + (b[1] - a[1]) * t, a[2] + (b[2] - a[2]) * t];
|
|
3861
3857
|
};
|
|
3862
|
-
const shape =
|
|
3858
|
+
const shape = parseEase2(ease);
|
|
3863
3859
|
const round3 = (v) => Math.round(v * 1e6) / 1e6;
|
|
3864
3860
|
const sample = (k) => {
|
|
3865
3861
|
const p = from + (to - from) * shape(k / steps);
|
|
@@ -3901,7 +3897,7 @@ function stagger(items, options = {}) {
|
|
|
3901
3897
|
const dist2 = distances(n, from, grid, seed);
|
|
3902
3898
|
const max = dist2.reduce((m, d) => Math.max(m, d), 0);
|
|
3903
3899
|
const total = amount !== void 0 ? amount : (each ?? 0.1) * max;
|
|
3904
|
-
const shape =
|
|
3900
|
+
const shape = parseEase2(ease);
|
|
3905
3901
|
const clamp01 = (v) => Math.min(1, Math.max(0, v));
|
|
3906
3902
|
const delays = dist2.map((d) => max === 0 ? 0 : Math.round(total * clamp01(shape(d / max)) * 1e6) / 1e6);
|
|
3907
3903
|
if (isCount) return delays;
|
|
@@ -3911,7 +3907,7 @@ function distances(n, from, grid, seed) {
|
|
|
3911
3907
|
if (n === 0) return [];
|
|
3912
3908
|
if (from === "random") {
|
|
3913
3909
|
const order = Array.from({ length: n }, (_, i) => i);
|
|
3914
|
-
const r =
|
|
3910
|
+
const r = chunkETKTRQL2_cjs.random(seed);
|
|
3915
3911
|
for (let i = n - 1; i > 0; i--) {
|
|
3916
3912
|
const j = Math.floor(r() * (i + 1));
|
|
3917
3913
|
[order[i], order[j]] = [order[j], order[i]];
|
|
@@ -3973,7 +3969,7 @@ function wiggle(opts) {
|
|
|
3973
3969
|
to[n] = p.around;
|
|
3974
3970
|
return;
|
|
3975
3971
|
}
|
|
3976
|
-
const off = (
|
|
3972
|
+
const off = (chunkETKTRQL2_cjs.rand(seed * 7919 + pi * 104729 + s * 31 + 1) * 2 - 1) * p.amp;
|
|
3977
3973
|
to[n] = typeof p.around === "number" ? p.around + off : `(${p.around}) ${off < 0 ? "-" : "+"} ${Math.abs(off)}`;
|
|
3978
3974
|
});
|
|
3979
3975
|
out.push({ at: at + s * stepLen, to, duration: stepLen, ease });
|
|
@@ -4337,7 +4333,7 @@ async function audioEnvelope(source, options = {}) {
|
|
|
4337
4333
|
|
|
4338
4334
|
// src/audio/musicEnvelope.ts
|
|
4339
4335
|
async function musicEnvelope(music, options = {}) {
|
|
4340
|
-
const { resolveMusic, renderMusic, musicLength, musicBeatTimes, TempoMap } = await import('./music-
|
|
4336
|
+
const { resolveMusic, renderMusic, musicLength, musicBeatTimes, TempoMap } = await import('./music-YPUZTWTN.cjs');
|
|
4341
4337
|
const messages = [];
|
|
4342
4338
|
const m = resolveMusic(music, "musicEnvelope()", (msg) => messages.push(msg));
|
|
4343
4339
|
if (!m) throw new Error(`pixi-effects: musicEnvelope(): ${messages.join(" ") || "the music has nothing to play"}`);
|
|
@@ -4350,7 +4346,7 @@ async function musicEnvelope(music, options = {}) {
|
|
|
4350
4346
|
|
|
4351
4347
|
// src/audio/musicBuffer.ts
|
|
4352
4348
|
async function musicBuffer(music, options = {}) {
|
|
4353
|
-
const { resolveMusic, renderMusic, musicLength } = await import('./music-
|
|
4349
|
+
const { resolveMusic, renderMusic, musicLength } = await import('./music-YPUZTWTN.cjs');
|
|
4354
4350
|
const messages = [];
|
|
4355
4351
|
const m = resolveMusic(music, "musicBuffer()", (msg) => messages.push(msg));
|
|
4356
4352
|
if (!m) throw new Error(`pixi-effects: musicBuffer(): ${messages.join(" ") || "the music has nothing to play"}`);
|
|
@@ -4448,19 +4444,19 @@ function withFade(spec, opts) {
|
|
|
4448
4444
|
|
|
4449
4445
|
Object.defineProperty(exports, "noise", {
|
|
4450
4446
|
enumerable: true,
|
|
4451
|
-
get: function () { return
|
|
4447
|
+
get: function () { return chunkETKTRQL2_cjs.noise; }
|
|
4452
4448
|
});
|
|
4453
4449
|
Object.defineProperty(exports, "rand", {
|
|
4454
4450
|
enumerable: true,
|
|
4455
|
-
get: function () { return
|
|
4451
|
+
get: function () { return chunkETKTRQL2_cjs.rand; }
|
|
4456
4452
|
});
|
|
4457
4453
|
Object.defineProperty(exports, "random", {
|
|
4458
4454
|
enumerable: true,
|
|
4459
|
-
get: function () { return
|
|
4455
|
+
get: function () { return chunkETKTRQL2_cjs.random; }
|
|
4460
4456
|
});
|
|
4461
4457
|
Object.defineProperty(exports, "registerSequenceType", {
|
|
4462
4458
|
enumerable: true,
|
|
4463
|
-
get: function () { return
|
|
4459
|
+
get: function () { return chunkETKTRQL2_cjs.registerSequenceType; }
|
|
4464
4460
|
});
|
|
4465
4461
|
exports.Movie = Movie;
|
|
4466
4462
|
exports.animateText = animateText;
|
|
@@ -4470,6 +4466,7 @@ exports.cameraPath = cameraPath;
|
|
|
4470
4466
|
exports.computeEnvelope = computeEnvelope;
|
|
4471
4467
|
exports.deck = deck;
|
|
4472
4468
|
exports.dismissLoader = dismissLoader;
|
|
4469
|
+
exports.ease = parseEase2;
|
|
4473
4470
|
exports.failLoader = failLoader;
|
|
4474
4471
|
exports.followPath = followPath;
|
|
4475
4472
|
exports.kenBurns = kenBurns;
|