pixi-effects 0.20.0 → 0.21.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 +10 -0
- package/README.md +6 -6
- package/ai/SKILL.md +2 -2
- package/ai/chat-template.html +3 -3
- package/ai/reference/cheatsheet.md +6 -6
- package/ai/reference/pitfalls.md +3 -0
- package/ai/reference/recipes.md +25 -0
- package/ai/template.html +5 -5
- package/ai/tools/check.mjs +1 -1
- package/dist/Composition-2UFPSNVN.cjs +14 -0
- package/dist/{Composition-LL2XXU5N.cjs.map → Composition-2UFPSNVN.cjs.map} +1 -1
- package/dist/Composition-BVI236ZR.js +5 -0
- package/dist/{Composition-6PA4C4TV.js.map → Composition-BVI236ZR.js.map} +1 -1
- package/dist/Controller.d.cts +1 -1
- package/dist/Controller.d.ts +1 -1
- package/dist/{Movie-CBxGH5ms.d.ts → Movie-CgYwa5QG.d.ts} +2 -0
- package/dist/{Movie-CzzJw8A-.d.cts → Movie-mtX9AkQ-.d.cts} +2 -0
- package/dist/Presenter.d.cts +1 -1
- package/dist/Presenter.d.ts +1 -1
- package/dist/{chunk-FFYA3UBU.cjs → chunk-6JJC37ZD.cjs} +216 -38
- package/dist/chunk-6JJC37ZD.cjs.map +1 -0
- package/dist/{chunk-NO26HWR7.cjs → chunk-BPW42X7C.cjs} +94 -5
- package/dist/chunk-BPW42X7C.cjs.map +1 -0
- package/dist/{chunk-DQHXVNOI.js → chunk-DDIXIWXK.js} +88 -6
- package/dist/chunk-DDIXIWXK.js.map +1 -0
- package/dist/{chunk-TSPMKV2F.js → chunk-NGYGFGDS.js} +187 -9
- package/dist/chunk-NGYGFGDS.js.map +1 -0
- package/dist/index.cjs +30 -29
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +5 -4
- package/dist/index.js.map +1 -1
- package/dist/loader.css +1 -1
- package/dist/three.cjs +5 -5
- package/dist/three.js +1 -1
- package/docs/dsl.md +40 -2
- package/llms-full.txt +76 -10
- package/package.json +1 -1
- package/dist/Composition-6PA4C4TV.js +0 -5
- package/dist/Composition-LL2XXU5N.cjs +0 -14
- package/dist/chunk-DQHXVNOI.js.map +0 -1
- package/dist/chunk-FFYA3UBU.cjs.map +0 -1
- package/dist/chunk-NO26HWR7.cjs.map +0 -1
- package/dist/chunk-TSPMKV2F.js.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkBPW42X7C_cjs = require('./chunk-BPW42X7C.cjs');
|
|
4
4
|
var chunkWTRKDIKH_cjs = require('./chunk-WTRKDIKH.cjs');
|
|
5
5
|
var pixi_js = require('pixi.js');
|
|
6
6
|
var gsap = require('gsap');
|
|
@@ -47,6 +47,91 @@ function assignDepthOrder(items) {
|
|
|
47
47
|
}
|
|
48
48
|
return out;
|
|
49
49
|
}
|
|
50
|
+
var DISC_TAPS = 48;
|
|
51
|
+
var GL_VERTEX = `#version 300 es
|
|
52
|
+
in vec2 aPosition;
|
|
53
|
+
out vec2 vTextureCoord;
|
|
54
|
+
uniform vec4 uInputSize;
|
|
55
|
+
uniform vec4 uOutputFrame;
|
|
56
|
+
uniform vec4 uOutputTexture;
|
|
57
|
+
void main(void) {
|
|
58
|
+
vec2 position = aPosition * uOutputFrame.zw + uOutputFrame.xy;
|
|
59
|
+
position.x = position.x * (2.0 / uOutputTexture.x) - 1.0;
|
|
60
|
+
position.y = position.y * (2.0 * uOutputTexture.z / uOutputTexture.y) - uOutputTexture.z;
|
|
61
|
+
gl_Position = vec4(position, 0.0, 1.0);
|
|
62
|
+
vTextureCoord = aPosition * (uOutputFrame.zw * uInputSize.zw);
|
|
63
|
+
}`;
|
|
64
|
+
var GL_FRAGMENT = `#version 300 es
|
|
65
|
+
precision highp float;
|
|
66
|
+
in vec2 vTextureCoord;
|
|
67
|
+
uniform sampler2D uTexture;
|
|
68
|
+
uniform vec4 uInputSize;
|
|
69
|
+
uniform float uRadius;
|
|
70
|
+
out vec4 finalColor;
|
|
71
|
+
void main(void) {
|
|
72
|
+
vec4 acc = vec4(0.0);
|
|
73
|
+
for (int i = 0; i < ${DISC_TAPS}; i++) {
|
|
74
|
+
float r = sqrt((float(i) + 0.5) / ${DISC_TAPS}.0) * uRadius;
|
|
75
|
+
float a = float(i) * 2.39996323;
|
|
76
|
+
acc += texture(uTexture, vTextureCoord + vec2(cos(a), sin(a)) * r * uInputSize.zw);
|
|
77
|
+
}
|
|
78
|
+
finalColor = acc / ${DISC_TAPS}.0;
|
|
79
|
+
}`;
|
|
80
|
+
var WGSL = `
|
|
81
|
+
struct GlobalFilterUniforms {
|
|
82
|
+
uInputSize: vec4<f32>, uInputPixel: vec4<f32>, uInputClamp: vec4<f32>,
|
|
83
|
+
uOutputFrame: vec4<f32>, uGlobalFrame: vec4<f32>, uOutputTexture: vec4<f32>,
|
|
84
|
+
};
|
|
85
|
+
struct DiscUniforms { uRadius: f32 };
|
|
86
|
+
@group(0) @binding(0) var<uniform> gfu: GlobalFilterUniforms;
|
|
87
|
+
@group(0) @binding(1) var uTexture: texture_2d<f32>;
|
|
88
|
+
@group(0) @binding(2) var uSampler : sampler;
|
|
89
|
+
@group(1) @binding(0) var<uniform> disc : DiscUniforms;
|
|
90
|
+
struct VSOutput { @builtin(position) position: vec4<f32>, @location(0) uv : vec2<f32> };
|
|
91
|
+
fn filterVertexPosition(aPosition : vec2<f32>) -> vec4<f32> {
|
|
92
|
+
var position = aPosition * gfu.uOutputFrame.zw + gfu.uOutputFrame.xy;
|
|
93
|
+
position.x = position.x * (2.0 / gfu.uOutputTexture.x) - 1.0;
|
|
94
|
+
position.y = position.y * (2.0 * gfu.uOutputTexture.z / gfu.uOutputTexture.y) - gfu.uOutputTexture.z;
|
|
95
|
+
return vec4<f32>(position, 0.0, 1.0);
|
|
96
|
+
}
|
|
97
|
+
fn filterTextureCoord(aPosition : vec2<f32>) -> vec2<f32> {
|
|
98
|
+
return aPosition * (gfu.uOutputFrame.zw * gfu.uInputSize.zw);
|
|
99
|
+
}
|
|
100
|
+
@vertex
|
|
101
|
+
fn mainVertex(@location(0) aPosition : vec2<f32>) -> VSOutput {
|
|
102
|
+
return VSOutput(filterVertexPosition(aPosition), filterTextureCoord(aPosition));
|
|
103
|
+
}
|
|
104
|
+
@fragment
|
|
105
|
+
fn mainFragment(@location(0) uv : vec2<f32>) -> @location(0) vec4<f32> {
|
|
106
|
+
var acc = vec4<f32>(0.0);
|
|
107
|
+
for (var i = 0; i < ${DISC_TAPS}; i++) {
|
|
108
|
+
let r = sqrt((f32(i) + 0.5) / ${DISC_TAPS}.0) * disc.uRadius;
|
|
109
|
+
let a = f32(i) * 2.39996323;
|
|
110
|
+
acc += textureSampleLevel(uTexture, uSampler, uv + vec2<f32>(cos(a), sin(a)) * r * gfu.uInputSize.zw, 0.0);
|
|
111
|
+
}
|
|
112
|
+
return acc / ${DISC_TAPS}.0;
|
|
113
|
+
}`;
|
|
114
|
+
var DiscBlurFilter = class extends pixi_js.Filter {
|
|
115
|
+
constructor(radius = 8) {
|
|
116
|
+
super({
|
|
117
|
+
glProgram: pixi_js.GlProgram.from({ vertex: GL_VERTEX, fragment: GL_FRAGMENT, name: "disc-blur" }),
|
|
118
|
+
gpuProgram: pixi_js.GpuProgram.from({ vertex: { source: WGSL, entryPoint: "mainVertex" }, fragment: { source: WGSL, entryPoint: "mainFragment" } }),
|
|
119
|
+
resources: { disc: new pixi_js.UniformGroup({ uRadius: { value: radius, type: "f32" } }) }
|
|
120
|
+
});
|
|
121
|
+
this.radius = radius;
|
|
122
|
+
}
|
|
123
|
+
/** Blur radius in pixels. The padding follows it, so the blurred edge is not cut off. */
|
|
124
|
+
get radius() {
|
|
125
|
+
return this.resources.disc.uniforms.uRadius;
|
|
126
|
+
}
|
|
127
|
+
set radius(v) {
|
|
128
|
+
const r = Math.max(0, v);
|
|
129
|
+
this.resources.disc.uniforms.uRadius = r;
|
|
130
|
+
this.padding = Math.ceil(r) + 2;
|
|
131
|
+
}
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
// src/space/Layer3D.ts
|
|
50
135
|
var MAX_TEXTURE_SIZE = 4096;
|
|
51
136
|
var SUPERSAMPLE = 2;
|
|
52
137
|
var MAX_TEXTURE_PIXELS = 2048 * 2048;
|
|
@@ -65,8 +150,8 @@ function readLayerTransform(target) {
|
|
|
65
150
|
x: c.x,
|
|
66
151
|
y: c.y,
|
|
67
152
|
z: c.z ?? 0,
|
|
68
|
-
rotationX: (c.rotationX ?? 0) *
|
|
69
|
-
rotationY: (c.rotationY ?? 0) *
|
|
153
|
+
rotationX: (c.rotationX ?? 0) * chunkBPW42X7C_cjs.DEG,
|
|
154
|
+
rotationY: (c.rotationY ?? 0) * chunkBPW42X7C_cjs.DEG,
|
|
70
155
|
rotationZ: c.rotation,
|
|
71
156
|
scaleX: c.scale.x,
|
|
72
157
|
scaleY: c.scale.y,
|
|
@@ -100,6 +185,10 @@ var Layer3D = class {
|
|
|
100
185
|
retired = [];
|
|
101
186
|
size = null;
|
|
102
187
|
warnedBehind = false;
|
|
188
|
+
/** Depth-of-field blur radius (px) from the last `setBlur`; 0 = no filter. */
|
|
189
|
+
blur = 0;
|
|
190
|
+
blurFilter = null;
|
|
191
|
+
blendWas = "normal";
|
|
103
192
|
update(host, basis) {
|
|
104
193
|
this.flushRetired();
|
|
105
194
|
const target = this.seq.target;
|
|
@@ -111,19 +200,19 @@ var Layer3D = class {
|
|
|
111
200
|
if (!(needW >= 1 && needH >= 1) || !Number.isFinite(bounds.x) || !Number.isFinite(bounds.y)) return this.hide();
|
|
112
201
|
const size = this.sizeFor(needW, needH);
|
|
113
202
|
const frame = { x: bounds.x - pad, y: bounds.y - pad, width: size.w, height: size.h };
|
|
114
|
-
const projected =
|
|
203
|
+
const projected = chunkBPW42X7C_cjs.projectLayer(readLayerTransform(target), frame, basis);
|
|
115
204
|
this.depth = projected.depth;
|
|
116
205
|
if (!projected.visible) {
|
|
117
206
|
if (!this.warnedBehind) {
|
|
118
207
|
this.warnedBehind = true;
|
|
119
208
|
if (this.seq.spec.hideBehindCamera) return this.hide();
|
|
120
|
-
if (projected.depth >
|
|
209
|
+
if (projected.depth > chunkBPW42X7C_cjs.NEAR) {
|
|
121
210
|
console.warn(
|
|
122
|
-
`pixi-effects: ${
|
|
211
|
+
`pixi-effects: ${chunkBPW42X7C_cjs.describeLayer(this.seq.spec)}: part of it (a corner) reaches the camera plane (z = ${(target.z ?? 0).toFixed(0)}, rotationX ${(target.rotationX ?? 0).toFixed(0)}\xB0, rotationY ${(target.rotationY ?? 0).toFixed(0)}\xB0), and a layer is hidden whole when any corner is at or behind it. Tilt it less (rotationX / rotationY), make it smaller, or keep the camera further away from it (the default camera sits at z = (height/2)/tan(fov/2), about 989 for 720p at fov 40).`
|
|
123
212
|
);
|
|
124
213
|
} else {
|
|
125
214
|
console.warn(
|
|
126
|
-
`pixi-effects: ${
|
|
215
|
+
`pixi-effects: ${chunkBPW42X7C_cjs.describeLayer(this.seq.spec)} is at or behind the camera plane (z = ${(target.z ?? 0).toFixed(0)}) and is hidden. If that is unintended, lower its z or move the camera back (the default camera sits at z = (height/2)/tan(fov/2), about 989 for 720p at fov 40).`
|
|
127
216
|
);
|
|
128
217
|
}
|
|
129
218
|
}
|
|
@@ -140,7 +229,37 @@ var Layer3D = class {
|
|
|
140
229
|
this.display.geometry.setCorners(...projected.corners);
|
|
141
230
|
this.display.visible = true;
|
|
142
231
|
}
|
|
232
|
+
/**
|
|
233
|
+
* Depth-of-field blur on the projected mesh (screen space), so a tilted or scaled layer blurs by the size it is drawn at.
|
|
234
|
+
* A radius under MIN_BLUR removes the filter: a sharp layer costs nothing. A blend mode moves to the filter while it is on
|
|
235
|
+
* (a filtered object blends as a whole), and comes back when it goes.
|
|
236
|
+
*/
|
|
237
|
+
setBlur(radius) {
|
|
238
|
+
const d = this.display;
|
|
239
|
+
const r = radius > chunkBPW42X7C_cjs.MIN_BLUR ? Math.min(radius, chunkBPW42X7C_cjs.MAX_BLUR) : 0;
|
|
240
|
+
this.blur = r;
|
|
241
|
+
if (r === 0) {
|
|
242
|
+
if (this.blurFilter) {
|
|
243
|
+
d.filters = null;
|
|
244
|
+
d.blendMode = this.blendWas;
|
|
245
|
+
this.blurFilter.destroy();
|
|
246
|
+
this.blurFilter = null;
|
|
247
|
+
}
|
|
248
|
+
return;
|
|
249
|
+
}
|
|
250
|
+
if (!this.blurFilter) {
|
|
251
|
+
this.blurFilter = new DiscBlurFilter(r);
|
|
252
|
+
this.blendWas = d.blendMode ?? "normal";
|
|
253
|
+
if (this.blendWas !== "normal" && this.blendWas !== "inherit") {
|
|
254
|
+
this.blurFilter.blendMode = this.blendWas;
|
|
255
|
+
d.blendMode = "normal";
|
|
256
|
+
}
|
|
257
|
+
d.filters = [this.blurFilter];
|
|
258
|
+
}
|
|
259
|
+
this.blurFilter.radius = r;
|
|
260
|
+
}
|
|
143
261
|
destroy() {
|
|
262
|
+
this.setBlur(0);
|
|
144
263
|
this.display.destroy();
|
|
145
264
|
this.rt?.destroy(true);
|
|
146
265
|
this.rt = null;
|
|
@@ -192,6 +311,7 @@ var Layer3D = class {
|
|
|
192
311
|
// src/space/lint.ts
|
|
193
312
|
var defaultWarn = (m) => console.warn(m);
|
|
194
313
|
var FOV_HINT = `perspective is the camera's "fov" \u2014 add a { type: "camera" } layer and set fov in its initial / keyframes`;
|
|
314
|
+
var DOF_HINT = `depth of field is the camera's "focus" (the plane that is sharp: a layer name or a z) and "aperture" (how shallow: 0 = off, 30 = default) \u2014 put them in the camera's initial / keyframes`;
|
|
195
315
|
var LAYER_ALIASES = {
|
|
196
316
|
rotateX: 'did you mean "rotationX"?',
|
|
197
317
|
rotateY: 'did you mean "rotationY"?',
|
|
@@ -205,14 +325,20 @@ var LAYER_ALIASES = {
|
|
|
205
325
|
};
|
|
206
326
|
var CAMERA_ALIASES = {
|
|
207
327
|
pointOfInterest: 'did you mean "lookAtX / lookAtY / lookAtZ"?',
|
|
208
|
-
lookAt: 'did you mean "lookAtX / lookAtY / lookAtZ"?'
|
|
328
|
+
lookAt: 'did you mean "lookAtX / lookAtY / lookAtZ"?',
|
|
329
|
+
depthOfField: DOF_HINT,
|
|
330
|
+
dof: DOF_HINT,
|
|
331
|
+
focalDistance: DOF_HINT,
|
|
332
|
+
focusDistance: DOF_HINT,
|
|
333
|
+
fStop: DOF_HINT,
|
|
334
|
+
blurAmount: DOF_HINT
|
|
209
335
|
};
|
|
210
|
-
var CAMERA_PROPS = ["x", "y", "z", "fov", "lookAtX", "lookAtY", "lookAtZ", "offsetX", "offsetY", "offsetZ", "lookOffsetX", "lookOffsetY", "lookOffsetZ"];
|
|
336
|
+
var CAMERA_PROPS = ["x", "y", "z", "fov", "focus", "aperture", "lookAtX", "lookAtY", "lookAtZ", "offsetX", "offsetY", "offsetZ", "lookOffsetX", "lookOffsetY", "lookOffsetZ"];
|
|
211
337
|
var NEEDS_THREE_D = ["z", "rotationX", "rotationY"];
|
|
212
338
|
var SKEW_KEYS = ["skew", "skewX", "skewY"];
|
|
213
339
|
function lintSequence(spec, warn = defaultWarn) {
|
|
214
|
-
const who =
|
|
215
|
-
const keys =
|
|
340
|
+
const who = chunkBPW42X7C_cjs.describeLayer(spec);
|
|
341
|
+
const keys = chunkBPW42X7C_cjs.collectPropKeys(spec);
|
|
216
342
|
const explained = /* @__PURE__ */ new Set();
|
|
217
343
|
for (const k of keys) {
|
|
218
344
|
const hint = LAYER_ALIASES[k] ?? (spec.type === "camera" ? CAMERA_ALIASES[k] : void 0);
|
|
@@ -251,6 +377,19 @@ function lintSequence(spec, warn = defaultWarn) {
|
|
|
251
377
|
}
|
|
252
378
|
}
|
|
253
379
|
}
|
|
380
|
+
function lintFocus(camera, siblings, warn = defaultWarn) {
|
|
381
|
+
if (camera.type !== "camera") return;
|
|
382
|
+
const who = chunkBPW42X7C_cjs.describeLayer(camera);
|
|
383
|
+
for (const p of chunkBPW42X7C_cjs.focusProblems(camera, siblings)) {
|
|
384
|
+
if (p.kind === "missing") {
|
|
385
|
+
warn(`pixi-effects: ${who}: focus: no layer named "${p.name}"${p.hint ? `; did you mean "${p.hint}"?` : ""} (the z = 0 plane is used). Write a threeD layer's name or a z number`);
|
|
386
|
+
} else if (p.kind === "not-threeD") {
|
|
387
|
+
warn(`pixi-effects: ${who}: focus "${p.name}" is not a threeD layer, so it has no depth (the z = 0 plane is used). Write a threeD layer's name or a z number`);
|
|
388
|
+
} else {
|
|
389
|
+
warn(`pixi-effects: ${who}: focus "${p.name}" reads only the first z of that layer; its z moves later and the focus does not follow. Animate focus itself with numbers to follow it`);
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
}
|
|
254
393
|
|
|
255
394
|
// src/core/blend.ts
|
|
256
395
|
var MODES = ["normal", "add", "screen", "multiply"];
|
|
@@ -258,7 +397,7 @@ function applyBlendMode(spec, display) {
|
|
|
258
397
|
const mode = spec.blendMode;
|
|
259
398
|
if (mode === void 0) return;
|
|
260
399
|
if (!MODES.includes(mode)) {
|
|
261
|
-
console.warn(`pixi-effects: ${
|
|
400
|
+
console.warn(`pixi-effects: ${chunkBPW42X7C_cjs.describeLayer(spec)}: blendMode "${mode}" is not supported (use ${MODES.join(", ")})`);
|
|
262
401
|
return;
|
|
263
402
|
}
|
|
264
403
|
const filters = display.filters;
|
|
@@ -270,12 +409,13 @@ function applyBlendMode(spec, display) {
|
|
|
270
409
|
}
|
|
271
410
|
|
|
272
411
|
// src/sequences/Composition.ts
|
|
273
|
-
var CompositionSequence = class extends
|
|
412
|
+
var CompositionSequence = class extends chunkBPW42X7C_cjs.Sequence {
|
|
274
413
|
_innerContainer = null;
|
|
275
414
|
_compositionShape = null;
|
|
276
415
|
_children = [];
|
|
277
416
|
_cameras = [];
|
|
278
417
|
_layers3d = [];
|
|
418
|
+
_dofSaid = { behind: false, many: false };
|
|
279
419
|
/** Drawn children in stack order (cameras and target-less sequences excluded). */
|
|
280
420
|
_visual = [];
|
|
281
421
|
/** Layers drawn inside a null layer (`parent`): they are not in the composition's own stack. */
|
|
@@ -328,27 +468,36 @@ var CompositionSequence = class extends chunkNO26HWR7_cjs.Sequence {
|
|
|
328
468
|
this.intrinsicWidth = width;
|
|
329
469
|
this.intrinsicHeight = height;
|
|
330
470
|
this._innerContainer = inner;
|
|
331
|
-
const base =
|
|
332
|
-
const span = base ?
|
|
333
|
-
this._remap = base ?
|
|
471
|
+
const base = chunkBPW42X7C_cjs.timeRemapOf(this.spec);
|
|
472
|
+
const span = base ? chunkBPW42X7C_cjs.contentLength(base, this.duration) : this.duration;
|
|
473
|
+
this._remap = base ? chunkBPW42X7C_cjs.remapOf(this.spec, "time", span) : null;
|
|
334
474
|
this._contentSpan = span;
|
|
335
475
|
this._compositionShape = { width, height, duration: span };
|
|
336
476
|
const lateKeyframes = [];
|
|
337
477
|
for (const s of this.spec.sequences ?? []) {
|
|
338
478
|
lintSequence(s);
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
479
|
+
lintFocus(s, this.spec.sequences ?? []);
|
|
480
|
+
chunkBPW42X7C_cjs.lintTiming(s, span, (message, kind) => kind === "late-keyframe" ? lateKeyframes.push(message) : console.warn(message));
|
|
481
|
+
chunkBPW42X7C_cjs.lintText(s);
|
|
482
|
+
chunkBPW42X7C_cjs.lintKeys(s);
|
|
342
483
|
}
|
|
343
|
-
for (const message of
|
|
344
|
-
this._children = await
|
|
484
|
+
for (const message of chunkBPW42X7C_cjs.summarizeWarnings(lateKeyframes)) console.warn(message);
|
|
485
|
+
this._children = await chunkBPW42X7C_cjs.buildSequenceTree(
|
|
345
486
|
this.spec.sequences ?? [],
|
|
346
487
|
this._compositionShape,
|
|
347
488
|
this.root
|
|
348
489
|
);
|
|
349
490
|
this._resolveParents();
|
|
491
|
+
const layerNames = new Set(this._children.map((c) => c.spec.name).filter((n) => !!n));
|
|
492
|
+
for (const cam of this._children) {
|
|
493
|
+
if (!(cam instanceof chunkBPW42X7C_cjs.CameraSequence)) continue;
|
|
494
|
+
cam.resolveFocusNames((name) => {
|
|
495
|
+
const hit = this._children.find((c) => c.spec.name === name && c.spec.threeD);
|
|
496
|
+
return hit ? chunkBPW42X7C_cjs.layerInitialZ(hit.spec, hit.scope()) : void 0;
|
|
497
|
+
}, layerNames);
|
|
498
|
+
}
|
|
350
499
|
for (const child of this._children) {
|
|
351
|
-
if (child instanceof
|
|
500
|
+
if (child instanceof chunkBPW42X7C_cjs.CameraSequence) {
|
|
352
501
|
this._cameras.push(child);
|
|
353
502
|
continue;
|
|
354
503
|
}
|
|
@@ -363,7 +512,7 @@ var CompositionSequence = class extends chunkNO26HWR7_cjs.Sequence {
|
|
|
363
512
|
this._visual.push({ seq: child, layer });
|
|
364
513
|
applyBlendMode(child.spec, layer.display);
|
|
365
514
|
if (maskSpec) {
|
|
366
|
-
console.warn(`pixi-effects: ${
|
|
515
|
+
console.warn(`pixi-effects: ${chunkBPW42X7C_cjs.describeLayer(child.spec)}: mask is not supported on threeD layers yet; ignored`);
|
|
367
516
|
}
|
|
368
517
|
continue;
|
|
369
518
|
}
|
|
@@ -373,7 +522,7 @@ var CompositionSequence = class extends chunkNO26HWR7_cjs.Sequence {
|
|
|
373
522
|
applyBlendMode(child.spec, child.target);
|
|
374
523
|
if (maskSpec) {
|
|
375
524
|
const lifetime = maskSpec.at === void 0 ? { at: child.at, duration: maskSpec.duration ?? child.duration } : {};
|
|
376
|
-
const built = await
|
|
525
|
+
const built = await chunkBPW42X7C_cjs.buildSequenceTree([{ ...maskSpec, ...lifetime }], this._compositionShape, this.root);
|
|
377
526
|
const maskSeq = built[0];
|
|
378
527
|
if (maskSeq?.target) {
|
|
379
528
|
into.addChild(maskSeq.target);
|
|
@@ -445,11 +594,11 @@ var CompositionSequence = class extends chunkNO26HWR7_cjs.Sequence {
|
|
|
445
594
|
this._clock = clock;
|
|
446
595
|
const scope = this.scope();
|
|
447
596
|
if (remap.start !== void 0 && remap.timeKfs.length === 0) clock.time = remap.start;
|
|
448
|
-
|
|
597
|
+
chunkBPW42X7C_cjs.bindClock(timeline, clock, "time", remap, this.duration, offset + this.at, scope);
|
|
449
598
|
inner.time(inner.duration());
|
|
450
599
|
inner.time(0);
|
|
451
600
|
last = NaN;
|
|
452
|
-
this._warnUnreachable(
|
|
601
|
+
this._warnUnreachable(chunkBPW42X7C_cjs.clockTable(remap, "time", this.duration, offset + this.at, scope, offset + this.at + this.duration), offset + this.at, offset + this.at + this.duration);
|
|
453
602
|
}
|
|
454
603
|
/**
|
|
455
604
|
* A child the clock never dwells in is never visible: say so. Its `at` is in THIS composition's local time, so the usual mistake is
|
|
@@ -473,7 +622,7 @@ var CompositionSequence = class extends chunkNO26HWR7_cjs.Sequence {
|
|
|
473
622
|
}
|
|
474
623
|
if (dwell >= 2) continue;
|
|
475
624
|
console.warn(
|
|
476
|
-
`pixi-effects: ${
|
|
625
|
+
`pixi-effects: ${chunkBPW42X7C_cjs.describeLayer(child.spec)} starts at ${at}s of ${chunkBPW42X7C_cjs.describeLayer(this.spec)}'s own time, but its clock only reaches ${Number(table.min.toFixed(3))}\u2013${Number(table.max.toFixed(3))}s (${how}), so it is never visible. Layers inside a remapped composition are placed in that composition's local time.`
|
|
477
626
|
);
|
|
478
627
|
}
|
|
479
628
|
}
|
|
@@ -487,26 +636,27 @@ var CompositionSequence = class extends chunkNO26HWR7_cjs.Sequence {
|
|
|
487
636
|
for (let p = this._parentOf.get(seq); p; p = this._parentOf.get(p)) out.push(p);
|
|
488
637
|
return out;
|
|
489
638
|
};
|
|
490
|
-
return [...this._visual.map((v) => v.seq), ...this._nested].filter((seq) => !(seq instanceof
|
|
639
|
+
return [...this._visual.map((v) => v.seq), ...this._nested].filter((seq) => !(seq instanceof chunkBPW42X7C_cjs.NullSequence)).map((seq) => {
|
|
491
640
|
const layer = this._visual.find((v) => v.seq === seq)?.layer ?? null;
|
|
492
641
|
return {
|
|
493
642
|
seq,
|
|
494
643
|
display: layer?.display ?? seq.target,
|
|
495
644
|
threeD: layer !== null,
|
|
496
|
-
carriers: carriersOf(seq)
|
|
645
|
+
carriers: carriersOf(seq),
|
|
646
|
+
depthBlur: layer?.blur ?? 0
|
|
497
647
|
};
|
|
498
648
|
});
|
|
499
649
|
}
|
|
500
650
|
/** Match every `parent: 'name'` to a null layer; anything that cannot work is said out loud and drawn unparented. */
|
|
501
651
|
_resolveParents() {
|
|
502
|
-
const nulls = this._children.filter((c) => c instanceof
|
|
652
|
+
const nulls = this._children.filter((c) => c instanceof chunkBPW42X7C_cjs.NullSequence);
|
|
503
653
|
const nullNames = nulls.map((n) => n.spec.name).filter((n) => !!n);
|
|
504
654
|
const warned = /* @__PURE__ */ new Set();
|
|
505
655
|
for (const child of this._children) {
|
|
506
656
|
const want = child.spec.parent;
|
|
507
657
|
if (want === void 0) continue;
|
|
508
|
-
const who =
|
|
509
|
-
if (child instanceof
|
|
658
|
+
const who = chunkBPW42X7C_cjs.describeLayer(child.spec);
|
|
659
|
+
if (child instanceof chunkBPW42X7C_cjs.CameraSequence) {
|
|
510
660
|
console.warn(`pixi-effects: ${who}: a camera cannot have a parent; ignored`);
|
|
511
661
|
continue;
|
|
512
662
|
}
|
|
@@ -520,7 +670,7 @@ var CompositionSequence = class extends chunkNO26HWR7_cjs.Sequence {
|
|
|
520
670
|
console.warn(`pixi-effects: ${who}: parent "${want}": no layer with that name${hint ? `; did you mean "${hint}"?` : ""} (the layer is drawn without a parent)`);
|
|
521
671
|
continue;
|
|
522
672
|
}
|
|
523
|
-
const holder = same.find((c) => c instanceof
|
|
673
|
+
const holder = same.find((c) => c instanceof chunkBPW42X7C_cjs.NullSequence);
|
|
524
674
|
if (!holder) {
|
|
525
675
|
console.warn(`pixi-effects: ${who}: parent "${want}" is a ${same[0].spec.type} layer; only { type: 'null' } layers can be parents (the layer is drawn without a parent)`);
|
|
526
676
|
continue;
|
|
@@ -560,12 +710,14 @@ var CompositionSequence = class extends chunkNO26HWR7_cjs.Sequence {
|
|
|
560
710
|
const { width, height } = this._compositionShape;
|
|
561
711
|
const compEnd = this._childBase + (this.duration ?? 0);
|
|
562
712
|
const active = pickActiveCamera(
|
|
563
|
-
this._cameras.map((
|
|
713
|
+
this._cameras.map((cam2) => ({ cam: cam2, ...cam2.window() })),
|
|
564
714
|
childT,
|
|
565
715
|
compEnd
|
|
566
716
|
);
|
|
567
|
-
const
|
|
717
|
+
const cam = active ? active.cam.state() : chunkBPW42X7C_cjs.homeCamera(width, height);
|
|
718
|
+
const basis = chunkBPW42X7C_cjs.cameraBasis(cam, width, height);
|
|
568
719
|
for (const layer of this._layers3d) layer.update(host, basis);
|
|
720
|
+
this._applyDepthOfField(cam, basis);
|
|
569
721
|
const order = assignDepthOrder(
|
|
570
722
|
this._visual.map((v, i) => ({ stackIndex: i, threeD: v.layer !== null, depth: v.layer?.depth ?? 0 }))
|
|
571
723
|
);
|
|
@@ -573,6 +725,32 @@ var CompositionSequence = class extends chunkNO26HWR7_cjs.Sequence {
|
|
|
573
725
|
if (v.layer) v.layer.display.zIndex = order[i];
|
|
574
726
|
});
|
|
575
727
|
}
|
|
728
|
+
/** Depth of field: each threeD layer is blurred by how far its depth is from the focal plane (a pure function of the camera and the layers). */
|
|
729
|
+
_applyDepthOfField(cam, basis) {
|
|
730
|
+
const aperture = cam.aperture ?? 0;
|
|
731
|
+
if (!(aperture > 0)) {
|
|
732
|
+
for (const l of this._layers3d) l.setBlur(0);
|
|
733
|
+
return;
|
|
734
|
+
}
|
|
735
|
+
const focusDepth = chunkBPW42X7C_cjs.projectPoint(basis, { x: cam.lookAtX, y: cam.lookAtY, z: cam.focus ?? 0 }).depth;
|
|
736
|
+
if (!(focusDepth > chunkBPW42X7C_cjs.NEAR)) {
|
|
737
|
+
if (!this._dofSaid.behind) {
|
|
738
|
+
this._dofSaid.behind = true;
|
|
739
|
+
console.warn(`pixi-effects: ${chunkBPW42X7C_cjs.describeLayer(this.spec)}: the camera's focus (z = ${(cam.focus ?? 0).toFixed(0)}) is at or behind the camera, so nothing is blurred. Put focus in front of the camera (a z below the camera's z)`);
|
|
740
|
+
}
|
|
741
|
+
for (const l of this._layers3d) l.setBlur(0);
|
|
742
|
+
return;
|
|
743
|
+
}
|
|
744
|
+
let blurred = 0;
|
|
745
|
+
for (const l of this._layers3d) {
|
|
746
|
+
l.setBlur(l.display.visible ? chunkBPW42X7C_cjs.blurRadius(aperture, basis.focal, l.depth, focusDepth) : 0);
|
|
747
|
+
if (l.blur > 0) blurred++;
|
|
748
|
+
}
|
|
749
|
+
if (blurred >= chunkBPW42X7C_cjs.MANY_BLURRED && !this._dofSaid.many) {
|
|
750
|
+
this._dofSaid.many = true;
|
|
751
|
+
console.warn(`pixi-effects: ${chunkBPW42X7C_cjs.describeLayer(this.spec)}: ${blurred} layers are blurred by depth of field at once; each costs a filter pass per frame (WebGPU more). Merge the far layers or lower aperture`);
|
|
752
|
+
}
|
|
753
|
+
}
|
|
576
754
|
collectAudio(out, baseTime) {
|
|
577
755
|
super.collectAudio(out, baseTime);
|
|
578
756
|
const remap = this._remap;
|
|
@@ -584,7 +762,7 @@ var CompositionSequence = class extends chunkNO26HWR7_cjs.Sequence {
|
|
|
584
762
|
const inner = [];
|
|
585
763
|
for (const child of this._children) child.collectAudio(inner, 0);
|
|
586
764
|
const lo = baseTime + this.at, hi = lo + this.duration;
|
|
587
|
-
const table =
|
|
765
|
+
const table = chunkBPW42X7C_cjs.clockTable(remap, "time", this.duration, lo, this.scope(), hi);
|
|
588
766
|
for (const d of inner) {
|
|
589
767
|
const prev = d.warp;
|
|
590
768
|
out.push({ ...d, warp: (t) => t < lo || t > hi ? NaN : prev ? prev(table.at(t)) : table.at(t) });
|
|
@@ -608,5 +786,5 @@ function frameOf(child) {
|
|
|
608
786
|
}
|
|
609
787
|
|
|
610
788
|
exports.CompositionSequence = CompositionSequence;
|
|
611
|
-
//# sourceMappingURL=chunk-
|
|
612
|
-
//# sourceMappingURL=chunk-
|
|
789
|
+
//# sourceMappingURL=chunk-6JJC37ZD.cjs.map
|
|
790
|
+
//# sourceMappingURL=chunk-6JJC37ZD.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/space/camera.ts","../src/space/depth.ts","../src/filters/DiscBlur.ts","../src/space/Layer3D.ts","../src/space/lint.ts","../src/core/blend.ts","../src/sequences/Composition.ts"],"names":["i","Filter","GlProgram","GpuProgram","UniformGroup","DEG","frameOf","PerspectiveMesh","Texture","projectLayer","NEAR","describeLayer","Matrix","MIN_BLUR","MAX_BLUR","RenderTexture","collectPropKeys","focusProblems","Sequence","Container","Rectangle","timeRemapOf","contentLength","remapOf","lintTiming","lintText","lintKeys","summarizeWarnings","buildSequenceTree","CameraSequence","layerInitialZ","AlphaMask","gsap","bindClock","clockTable","NullSequence","suggestName","cam","homeCamera","cameraBasis","projectPoint","blurRadius","MANY_BLURRED"],"mappings":";;;;;;;;AAQO,SAAS,gBAAA,CACd,IAAA,EACA,CAAA,EACA,OAAA,EACU;AACV,EAAA,KAAA,IAAS,IAAI,IAAA,CAAK,MAAA,GAAS,CAAA,EAAG,CAAA,IAAK,GAAG,CAAA,EAAA,EAAK;AACzC,IAAA,MAAM,CAAA,GAAI,KAAK,CAAC,CAAA;AAChB,IAAA,MAAM,MAAA,GAAS,CAAA,IAAK,CAAA,CAAE,KAAA,KAAU,CAAA,GAAI,EAAE,GAAA,IAAQ,CAAA,CAAE,GAAA,IAAO,OAAA,IAAW,CAAA,IAAK,OAAA,CAAA;AACvE,IAAA,IAAI,QAAQ,OAAO,CAAA;AAAA,EACrB;AACA,EAAA,OAAO,IAAA;AACT;AAGO,SAAS,YAAY,IAAA,EAAwD;AAClF,EAAA,KAAA,IAAS,CAAA,GAAI,CAAA,EAAG,CAAA,GAAI,IAAA,CAAK,QAAQ,CAAA,EAAA,EAAK;AACpC,IAAA,KAAA,IAAS,IAAI,CAAA,GAAI,CAAA,EAAG,CAAA,GAAI,IAAA,CAAK,QAAQ,CAAA,EAAA,EAAK;AACxC,MAAA,MAAM,CAAA,GAAI,KAAK,CAAC,CAAA;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CAAG,CAAC,CAAC,IAAI,KAAA,CAAM,EAAA,CAAG,CAAC,CAAA,EAAI,CAAA;AAAA,IAC3G;AAAA,EACF;AAAA,EAES,OAAA,GAAgB;AACvB,IAAA,IAAA,CAAK,QAAQ,IAAA,EAAK;AAClB,IAAA,IAAA,CAAK,MAAA,GAAS,IAAA;AACd,IAAA,IAAA,CAAK,MAAA,GAAS,IAAA;AACd,IAAA,KAAA,MAAW,CAAA,IAAK,IAAA,CAAK,SAAA,EAAW,CAAA,CAAE,OAAA,EAAQ;AAC1C,IAAA,IAAA,CAAK,YAAY,EAAC;AAClB,IAAA,KAAA,MAAW,CAAA,IAAK,IAAA,CAAK,SAAA,EAAW,CAAA,CAAE,OAAA,EAAQ;AAC1C,IAAA,KAAA,CAAM,OAAA,EAAQ;AAAA,EAChB;AACF;AAGA,SAAS,QAAQ,KAAA,EAAgF;AAC/F,EAAA,IAAI,iBAAiB,mBAAA,EAAqB;AACxC,IAAA,OAAO,OAAO,EAAE,CAAA,EAAG,CAAA,EAAG,CAAA,EAAG,CAAA,EAAG,KAAA,EAAO,KAAA,CAAM,cAAA,EAAgB,MAAA,EAAQ,KAAA,CAAM,eAAA,EAAgB,CAAA;AAAA,EACzF;AACA,EAAA,OAAO,MAAM,KAAA,CAAM,MAAA,CAAQ,cAAA,EAAe;AAC5C","file":"chunk-6JJC37ZD.cjs","sourcesContent":["/** A camera layer's lifespan on the global timeline, seconds. */\nexport interface CameraWindow { start: number; end: number }\n\n/**\n * The active camera at time `t`: the last-listed (top-most) camera whose\n * lifespan covers `t`. Windows are [start, end), except that a camera running\n * to the end of its composition also covers the final instant `t === compEnd`.\n */\nexport function pickActiveCamera<T extends CameraWindow>(\n cams: readonly T[],\n t: number,\n compEnd: number,\n): T | null {\n for (let i = cams.length - 1; i >= 0; i--) {\n const c = cams[i]!;\n const inside = t >= c.start && (t < c.end || (c.end >= compEnd && t <= compEnd));\n if (inside) return c;\n }\n return null;\n}\n\n/** First pair of camera indices whose lifespans strictly overlap, or null. */\nexport function findOverlap(cams: readonly CameraWindow[]): [number, number] | null {\n for (let i = 0; i < cams.length; i++) {\n for (let j = i + 1; j < cams.length; j++) {\n const a = cams[i]!;\n const b = cams[j]!;\n if (a.start < b.end && b.start < a.end) return [i, j];\n }\n }\n return null;\n}\n","export interface DepthItem {\n /** Position in the composition's stack (monotonic; gaps allowed). */\n stackIndex: number;\n threeD: boolean;\n /** Camera-space depth (larger = farther). Only read for threeD items. */\n depth: number;\n}\n\nconst finite = (n: number): number => (Number.isFinite(n) ? n : 0);\n\n/**\n * zIndex per item. Non-3D items keep their stack index. Each run of\n * consecutive threeD items is redistributed over the same index slots,\n * farthest first (drawn first), ties in stack order.\n */\nexport function assignDepthOrder(items: readonly DepthItem[]): number[] {\n const out = items.map(i => i.stackIndex);\n let i = 0;\n while (i < items.length) {\n if (!items[i]!.threeD) { i++; continue; }\n let j = i;\n while (j + 1 < items.length && items[j + 1]!.threeD) j++;\n const run = items.slice(i, j + 1).map((it, k) => ({ it, pos: i + k }));\n const slots = run.map(r => r.it.stackIndex);\n const farthestFirst = [...run].sort((a, b) => finite(b.it.depth) - finite(a.it.depth));\n farthestFirst.forEach((r, k) => { out[r.pos] = slots[k]!; });\n i = j + 1;\n }\n return out;\n}\n","import { Filter, GlProgram, GpuProgram, UniformGroup } from 'pixi.js';\n\n/**\n * One-pass disc (\"bokeh\") blur for depth of field: the taps sit on a golden-angle spiral, so the result is a pure function of the\n * pixels (no noise, no time) and the same frame is the same picture whichever way it was reached. The radius is in pixels.\n */\nexport const DISC_TAPS = 48;\n\n// pixi compiles GLSL as WebGL1-compatible by default; a shader that starts with `#version 300 es` is kept as ES 3.00,\n// and then the vertex shader must be ES 3.00 too.\nconst GL_VERTEX = `#version 300 es\nin vec2 aPosition;\nout vec2 vTextureCoord;\nuniform vec4 uInputSize;\nuniform vec4 uOutputFrame;\nuniform vec4 uOutputTexture;\nvoid main(void) {\n vec2 position = aPosition * uOutputFrame.zw + uOutputFrame.xy;\n position.x = position.x * (2.0 / uOutputTexture.x) - 1.0;\n position.y = position.y * (2.0 * uOutputTexture.z / uOutputTexture.y) - uOutputTexture.z;\n gl_Position = vec4(position, 0.0, 1.0);\n vTextureCoord = aPosition * (uOutputFrame.zw * uInputSize.zw);\n}`;\n\nconst GL_FRAGMENT = `#version 300 es\nprecision highp float;\nin vec2 vTextureCoord;\nuniform sampler2D uTexture;\nuniform vec4 uInputSize;\nuniform float uRadius;\nout vec4 finalColor;\nvoid main(void) {\n vec4 acc = vec4(0.0);\n for (int i = 0; i < ${DISC_TAPS}; i++) {\n float r = sqrt((float(i) + 0.5) / ${DISC_TAPS}.0) * uRadius;\n float a = float(i) * 2.39996323;\n acc += texture(uTexture, vTextureCoord + vec2(cos(a), sin(a)) * r * uInputSize.zw);\n }\n finalColor = acc / ${DISC_TAPS}.0;\n}`;\n\nconst WGSL = `\nstruct GlobalFilterUniforms {\n uInputSize: vec4<f32>, uInputPixel: vec4<f32>, uInputClamp: vec4<f32>,\n uOutputFrame: vec4<f32>, uGlobalFrame: vec4<f32>, uOutputTexture: vec4<f32>,\n};\nstruct DiscUniforms { uRadius: f32 };\n@group(0) @binding(0) var<uniform> gfu: GlobalFilterUniforms;\n@group(0) @binding(1) var uTexture: texture_2d<f32>;\n@group(0) @binding(2) var uSampler : sampler;\n@group(1) @binding(0) var<uniform> disc : DiscUniforms;\nstruct VSOutput { @builtin(position) position: vec4<f32>, @location(0) uv : vec2<f32> };\nfn filterVertexPosition(aPosition : vec2<f32>) -> vec4<f32> {\n var position = aPosition * gfu.uOutputFrame.zw + gfu.uOutputFrame.xy;\n position.x = position.x * (2.0 / gfu.uOutputTexture.x) - 1.0;\n position.y = position.y * (2.0 * gfu.uOutputTexture.z / gfu.uOutputTexture.y) - gfu.uOutputTexture.z;\n return vec4<f32>(position, 0.0, 1.0);\n}\nfn filterTextureCoord(aPosition : vec2<f32>) -> vec2<f32> {\n return aPosition * (gfu.uOutputFrame.zw * gfu.uInputSize.zw);\n}\n@vertex\nfn mainVertex(@location(0) aPosition : vec2<f32>) -> VSOutput {\n return VSOutput(filterVertexPosition(aPosition), filterTextureCoord(aPosition));\n}\n@fragment\nfn mainFragment(@location(0) uv : vec2<f32>) -> @location(0) vec4<f32> {\n var acc = vec4<f32>(0.0);\n for (var i = 0; i < ${DISC_TAPS}; i++) {\n let r = sqrt((f32(i) + 0.5) / ${DISC_TAPS}.0) * disc.uRadius;\n let a = f32(i) * 2.39996323;\n acc += textureSampleLevel(uTexture, uSampler, uv + vec2<f32>(cos(a), sin(a)) * r * gfu.uInputSize.zw, 0.0);\n }\n return acc / ${DISC_TAPS}.0;\n}`;\n\nexport class DiscBlurFilter extends Filter {\n constructor(radius = 8) {\n super({\n glProgram: GlProgram.from({ vertex: GL_VERTEX, fragment: GL_FRAGMENT, name: 'disc-blur' }),\n gpuProgram: GpuProgram.from({ vertex: { source: WGSL, entryPoint: 'mainVertex' }, fragment: { source: WGSL, entryPoint: 'mainFragment' } }),\n resources: { disc: new UniformGroup({ uRadius: { value: radius, type: 'f32' } }) },\n });\n this.radius = radius;\n }\n\n /** Blur radius in pixels. The padding follows it, so the blurred edge is not cut off. */\n get radius(): number { return (this.resources.disc as UniformGroup).uniforms.uRadius as number; }\n set radius(v: number) {\n const r = Math.max(0, v);\n (this.resources.disc as UniformGroup).uniforms.uRadius = r;\n this.padding = Math.ceil(r) + 2;\n }\n}\n","import { Container, Matrix, PerspectiveMesh, RenderTexture, Texture } from 'pixi.js';\nimport type { Sequence } from '../sequences/Base';\nimport { DiscBlurFilter } from '../filters/DiscBlur';\nimport { MAX_BLUR, MIN_BLUR } from './focus';\nimport { describeLayer } from '../core/lint';\nimport { DEG, NEAR, projectLayer, type CameraBasis, type LayerTransform, type Rect } from './math';\n\n/** Render textures are capped at this many pixels on the long side; larger layers are downscaled. */\nexport const MAX_TEXTURE_SIZE = 4096;\n/**\n * Render textures are drawn at this multiple of the layer size (until the caps),\n * so a layer enlarged by perspective (z > 0) stays sharp instead of showing\n * jagged edges and soft text.\n */\nexport const SUPERSAMPLE = 2;\n/** Total texture pixels per layer are capped here (≈ one 2048² target); resolution drops to fit. */\nexport const MAX_TEXTURE_PIXELS = 2048 * 2048;\n/** MSAA multiplies target memory ~4x, so only small textures get it (supersampling covers the rest). */\nexport const ANTIALIAS_MAX_PIXELS = 1024 * 1024;\n/** Mesh grid per side. 20 keeps steeply tilted planes free of visible affine warping. */\nexport const MESH_GRID = 20;\n\n/** The slice of a Pixi renderer Layer3D needs (also what tests fake). */\nexport interface SpaceHost {\n render(options: {\n container: Container;\n target: RenderTexture;\n transform: Matrix;\n clear: boolean;\n clearColor: number[];\n }): void;\n}\n\ntype Carrier = Container & { z?: number; rotationX?: number; rotationY?: number };\n\ninterface TextureSize { w: number; h: number; resolution: number; antialias: boolean }\n\n/** Sum of the target's filter paddings: the texture must be this much larger on every side or filter output is clipped. */\nfunction filterPadding(target: Container): number {\n const filters = (target as unknown as { filters?: ReadonlyArray<{ padding?: number }> | null }).filters;\n if (!Array.isArray(filters)) return 0;\n let pad = 0;\n for (const f of filters) pad += f?.padding ?? 0;\n return Number.isFinite(pad) && pad > 0 ? Math.ceil(pad) : 0;\n}\n\nexport function readLayerTransform(target: Container): LayerTransform {\n const c = target as Carrier;\n return {\n x: c.x, y: c.y, z: c.z ?? 0,\n rotationX: (c.rotationX ?? 0) * DEG,\n rotationY: (c.rotationY ?? 0) * DEG,\n rotationZ: c.rotation,\n scaleX: c.scale.x, scaleY: c.scale.y,\n pivotX: c.pivot.x, pivotY: c.pivot.y,\n };\n}\n\n/**\n * Draws one `threeD` sequence: its display object is rendered into a\n * RenderTexture (with its own 2D transform replaced, so layer-local content\n * lands at the texture origin) and shown on a PerspectiveMesh whose four\n * corners come from projecting the layer through the active camera.\n *\n * The sequence's `target` is never in the scene graph; the composition adds\n * `display` instead. `z`, `rotationX`, `rotationY` live on `target` as plain\n * numeric props so GSAP tweens them like any other prop.\n */\nexport class Layer3D {\n readonly display: PerspectiveMesh;\n /** Camera-space depth from the last update (larger = farther). */\n depth = 0;\n private rt: RenderTexture | null = null;\n /**\n * Textures replaced by a bigger / smaller one. Destroying one right away warns \"destroyed while still\n * bound\": the mesh's bind group still points at it until the next render. They go at the next update,\n * by which time a frame has been drawn with the new texture.\n */\n private retired: RenderTexture[] = [];\n private size: TextureSize | null = null;\n private warnedBehind = false;\n /** Depth-of-field blur radius (px) from the last `setBlur`; 0 = no filter. */\n blur = 0;\n private blurFilter: DiscBlurFilter | null = null;\n private blendWas = 'normal';\n\n constructor(\n private readonly seq: Sequence,\n private readonly frameOf: () => Rect,\n ) {\n const target = seq.target as Carrier;\n target.z ??= 0;\n target.rotationX ??= 0;\n target.rotationY ??= 0;\n this.display = new PerspectiveMesh({ texture: Texture.WHITE, verticesX: MESH_GRID, verticesY: MESH_GRID });\n if (seq.spec.name) this.display.label = seq.spec.name;\n this.display.visible = false;\n }\n\n update(host: SpaceHost, basis: CameraBasis): void {\n this.flushRetired();\n const target = this.seq.target as Carrier | null;\n // Pixi skips rendering (and clearing) a container that is not `visible`\n // (e.g. PixiPlugin autoAlpha at alpha 0), which would leave a stale texture.\n if (!target || !target.renderable || !target.visible) return this.hide();\n\n const bounds = this.frameOf();\n const pad = filterPadding(target);\n const needW = Math.ceil(bounds.width + 2 * pad);\n const needH = Math.ceil(bounds.height + 2 * pad);\n if (!(needW >= 1 && needH >= 1) || !Number.isFinite(bounds.x) || !Number.isFinite(bounds.y)) return this.hide();\n\n const size = this.sizeFor(needW, needH);\n // The quad covers exactly the texture's pixel rect in layer space.\n const frame: Rect = { x: bounds.x - pad, y: bounds.y - pad, width: size.w, height: size.h };\n const projected = projectLayer(readLayerTransform(target), frame, basis);\n this.depth = projected.depth;\n if (!projected.visible) {\n if (!this.warnedBehind) {\n this.warnedBehind = true;\n if ((this.seq.spec as { hideBehindCamera?: boolean }).hideBehindCamera) return this.hide(); // on purpose: say nothing\n if (projected.depth > NEAR) {\n // the layer's own origin is in front of the camera: a tilt or a large size swings a CORNER past the camera plane\n console.warn(\n `pixi-effects: ${describeLayer(this.seq.spec)}: part of it (a corner) reaches the camera plane (z = ${(target.z ?? 0).toFixed(0)}, rotationX ${(target.rotationX ?? 0).toFixed(0)}°, rotationY ${(target.rotationY ?? 0).toFixed(0)}°), ` +\n `and a layer is hidden whole when any corner is at or behind it. Tilt it less (rotationX / rotationY), make it smaller, or keep the camera further away from it ` +\n `(the default camera sits at z = (height/2)/tan(fov/2), about 989 for 720p at fov 40).`,\n );\n } else {\n console.warn(\n `pixi-effects: ${describeLayer(this.seq.spec)} is at or behind the camera plane (z = ${(target.z ?? 0).toFixed(0)}) and is hidden. ` +\n `If that is unintended, lower its z or move the camera back (the default camera sits at z = (height/2)/tan(fov/2), about 989 for 720p at fov 40).`,\n );\n }\n }\n return this.hide();\n }\n\n this.ensureTexture(size);\n // `transform` replaces the container's own local transform for this render\n // (Pixi RenderGroupSystem), while `container.alpha` still applies — so the\n // texture carries the layer's alpha and the mesh alpha stays at 1.\n host.render({\n container: target,\n target: this.rt!,\n transform: new Matrix().translate(-frame.x, -frame.y),\n clear: true,\n clearColor: [0, 0, 0, 0],\n });\n this.display.geometry.setCorners(...projected.corners);\n this.display.visible = true;\n }\n\n /**\n * Depth-of-field blur on the projected mesh (screen space), so a tilted or scaled layer blurs by the size it is drawn at.\n * A radius under MIN_BLUR removes the filter: a sharp layer costs nothing. A blend mode moves to the filter while it is on\n * (a filtered object blends as a whole), and comes back when it goes.\n */\n setBlur(radius: number): void {\n const d = this.display as unknown as { filters: unknown; blendMode: string };\n const r = radius > MIN_BLUR ? Math.min(radius, MAX_BLUR) : 0;\n this.blur = r;\n if (r === 0) {\n if (this.blurFilter) {\n d.filters = null;\n d.blendMode = this.blendWas;\n this.blurFilter.destroy();\n this.blurFilter = null;\n }\n return;\n }\n if (!this.blurFilter) {\n this.blurFilter = new DiscBlurFilter(r);\n this.blendWas = d.blendMode ?? 'normal';\n // only an explicit mode moves ('inherit' is Pixi's default for a container and 'normal' is the filter's own: nothing to move)\n if (this.blendWas !== 'normal' && this.blendWas !== 'inherit') { this.blurFilter.blendMode = this.blendWas as never; d.blendMode = 'normal'; }\n d.filters = [this.blurFilter];\n }\n this.blurFilter.radius = r;\n }\n\n destroy(): void {\n this.setBlur(0);\n this.display.destroy();\n this.rt?.destroy(true);\n this.rt = null;\n this.flushRetired();\n }\n\n private flushRetired(): void {\n for (const t of this.retired) t.destroy(true);\n this.retired = [];\n }\n\n private hide(): void {\n this.display.visible = false;\n }\n\n /**\n * Texture size for content of w×h. An existing texture is kept while it is at\n * least that big and at most 2x too big, so content whose bounds change every\n * frame (typewriter text, growing shapes) does not reallocate each frame.\n */\n private sizeFor(w: number, h: number): TextureSize {\n const cur = this.size;\n if (cur && cur.w >= w && cur.h >= h && cur.w <= 2 * w && cur.h <= 2 * h) return cur;\n const resolution = Math.min(\n SUPERSAMPLE,\n MAX_TEXTURE_SIZE / Math.max(w, h),\n Math.sqrt(MAX_TEXTURE_PIXELS / (w * h)),\n );\n const antialias = w * h * resolution * resolution <= ANTIALIAS_MAX_PIXELS;\n return { w, h, resolution, antialias };\n }\n\n private ensureTexture(size: TextureSize): void {\n if (this.rt && this.size === size) return;\n // Same sampling: resize the texture where it is. Replacing it makes Pixi warn that the old one was\n // destroyed while still bound, because the mesh keeps pointing at it until the next render.\n if (this.rt && this.size && this.size.antialias === size.antialias) {\n this.rt.resize(size.w, size.h, size.resolution);\n this.size = size;\n return;\n }\n const next = RenderTexture.create({\n width: size.w, height: size.h, resolution: size.resolution, antialias: size.antialias,\n });\n this.display.texture = next;\n if (this.rt) this.retired.push(this.rt);\n this.rt = next;\n this.size = size;\n }\n}\n","import { collectPropKeys } from './specKeys';\nimport { describeLayer } from '../core/lint';\nimport { focusProblems } from './focus';\nimport type { SequenceSpec } from '../types';\n\ntype Warn = (message: string) => void;\nconst defaultWarn: Warn = m => console.warn(m);\n\nconst FOV_HINT = 'perspective is the camera\\'s \"fov\" — add a { type: \"camera\" } layer and set fov in its initial / keyframes';\n\nconst DOF_HINT = 'depth of field is the camera\\'s \"focus\" (the plane that is sharp: a layer name or a z) and \"aperture\" (how shallow: 0 = off, 30 = default) — put them in the camera\\'s initial / keyframes';\n\n/** Keys that are never valid for any layer, with a hint at what the author probably meant. */\nconst LAYER_ALIASES: Record<string, string> = {\n rotateX: 'did you mean \"rotationX\"?',\n rotateY: 'did you mean \"rotationY\"?',\n rotateZ: 'did you mean \"rotation\"?',\n rotationZ: 'did you mean \"rotation\" (it is the Z rotation)?',\n translateZ: 'did you mean \"z\"?',\n depth: 'did you mean \"z\"?',\n posZ: 'did you mean \"z\"?',\n perspective: FOV_HINT,\n zoom: FOV_HINT,\n};\n\n/** Camera-only mistakes. */\nconst CAMERA_ALIASES: Record<string, string> = {\n pointOfInterest: 'did you mean \"lookAtX / lookAtY / lookAtZ\"?',\n lookAt: 'did you mean \"lookAtX / lookAtY / lookAtZ\"?',\n depthOfField: DOF_HINT, dof: DOF_HINT, focalDistance: DOF_HINT, focusDistance: DOF_HINT, fStop: DOF_HINT, blurAmount: DOF_HINT,\n};\n\nconst CAMERA_PROPS = ['x', 'y', 'z', 'fov', 'focus', 'aperture', 'lookAtX', 'lookAtY', 'lookAtZ', 'offsetX', 'offsetY', 'offsetZ', 'lookOffsetX', 'lookOffsetY', 'lookOffsetZ'];\nconst NEEDS_THREE_D = ['z', 'rotationX', 'rotationY'];\nconst SKEW_KEYS = ['skew', 'skewX', 'skewY'];\n\n/**\n * Warn (never throw) about the inputs an AI author is most likely to get wrong,\n * with a message that says what to change. One call per layer, at build time.\n */\nexport function lintSequence(spec: SequenceSpec, warn: Warn = defaultWarn): void {\n const who = describeLayer(spec);\n const keys = collectPropKeys(spec);\n const explained = new Set<string>();\n\n for (const k of keys) {\n const hint = LAYER_ALIASES[k] ?? (spec.type === 'camera' ? CAMERA_ALIASES[k] : undefined);\n if (hint) {\n explained.add(k);\n warn(`pixi-effects: ${who}: \"${k}\" is not a property — ${hint}`);\n }\n }\n\n if (spec.type === 'camera') {\n const raw = spec as unknown as Record<string, unknown>;\n for (const p of CAMERA_PROPS) {\n if (p in raw) warn(`pixi-effects: ${who}: \"${p}\" must go inside initial / keyframes, not on the camera itself`);\n }\n for (const k of Object.keys(raw)) {\n const hint = CAMERA_ALIASES[k] ?? LAYER_ALIASES[k];\n if (hint) warn(`pixi-effects: ${who}: \"${k}\" is not a property — ${hint} (inside initial)`);\n }\n for (const k of keys) {\n if (!explained.has(k) && !CAMERA_PROPS.includes(k)) {\n warn(`pixi-effects: ${who}: \"${k}\" has no effect on a camera (use ${CAMERA_PROPS.join(', ')})`);\n }\n }\n return;\n }\n\n if (spec.type === 'audio') {\n if (spec.threeD) warn(`pixi-effects: ${who}: threeD has no effect on audio`);\n return;\n }\n\n if (!spec.threeD) {\n for (const k of NEEDS_THREE_D) {\n if (keys.has(k)) warn(`pixi-effects: ${who}: \"${k}\" needs threeD: true (it is ignored otherwise)`);\n }\n } else {\n for (const k of SKEW_KEYS) {\n if (keys.has(k)) warn(`pixi-effects: ${who}: \"${k}\" is ignored on threeD layers`);\n }\n }\n}\n\n/** The layer names a camera's `focus` points at: missing, not threeD, or with a z that moves later. One call per camera, at build time. */\nexport function lintFocus(camera: SequenceSpec, siblings: readonly SequenceSpec[], warn: Warn = defaultWarn): void {\n if (camera.type !== 'camera') return;\n const who = describeLayer(camera);\n for (const p of focusProblems(camera, siblings)) {\n if (p.kind === 'missing') {\n warn(`pixi-effects: ${who}: focus: no layer named \"${p.name}\"${p.hint ? `; did you mean \"${p.hint}\"?` : ''} (the z = 0 plane is used). Write a threeD layer's name or a z number`);\n } else if (p.kind === 'not-threeD') {\n warn(`pixi-effects: ${who}: focus \"${p.name}\" is not a threeD layer, so it has no depth (the z = 0 plane is used). Write a threeD layer's name or a z number`);\n } else {\n warn(`pixi-effects: ${who}: focus \"${p.name}\" reads only the first z of that layer; its z moves later and the focus does not follow. Animate focus itself with numbers to follow it`);\n }\n }\n}\n","import { describeLayer } from './lint';\n\nconst MODES = ['normal', 'add', 'screen', 'multiply'];\n\n/** Apply a layer's `blendMode` to its display object; an unknown mode warns and is ignored. */\nexport function applyBlendMode(spec: { blendMode?: string; name?: string; type: string }, display: { blendMode?: unknown; filters?: unknown }): void {\n const mode = spec.blendMode;\n if (mode === undefined) return;\n if (!MODES.includes(mode)) {\n console.warn(`pixi-effects: ${describeLayer(spec)}: blendMode \"${mode}\" is not supported (use ${MODES.join(', ')})`);\n return;\n }\n // A container's blend mode applies INSIDE a filter's offscreen pass (against transparent black: multiply gave\n // solid black) and not to the filtered result. With filters, the pass that draws onto the backdrop is the last\n // filter's, so the mode goes there; the container stays normal.\n const filters = display.filters;\n if (Array.isArray(filters) && filters.length > 0) {\n (filters[filters.length - 1] as { blendMode?: unknown }).blendMode = mode;\n return;\n }\n display.blendMode = mode;\n}\n","import { AlphaMask, Container, Rectangle } from 'pixi.js';\nimport { gsap } from 'gsap';\nimport { Sequence } from './Base';\nimport { NullSequence } from './Null';\nimport { suggestName } from '../core/options';\nimport { buildSequenceTree } from '../core/Composition';\nimport { CameraSequence } from '../space/CameraSequence';\nimport { findOverlap, pickActiveCamera } from '../space/camera';\nimport { assignDepthOrder } from '../space/depth';\nimport { Layer3D, type SpaceHost } from '../space/Layer3D';\nimport { lintSequence, lintFocus } from '../space/lint';\nimport { layerInitialZ, blurRadius, MANY_BLURRED } from '../space/focus';\nimport { describeLayer, lintText, lintTiming, summarizeWarnings, lintKeys } from '../core/lint';\nimport { applyBlendMode } from '../core/blend';\nimport { cameraBasis, homeCamera, projectPoint, NEAR, type CameraBasis, type CameraState } from '../space/math';\nimport { timeRemapOf, remapOf, contentLength, bindClock, clockTable, type TimeRemap, type ClockTable } from '../core/remap';\nimport type { CompositionSequenceSpec, AudioDescriptor, CompositionShape, SequenceSpec } from '../types';\n\ntype Timeline = ReturnType<typeof gsap.timeline>;\n\nexport class CompositionSequence extends Sequence {\n declare spec: CompositionSequenceSpec;\n private _innerContainer: Container | null = null;\n private _compositionShape: CompositionShape | null = null;\n _children: Sequence[] = [];\n private _cameras: CameraSequence[] = [];\n private _layers3d: Layer3D[] = [];\n private _dofSaid = { behind: false, many: false };\n /** Drawn children in stack order (cameras and target-less sequences excluded). */\n private _visual: Array<{ seq: Sequence; layer: Layer3D | null }> = [];\n /** Layers drawn inside a null layer (`parent`): they are not in the composition's own stack. */\n private _nested: Sequence[] = [];\n /** The null layer each parented layer is drawn inside. */\n private _parentOf = new Map<Sequence, NullSequence>();\n /** Set when this composition's own time is remapped: the children live on `_inner` in LOCAL time, driven by `_clock`. */\n private _inner: Timeline | null = null;\n private _clock: { time: number } | null = null;\n private _remap: TimeRemap | null = null;\n private _childBase = 0;\n private _contentSpan = 0;\n\n /** Where the children's time starts: the composition's absolute start, or 0 when their time is local (remapped). */\n get childBase(): number { return this._childBase; }\n /** How long the children's time runs: the composition's duration, or its content length when its time is remapped. */\n get contentSpan(): number { return this._contentSpan; }\n /** The time the children live in at movie time `t`: the movie's own, or this composition's local clock when it is remapped. */\n childTime(t: number): number { return this._clock ? this._clock.time : t; }\n /** The clock reader for filters that want the time (grain), or null when the children run on the movie's time. */\n localClock(): (() => number) | null { return this._clock ? () => this._clock!.time : null; }\n /** How the time is remapped, for the timeline chart: `×0.5`, `×-1`, `time keyframes`, or null. */\n remapLabel(): string | null {\n const r = this._remap;\n if (!r) return null;\n return r.timeKfs.length ? 'time keyframes' : `×${r.speed ?? 1}`;\n }\n\n async build(): Promise<void> {\n const width = this.spec.width ?? this.parent?.width ?? this.root.width;\n const height = this.spec.height ?? this.parent?.height ?? this.root.height;\n if (this.duration === undefined) {\n this.duration = this.spec.duration ?? this.parent?.duration ?? this.root.duration;\n }\n const wrapper = new Container();\n wrapper.cullable = true;\n wrapper.cullableChildren = true;\n wrapper.cullArea = new Rectangle(0, 0, width, height);\n\n const inner = new Container();\n inner.cullable = true;\n inner.cullableChildren = true;\n wrapper.addChild(inner);\n\n this.target = wrapper;\n this.intrinsicWidth = width;\n this.intrinsicHeight = height;\n this._innerContainer = inner;\n // A remapped composition's children live in LOCAL time, which can run past the composition's own duration (speed 2 reads twice as far).\n const base = timeRemapOf(this.spec as never);\n const span = base ? contentLength(base, this.duration) : this.duration;\n this._remap = base ? remapOf(this.spec as never, 'time', span) : null;\n this._contentSpan = span;\n this._compositionShape = { width, height, duration: span };\n\n const lateKeyframes: string[] = [];\n for (const s of this.spec.sequences ?? []) {\n lintSequence(s);\n lintFocus(s, this.spec.sequences ?? []);\n lintTiming(s, span, (message, kind) => (kind === 'late-keyframe' ? lateKeyframes.push(message) : console.warn(message)));\n lintText(s);\n lintKeys(s);\n }\n for (const message of summarizeWarnings(lateKeyframes)) console.warn(message);\n\n this._children = await buildSequenceTree(\n this.spec.sequences ?? [],\n this._compositionShape,\n this.root,\n );\n this._resolveParents();\n // A camera's `focus: \"title\"` becomes that layer's first z, here, where the siblings exist (a camera sees only its parent's shape)\n const layerNames = new Set(this._children.map(c => c.spec.name).filter((n): n is string => !!n));\n for (const cam of this._children) {\n if (!(cam instanceof CameraSequence)) continue;\n cam.resolveFocusNames(name => {\n const hit = this._children.find(c => c.spec.name === name && c.spec.threeD);\n return hit ? layerInitialZ(hit.spec, hit.scope() as unknown as Record<string, number>) : undefined;\n }, layerNames);\n }\n for (const child of this._children) {\n // Cameras are display-less: they only feed the projection pass.\n if (child instanceof CameraSequence) {\n this._cameras.push(child);\n continue;\n }\n if (!child.target) continue;\n const holder = this._parentOf.get(child);\n const into = holder?.target ?? inner; // a layer with `parent` is drawn inside its null layer\n\n const maskSpec = (child.spec as { mask?: SequenceSpec }).mask;\n\n // threeD layers never enter the scene graph themselves: their display\n // object is rendered into a texture and a perspective mesh stands in.\n if (child.spec.threeD) {\n const layer = new Layer3D(child, frameOf(child));\n inner.addChild(layer.display);\n this._layers3d.push(layer);\n this._visual.push({ seq: child, layer });\n applyBlendMode(child.spec, layer.display);\n if (maskSpec) {\n console.warn(`pixi-effects: ${describeLayer(child.spec)}: mask is not supported on threeD layers yet; ignored`);\n }\n continue;\n }\n\n into.addChild(child.target);\n if (holder) this._nested.push(child);\n else this._visual.push({ seq: child, layer: null });\n applyBlendMode(child.spec, child.target);\n // If this child has a `mask` spec, build the mask sequence in the same\n // composition shape, add its target to the same parent (so its\n // transforms resolve in the same coord space), and wire PIXI's\n // mask channel. PIXI v8 renders mask containers into the stencil /\n // alpha buffer; they don't render as normal children.\n if (maskSpec) {\n // The mask lives and animates with the layer it masks: with no `at` of its own its `at` and\n // `duration` are the layer's, so its keyframes are measured from the layer's start too. An\n // explicit `at` is composition time, exactly like a layer's.\n const lifetime = maskSpec.at === undefined\n ? { at: child.at, duration: maskSpec.duration ?? child.duration }\n : {};\n const built = await buildSequenceTree([{ ...maskSpec, ...lifetime } as SequenceSpec], this._compositionShape, this.root);\n const maskSeq = built[0];\n if (maskSeq?.target) {\n into.addChild(maskSeq.target); // the mask shares the layer's space\n // PIXI v8 `setMask` accepts an `inverse` flag — that's how we\n // expose `maskInverted` from the spec. Falls back to plain\n // `target.mask = …` for runtimes that don't have setMask\n // (older PIXI builds).\n const inverse = (child.spec as { maskInverted?: boolean }).maskInverted ?? false;\n const t = child.target as Container & {\n setMask?: (opts: { mask: Container | null; inverse?: boolean }) => void;\n addEffect: (effect: AlphaMask) => void;\n mask: Container | null;\n };\n if (inverse || maskSpec.type === 'text') {\n // A stencil mask is the mask's geometry: a text layer's is its whole bounding box (the letters' alpha is ignored), and\n // PIXI's inverted stencil tests against the empty level, so inside a masked parent it shows what the parent hides.\n // An alpha mask draws the mask into a texture and uses its alpha: letters stay letters, an inverse is 1 − alpha.\n const effect = new AlphaMask({ mask: maskSeq.target });\n effect.inverse = inverse;\n t.setMask?.({ mask: undefined as never, inverse }); // the alpha pipe reads `inverse` from the maskee's mask options, not from the effect\n t.addEffect(effect);\n } else if (typeof t.setMask === 'function') {\n t.setMask({ mask: maskSeq.target, inverse });\n } else {\n t.mask = maskSeq.target;\n }\n child.maskSequence = maskSeq;\n maskSeq.keepHidden = maskSpec.type === 'image' || maskSpec.type === 'video'; // PIXI: a Sprite mask is hidden by renderable = false\n }\n }\n }\n\n if (this._layers3d.length > 0) {\n // Stack order becomes explicit zIndex so threeD layers can be re-sorted\n // by depth each frame without reparenting.\n inner.sortableChildren = true;\n this._visual.forEach((v, i) => {\n (v.layer?.display ?? v.seq.target!).zIndex = i;\n });\n } else if (this._cameras.length > 0) {\n console.warn('pixi-effects: camera has no effect: this composition has no threeD layers');\n }\n\n this.buildFilters();\n }\n\n protected override displayProps(): { initial: CompositionSequenceSpec['initial']; keyframes: CompositionSequenceSpec['keyframes'] } {\n const r = this._remap;\n return r ? { initial: r.restInitial as CompositionSequenceSpec['initial'], keyframes: r.restKfs } : super.displayProps();\n }\n\n override bindTimeline(timeline: Timeline, offset = 0): void {\n super.bindTimeline(timeline, offset);\n const remap = this._remap;\n // Children's `at` is relative to this composition's start, so push them forward by our absolute start time on the global\n // timeline. A remapped composition builds them in LOCAL time (offset 0) on a timeline of its own, which the clock drives.\n const childOffset = remap ? 0 : offset + this.at;\n this._childBase = childOffset;\n const target = remap ? gsap.timeline({ paused: true, defaults: { ease: 'none' } }) : timeline;\n for (const child of this._children) {\n // Each layer builds its tweens in a small timeline of its own, which is added to the parent once, finished. Adding\n // thousands of tweens one by one to a single timeline makes GSAP re-measure the whole timeline at every add (the cost\n // grows with the square of the count: ~3 s for a piece with 700 particle layers); this way the parent only ever holds\n // one child per layer. Positions stay absolute, so the picture at any time is the same.\n const own = gsap.timeline({ defaults: { ease: 'none' } });\n child.bindTimeline(own, childOffset);\n // The mask shares the maskee's offset — its `at` is interpreted\n // relative to the composition's start, just like the child itself,\n // so a reveal-from-zero animation lines up naturally.\n child.maskSequence?.bindTimeline(own, childOffset);\n target.add(own, 0);\n }\n if (remap) this._bindClock(timeline, target, remap, offset);\n const overlap = findOverlap(this._cameras.map(c => c.window()));\n if (overlap) {\n console.warn(`pixi-effects: cameras #${overlap[0] + 1} and #${overlap[1] + 1} overlap in time; the top-most one wins`);\n }\n }\n\n /** Drive the local timeline `inner` from the clock, and put the clock's tweens on the outer `timeline`. */\n private _bindClock(timeline: Timeline, inner: Timeline, remap: TimeRemap, offset: number): void {\n let last = NaN;\n let cur = 0;\n const clock = {\n get time(): number { return cur; },\n set time(v: number) {\n cur = v;\n if (v === last) return; // a freeze renders nothing\n last = v;\n inner.time(v);\n },\n };\n this._inner = inner;\n this._clock = clock;\n const scope = this.scope() as unknown as Record<string, number>;\n if (remap.start !== undefined && remap.timeKfs.length === 0) clock.time = remap.start;\n bindClock(timeline, clock, 'time', remap, this.duration!, offset + this.at, scope);\n // Initialise every tween of the local timeline in order (end, then start), as Movie does for the main one: GSAP captures a `to`\n // tween's start value the first time it renders, and a remap can reach a stretch of local time for the first time going BACKWARD.\n inner.time(inner.duration()); inner.time(0);\n last = NaN; // the inner timeline now sits at 0, whatever the clock last said\n this._warnUnreachable(clockTable(remap, 'time', this.duration!, offset + this.at, scope, offset + this.at + this.duration!), offset + this.at, offset + this.at + this.duration!);\n }\n\n /**\n * A child the clock never dwells in is never visible: say so. Its `at` is in THIS composition's local time, so the usual mistake is\n * writing it in the outer time (or forgetting that speed 0.5 reaches only half as far). Decided by dwell, not by the clock's end\n * points: a clock that arrives at the child's `at` and HOLDS there shows it for the whole hold; one that only touches it in a single\n * instant (speed 0.5, a child at exactly the farthest local time) does not.\n */\n private _warnUnreachable(table: ClockTable, from: number, to: number): void {\n const remap = this._remap!;\n const how = remap.timeKfs.length ? 'time keyframes' : `speed ${remap.speed ?? 1}`;\n const span = this._contentSpan;\n const EPS = 1e-9;\n for (const child of this._children) {\n const at = child.at;\n if (at >= span) continue; // already said by lintTiming (\"starts after its composition ends\")\n const end = Math.min(at + (child.duration ?? span), span);\n let dwell = 0; // 1 ms samples of the clock inside [at, end)\n for (let t = from; t <= to && dwell < 2; t += 0.001) { const v = table.at(t); if (v >= at - EPS && v < end + EPS) dwell++; }\n if (dwell >= 2) continue;\n console.warn(\n `pixi-effects: ${describeLayer(child.spec)} starts at ${at}s of ${describeLayer(this.spec)}'s own time, but its clock only reaches ` +\n `${Number(table.min.toFixed(3))}–${Number(table.max.toFixed(3))}s (${how}), so it is never visible. ` +\n `Layers inside a remapped composition are placed in that composition's local time.`,\n );\n }\n }\n\n /**\n * Drawn children in stack order, with the display object that stands in for each (the mesh for a threeD layer).\n * Null layers draw nothing and are left out; the layers inside them follow, with the null layers that carry them.\n */\n layers(): Array<{ seq: Sequence; display: Container; threeD: boolean; carriers: NullSequence[]; depthBlur: number }> {\n const carriersOf = (seq: Sequence): NullSequence[] => {\n const out: NullSequence[] = [];\n for (let p = this._parentOf.get(seq); p; p = this._parentOf.get(p)) out.push(p);\n return out;\n };\n return [...this._visual.map(v => v.seq), ...this._nested]\n .filter(seq => !(seq instanceof NullSequence))\n .map(seq => {\n const layer = this._visual.find(v => v.seq === seq)?.layer ?? null;\n return {\n seq,\n display: (layer?.display ?? seq.target!) as unknown as Container,\n threeD: layer !== null,\n carriers: carriersOf(seq),\n depthBlur: layer?.blur ?? 0,\n };\n });\n }\n\n /** Match every `parent: 'name'` to a null layer; anything that cannot work is said out loud and drawn unparented. */\n private _resolveParents(): void {\n const nulls = this._children.filter((c): c is NullSequence => c instanceof NullSequence);\n const nullNames = nulls.map(n => n.spec.name).filter((n): n is string => !!n);\n const warned = new Set<string>();\n for (const child of this._children) {\n const want = child.spec.parent;\n if (want === undefined) continue;\n const who = describeLayer(child.spec);\n if (child instanceof CameraSequence) { console.warn(`pixi-effects: ${who}: a camera cannot have a parent; ignored`); continue; }\n if (child.spec.threeD) { console.warn(`pixi-effects: ${who}: a threeD layer cannot have a parent (parent \"${want}\" ignored)`); continue; }\n const same = this._children.filter(c => c.spec.name === want);\n if (same.length === 0) {\n const hint = suggestName(want, nullNames);\n console.warn(`pixi-effects: ${who}: parent \"${want}\": no layer with that name${hint ? `; did you mean \"${hint}\"?` : ''} (the layer is drawn without a parent)`);\n continue;\n }\n const holder = same.find((c): c is NullSequence => c instanceof NullSequence);\n if (!holder) {\n console.warn(`pixi-effects: ${who}: parent \"${want}\" is a ${same[0]!.spec.type} layer; only { type: 'null' } layers can be parents (the layer is drawn without a parent)`);\n continue;\n }\n if (same.length > 1 && !warned.has(want)) {\n warned.add(want);\n console.warn(`pixi-effects: ${same.length} layers are named \"${want}\"; parent \"${want}\" uses the first null layer with that name`);\n }\n if (holder === child) { console.warn(`pixi-effects: ${who} is its own parent; ignored`); continue; }\n this._parentOf.set(child, holder);\n }\n // a chain that leads back to itself: break it where we find it\n for (const start of this._children) {\n const seen = new Set<Sequence>([start]);\n for (let p = this._parentOf.get(start); p; p = this._parentOf.get(p)) {\n if (p === start) {\n const names = [...seen].map(s => s.spec.name ?? s.spec.type).join(' → ');\n console.warn(`pixi-effects: parent cycle: ${names} → ${start.spec.name ?? start.spec.type}; the parent of \"${start.spec.name ?? start.spec.type}\" is ignored`);\n this._parentOf.delete(start);\n break;\n }\n if (seen.has(p)) break;\n seen.add(p);\n }\n }\n }\n\n override syncFrame(): void {\n super.syncFrame();\n for (const child of this._children) child.syncFrame();\n }\n\n override updateSpace(t: number, host: SpaceHost): void {\n // Inner compositions first: a threeD composition is rendered into its own\n // texture by this level, so its content must already be projected.\n const childT = this.childTime(t);\n for (const child of this._children) child.updateSpace(childT, host);\n if (this._layers3d.length === 0 || !this._compositionShape) return;\n\n const { width, height } = this._compositionShape;\n const compEnd = this._childBase + (this.duration ?? 0);\n const active = pickActiveCamera(\n this._cameras.map(cam => ({ cam, ...cam.window() })),\n childT,\n compEnd,\n );\n const cam = active ? active.cam.state() : homeCamera(width, height);\n const basis = cameraBasis(cam, width, height);\n\n for (const layer of this._layers3d) layer.update(host, basis);\n this._applyDepthOfField(cam, basis);\n\n const order = assignDepthOrder(\n this._visual.map((v, i) => ({ stackIndex: i, threeD: v.layer !== null, depth: v.layer?.depth ?? 0 })),\n );\n this._visual.forEach((v, i) => {\n if (v.layer) v.layer.display.zIndex = order[i]!;\n });\n }\n\n /** Depth of field: each threeD layer is blurred by how far its depth is from the focal plane (a pure function of the camera and the layers). */\n private _applyDepthOfField(cam: CameraState, basis: CameraBasis): void {\n const aperture = cam.aperture ?? 0;\n if (!(aperture > 0)) { for (const l of this._layers3d) l.setBlur(0); return; }\n const focusDepth = projectPoint(basis, { x: cam.lookAtX, y: cam.lookAtY, z: cam.focus ?? 0 }).depth;\n if (!(focusDepth > NEAR)) {\n if (!this._dofSaid.behind) {\n this._dofSaid.behind = true;\n console.warn(`pixi-effects: ${describeLayer(this.spec)}: the camera's focus (z = ${(cam.focus ?? 0).toFixed(0)}) is at or behind the camera, so nothing is blurred. Put focus in front of the camera (a z below the camera's z)`);\n }\n for (const l of this._layers3d) l.setBlur(0);\n return;\n }\n let blurred = 0;\n for (const l of this._layers3d) {\n // a hidden layer (lifespan over, alpha 0, behind the camera) keeps the depth of the last frame it was drawn: it is not blurred or counted\n l.setBlur(l.display.visible ? blurRadius(aperture, basis.focal, l.depth, focusDepth) : 0);\n if (l.blur > 0) blurred++;\n }\n if (blurred >= MANY_BLURRED && !this._dofSaid.many) {\n this._dofSaid.many = true;\n console.warn(`pixi-effects: ${describeLayer(this.spec)}: ${blurred} layers are blurred by depth of field at once; each costs a filter pass per frame (WebGPU more). Merge the far layers or lower aperture`);\n }\n }\n\n override collectAudio(out: AudioDescriptor[], baseTime: number): void {\n super.collectAudio(out, baseTime);\n const remap = this._remap;\n if (!remap) {\n const childBase = baseTime + this.at;\n for (const child of this._children) child.collectAudio(out, childBase);\n return;\n }\n // The children's sounds are described in local time; each one is given a warp from the movie's time to it.\n const inner: AudioDescriptor[] = [];\n for (const child of this._children) child.collectAudio(inner, 0);\n const lo = baseTime + this.at, hi = lo + this.duration!;\n const table = clockTable(remap, 'time', this.duration!, lo, this.scope() as unknown as Record<string, number>, hi);\n for (const d of inner) {\n const prev = d.warp;\n out.push({ ...d, warp: (t: number) => (t < lo || t > hi ? NaN : prev ? prev(table.at(t)) : table.at(t)) });\n }\n }\n\n override destroy(): void {\n this._inner?.kill();\n this._inner = null;\n this._clock = null;\n for (const l of this._layers3d) l.destroy();\n this._layers3d = [];\n for (const c of this._children) c.destroy();\n super.destroy();\n }\n}\n\n/** Layer-space rectangle a threeD child projects: a composition's frame, otherwise its content bounds. */\nfunction frameOf(child: Sequence): () => { x: number; y: number; width: number; height: number } {\n if (child instanceof CompositionSequence) {\n return () => ({ x: 0, y: 0, width: child.intrinsicWidth, height: child.intrinsicHeight });\n }\n return () => child.target!.getLocalBounds();\n}\n"]}
|