@pixerate/editor 0.223.9 → 0.224.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/dist/animation-editor/index.cjs +9 -9
- package/dist/animation-editor/index.js +1 -1
- package/dist/canvas/index.cjs +7 -7
- package/dist/canvas/index.js +1 -1
- package/dist/{chunk-6DUEV36F.cjs → chunk-7AAS3JO6.cjs} +14 -14
- package/dist/{chunk-6G2NLMVK.js → chunk-HKPLKISO.js} +58 -9
- package/dist/{chunk-Z64NRDEH.cjs → chunk-MDNYYOBZ.cjs} +7 -7
- package/dist/{chunk-A3A5TI6R.cjs → chunk-NTWR5TQB.cjs} +59 -10
- package/dist/{chunk-OZSA5YEJ.js → chunk-RDTCG5MS.js} +1 -1
- package/dist/{chunk-WMVEYSOA.js → chunk-WA4IS2EY.js} +1 -1
- package/dist/effects/fake.d.cts +6 -1
- package/dist/effects/fake.d.ts +6 -1
- package/dist/effects/helpers.d.cts +24 -1
- package/dist/effects/helpers.d.ts +24 -1
- package/dist/effects/index.cjs +257 -62
- package/dist/effects/index.js +202 -7
- package/dist/effects/types.d.cts +121 -4
- package/dist/effects/types.d.ts +121 -4
- package/dist/image-editor/index.cjs +13 -13
- package/dist/image-editor/index.js +1 -1
- package/dist/paint-editor/index.cjs +7 -7
- package/dist/paint-editor/index.js +2 -2
- package/dist/vector/index.cjs +6 -6
- package/dist/vector/index.js +1 -1
- package/dist/video-editor/index.cjs +309 -309
- package/dist/video-editor/index.js +3 -3
- package/package.json +1 -1
- package/skills/pixerate-animation-editor/SKILL.md +1 -1
- package/skills/pixerate-video-editor/SKILL.md +1 -1
|
@@ -48,7 +48,7 @@ require('../chunk-NM3G4VQT.cjs');
|
|
|
48
48
|
|
|
49
49
|
|
|
50
50
|
|
|
51
|
-
var
|
|
51
|
+
var _chunkNTWR5TQBcjs = require('../chunk-NTWR5TQB.cjs');
|
|
52
52
|
require('../chunk-WOFXZ3XU.cjs');
|
|
53
53
|
require('../chunk-PQ3H2AAN.cjs');
|
|
54
54
|
require('../chunk-YQGCPL5X.cjs');
|
|
@@ -3828,7 +3828,7 @@ var AnimationEditorController = (_class = class {
|
|
|
3828
3828
|
|
|
3829
3829
|
|
|
3830
3830
|
/** The effects provider slot (see `setEffectsProvider`). */
|
|
3831
|
-
__init() {this.effects = new (0,
|
|
3831
|
+
__init() {this.effects = new (0, _chunkNTWR5TQBcjs.EffectsSlot)()}
|
|
3832
3832
|
|
|
3833
3833
|
|
|
3834
3834
|
__init2() {this.selection = null}
|
|
@@ -4013,7 +4013,7 @@ var AnimationEditorController = (_class = class {
|
|
|
4013
4013
|
try {
|
|
4014
4014
|
plan = await work();
|
|
4015
4015
|
} catch (error) {
|
|
4016
|
-
if (
|
|
4016
|
+
if (_chunkNTWR5TQBcjs.isEffectError.call(void 0, error) || error instanceof Error) return this.refuse(error.message);
|
|
4017
4017
|
throw error;
|
|
4018
4018
|
}
|
|
4019
4019
|
const r = this.apply({ op: "replace_scene", scene: plan.scene }, plan.label, { merge });
|
|
@@ -4024,11 +4024,11 @@ var AnimationEditorController = (_class = class {
|
|
|
4024
4024
|
}
|
|
4025
4025
|
async describeFor(effect, kinds) {
|
|
4026
4026
|
const provider = this.effects.require();
|
|
4027
|
-
if (!provider.applyVectorEffect) throw new (0,
|
|
4027
|
+
if (!provider.applyVectorEffect) throw new (0, _chunkNTWR5TQBcjs.EffectUnsupportedError)(`${provider.name} has no vector or motion effects.`);
|
|
4028
4028
|
const d = await provider.describe(effect);
|
|
4029
4029
|
if (!kinds.includes(d.kind)) {
|
|
4030
4030
|
const hint = d.kind === "motion" ? "apply it to nodes with apply_effect" : d.kind === "vector" ? "add it with add_vector_effect" : "it draws pixels, which scenes cannot hold";
|
|
4031
|
-
throw new (0,
|
|
4031
|
+
throw new (0, _chunkNTWR5TQBcjs.EffectUnsupportedError)(`"${d.id}" (${d.name}) is a ${d.kind} effect: ${hint}.`, d.id);
|
|
4032
4032
|
}
|
|
4033
4033
|
return d;
|
|
4034
4034
|
}
|
|
@@ -4049,7 +4049,7 @@ var AnimationEditorController = (_class = class {
|
|
|
4049
4049
|
return this.effectEdit(async () => {
|
|
4050
4050
|
this.knownNodes(targets);
|
|
4051
4051
|
const d = await this.describeFor(effect, ["motion"]);
|
|
4052
|
-
const values =
|
|
4052
|
+
const values = _chunkNTWR5TQBcjs.resolveEffectValues.call(void 0, d, options.values);
|
|
4053
4053
|
const instance = _nullishCoalesce(options.instance, () => ( nextMotionEffectInstance(this.scene)));
|
|
4054
4054
|
const motion = await this.effects.require().applyVectorEffect(d.id, { svg: motionArtworkSvg(this.scene.artwork), nodeIds: [...targets] }, values);
|
|
4055
4055
|
const source = { instance, effect: d.id, provider: this.effects.require().id, name: d.name, values };
|
|
@@ -4071,7 +4071,7 @@ var AnimationEditorController = (_class = class {
|
|
|
4071
4071
|
addVectorEffect(effect, options = {}) {
|
|
4072
4072
|
return this.effectEdit(async () => {
|
|
4073
4073
|
const d = await this.describeFor(effect, ["vector"]);
|
|
4074
|
-
const values =
|
|
4074
|
+
const values = _chunkNTWR5TQBcjs.resolveEffectValues.call(void 0, d, options.values);
|
|
4075
4075
|
const instance = _nullishCoalesce(options.instance, () => ( nextMotionEffectInstance(this.scene)));
|
|
4076
4076
|
const motion = await this.effects.require().applyVectorEffect(d.id, motionArtworkSvg(this.scene.artwork), values);
|
|
4077
4077
|
const source = { instance, effect: d.id, provider: this.effects.require().id, name: d.name, values };
|
|
@@ -4095,7 +4095,7 @@ var AnimationEditorController = (_class = class {
|
|
|
4095
4095
|
else if (k in d.controls.properties) base[k] = d.defaults[k];
|
|
4096
4096
|
else throw new Error(`"${k}" is not a control of "${d.id}"; its controls are ${Object.keys(d.controls.properties).join(", ")}.`);
|
|
4097
4097
|
}
|
|
4098
|
-
const merged = { ...base, ...
|
|
4098
|
+
const merged = { ...base, ..._chunkNTWR5TQBcjs.resolveEffectValues.call(void 0, { ...d, defaults: base }, given) };
|
|
4099
4099
|
const { scene: bare, place } = withoutMotionEffect(this.scene, instance);
|
|
4100
4100
|
const provider = this.effects.require();
|
|
4101
4101
|
const source = { instance, effect: d.id, provider: provider.id, name: d.name, values: merged };
|
|
@@ -5868,7 +5868,7 @@ function createAnimationEffectsToolProvider(controller, options = {}) {
|
|
|
5868
5868
|
if (!r.ok) throw new Error(r.error);
|
|
5869
5869
|
return { target, effect: info(r.effect), effects: controller.appliedEffects().filter((e) => e.targets.includes(target)).map(info), ...r.notes.length ? { notes: r.notes } : {} };
|
|
5870
5870
|
};
|
|
5871
|
-
return withAnimationPlayback(
|
|
5871
|
+
return withAnimationPlayback(_chunkNTWR5TQBcjs.createEffectToolProvider.call(void 0, {
|
|
5872
5872
|
id: _nullishCoalesce(options.id, () => ( "animation-effects")),
|
|
5873
5873
|
namespace: options.namespace,
|
|
5874
5874
|
title: "Animation effects",
|
package/dist/canvas/index.cjs
CHANGED
|
@@ -209,7 +209,7 @@ var _chunkNM3G4VQTcjs = require('../chunk-NM3G4VQT.cjs');
|
|
|
209
209
|
|
|
210
210
|
|
|
211
211
|
|
|
212
|
-
var
|
|
212
|
+
var _chunkNTWR5TQBcjs = require('../chunk-NTWR5TQB.cjs');
|
|
213
213
|
require('../chunk-WOFXZ3XU.cjs');
|
|
214
214
|
|
|
215
215
|
|
|
@@ -11396,14 +11396,14 @@ function canvasNodeEffect(node) {
|
|
|
11396
11396
|
return _chunkNM3G4VQTcjs.isShapeDescription.call(void 0, shape) ? shape.effect : void 0;
|
|
11397
11397
|
}
|
|
11398
11398
|
function createCanvasEffectsController(options) {
|
|
11399
|
-
const slot = new (0,
|
|
11399
|
+
const slot = new (0, _chunkNTWR5TQBcjs.EffectsSlot)();
|
|
11400
11400
|
if (options.effects) slot.set(options.effects);
|
|
11401
11401
|
const describe = async (effect, place2) => {
|
|
11402
11402
|
const d = await slot.require().describe(effect);
|
|
11403
11403
|
const allowed = CANVAS_EFFECT_PLACES[place2];
|
|
11404
11404
|
if (d.kind === "motion" || !d.uses.some((u) => allowed.includes(u))) {
|
|
11405
11405
|
const where = place2 === "transition" ? "a scene transition" : place2 === "fill" ? "a fill" : "an overlay";
|
|
11406
|
-
throw new (0,
|
|
11406
|
+
throw new (0, _chunkNTWR5TQBcjs.EffectUnsupportedError)(`"${d.id}" (${d.name}) is a ${d.uses.join(" / ")} effect and cannot be ${where}, which takes ${allowed.join(" or ")} effects; search_effects with use "${allowed[0]}" lists ones that fit.`, d.id);
|
|
11407
11407
|
}
|
|
11408
11408
|
return d;
|
|
11409
11409
|
};
|
|
@@ -11434,7 +11434,7 @@ function createCanvasEffectsController(options) {
|
|
|
11434
11434
|
else if (k in d.controls.properties) base[k] = d.defaults[k];
|
|
11435
11435
|
else throw new Error(`"${k}" is not a control of "${d.id}"; its controls are ${Object.keys(d.controls.properties).join(", ")}.`);
|
|
11436
11436
|
}
|
|
11437
|
-
return { ...base, ...
|
|
11437
|
+
return { ...base, ..._chunkNTWR5TQBcjs.resolveEffectValues.call(void 0, { ...d, defaults: base }, given) };
|
|
11438
11438
|
};
|
|
11439
11439
|
return {
|
|
11440
11440
|
/** The provider slot. */
|
|
@@ -11464,7 +11464,7 @@ function createCanvasEffectsController(options) {
|
|
|
11464
11464
|
const mode = _nullishCoalesce(opts.mode, () => ( "fill"));
|
|
11465
11465
|
const d = await describe(effect, mode);
|
|
11466
11466
|
if (opts.opacity !== void 0 && !(opts.opacity >= 0 && opts.opacity <= 1)) throw new Error("opacity must be from 0 to 1.");
|
|
11467
|
-
const next = { effect: d.id, provider: slot.require().id, name: d.name, values:
|
|
11467
|
+
const next = { effect: d.id, provider: slot.require().id, name: d.name, values: _chunkNTWR5TQBcjs.resolveEffectValues.call(void 0, d, opts.values), mode, ...opts.opacity !== void 0 && opts.opacity !== 1 ? { opacity: opts.opacity } : {} };
|
|
11468
11468
|
commit(`Add effect ${d.name}`, withEffect(nodeId, next));
|
|
11469
11469
|
return next;
|
|
11470
11470
|
},
|
|
@@ -11521,7 +11521,7 @@ function createCanvasEffectsController(options) {
|
|
|
11521
11521
|
const d = await describe(effect, "transition");
|
|
11522
11522
|
const duration = _nullishCoalesce(_nullishCoalesce(opts.duration, () => ( d.duration)), () => ( 600));
|
|
11523
11523
|
if (!(duration > 0)) throw new Error("duration must be a number of ms above 0.");
|
|
11524
|
-
const transition = { effect: d.id, provider: slot.require().id, name: d.name, values:
|
|
11524
|
+
const transition = { effect: d.id, provider: slot.require().id, name: d.name, values: _chunkNTWR5TQBcjs.resolveEffectValues.call(void 0, d, opts.values), duration };
|
|
11525
11525
|
scenes2.update(sceneId, { transition });
|
|
11526
11526
|
return transition;
|
|
11527
11527
|
}
|
|
@@ -11665,7 +11665,7 @@ function createCanvasEffectsToolProvider(controller, options = {}) {
|
|
|
11665
11665
|
const once = (instance) => {
|
|
11666
11666
|
if (instance !== "effect") throw new Error('A shape node has one effect, "effect".');
|
|
11667
11667
|
};
|
|
11668
|
-
return
|
|
11668
|
+
return _chunkNTWR5TQBcjs.createEffectToolProvider.call(void 0, {
|
|
11669
11669
|
id: _nullishCoalesce(options.id, () => ( "canvas-effects")),
|
|
11670
11670
|
namespace: options.namespace,
|
|
11671
11671
|
title: "Canvas effects",
|
package/dist/canvas/index.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _chunkNTWR5TQBcjs = require('./chunk-NTWR5TQB.cjs');
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
var _chunkFJ2MSI43cjs = require('./chunk-FJ2MSI43.cjs');
|
|
@@ -26,7 +26,7 @@ function documentErrors(doc, description) {
|
|
|
26
26
|
const isRecord = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
|
|
27
27
|
if (doc.values !== void 0) {
|
|
28
28
|
if (!isRecord(doc.values)) errors.push({ path: "/values", message: "must be an object of control values" });
|
|
29
|
-
else errors.push(...
|
|
29
|
+
else errors.push(..._chunkNTWR5TQBcjs.effectValueErrors.call(void 0, description, doc.values).map((e) => ({ ...e, path: `/values${e.path}` })));
|
|
30
30
|
}
|
|
31
31
|
if (doc.tracks !== void 0) {
|
|
32
32
|
if (!isRecord(doc.tracks)) errors.push({ path: "/tracks", message: "must be an object of keyframe lists" });
|
|
@@ -39,7 +39,7 @@ function documentErrors(doc, description) {
|
|
|
39
39
|
kfs.forEach((kf, i) => {
|
|
40
40
|
if (!isRecord(kf)) return errors.push({ path: `${at}/${i}`, message: "must be a keyframe object" });
|
|
41
41
|
if (typeof kf.time !== "number" || !Number.isFinite(kf.time) || kf.time < 0) errors.push({ path: `${at}/${i}/time`, message: "must be a finite number of ms >= 0" });
|
|
42
|
-
errors.push(...
|
|
42
|
+
errors.push(..._chunkNTWR5TQBcjs.effectValueErrors.call(void 0, description, { [control]: kf.value }).map((e) => ({ ...e, path: `${at}/${i}/value` })));
|
|
43
43
|
if (kf.easing !== void 0 && !_chunkDWJJI6RTcjs.isAnimationEasing.call(void 0, kf.easing)) errors.push({ path: `${at}/${i}/easing`, message: "is not a valid easing" });
|
|
44
44
|
});
|
|
45
45
|
}
|
|
@@ -49,7 +49,7 @@ function documentErrors(doc, description) {
|
|
|
49
49
|
else
|
|
50
50
|
doc.presets.forEach((p, i) => {
|
|
51
51
|
if (!isRecord(p) || typeof p.name !== "string" || !p.name) return errors.push({ path: `/presets/${i}`, message: "must have a name" });
|
|
52
|
-
errors.push(...
|
|
52
|
+
errors.push(..._chunkNTWR5TQBcjs.effectValueErrors.call(void 0, description, p.values).map((e) => ({ ...e, path: `/presets/${i}/values${e.path}` })));
|
|
53
53
|
});
|
|
54
54
|
}
|
|
55
55
|
if (doc.duration !== void 0 && (typeof doc.duration !== "number" || !Number.isFinite(doc.duration) || !(doc.duration > 0))) {
|
|
@@ -170,7 +170,7 @@ async function createEffectAuthoringSession(source, options) {
|
|
|
170
170
|
if (isDocumentSource(source)) {
|
|
171
171
|
const doc = source.document;
|
|
172
172
|
if (doc.version !== 1 || !doc.effectId) {
|
|
173
|
-
throw new (0,
|
|
173
|
+
throw new (0, _chunkNTWR5TQBcjs.EffectUnsupportedError)("Invalid effect authoring document: version 1 required");
|
|
174
174
|
}
|
|
175
175
|
effectId = doc.effectId;
|
|
176
176
|
initialDoc = doc;
|
|
@@ -178,15 +178,15 @@ async function createEffectAuthoringSession(source, options) {
|
|
|
178
178
|
effectId = source.effectId;
|
|
179
179
|
requestedPreset = source.preset;
|
|
180
180
|
} else {
|
|
181
|
-
throw new (0,
|
|
181
|
+
throw new (0, _chunkNTWR5TQBcjs.EffectUnsupportedError)("Invalid effect authoring source");
|
|
182
182
|
}
|
|
183
183
|
const description = await provider.describe(effectId);
|
|
184
184
|
if (initialDoc) {
|
|
185
185
|
const problems = documentErrors(initialDoc, description);
|
|
186
|
-
if (problems.length) throw new (0,
|
|
186
|
+
if (problems.length) throw new (0, _chunkNTWR5TQBcjs.EffectControlError)(effectId, problems);
|
|
187
187
|
}
|
|
188
188
|
if (description.kind === "motion") {
|
|
189
|
-
throw new (0,
|
|
189
|
+
throw new (0, _chunkNTWR5TQBcjs.EffectUnsupportedError)("Motion effects cannot be authored as pixel effects", effectId);
|
|
190
190
|
}
|
|
191
191
|
let disposed = false;
|
|
192
192
|
let playing = false;
|
|
@@ -207,7 +207,7 @@ async function createEffectAuthoringSession(source, options) {
|
|
|
207
207
|
const found = description.presets.find((p) => p.name === requestedPreset);
|
|
208
208
|
if (!found) {
|
|
209
209
|
const validNames = description.presets.map((p) => `"${p.name}"`).join(", ");
|
|
210
|
-
throw new (0,
|
|
210
|
+
throw new (0, _chunkNTWR5TQBcjs.EffectUnsupportedError)(
|
|
211
211
|
`Unknown preset "${requestedPreset}" for effect "${effectId}". Valid presets are: ${validNames || "none"}`,
|
|
212
212
|
effectId
|
|
213
213
|
);
|
|
@@ -321,7 +321,7 @@ async function createEffectAuthoringSession(source, options) {
|
|
|
321
321
|
if (!validNames.includes(name)) {
|
|
322
322
|
return { ok: false, message: `there is no control "${name}"; the controls are ${validNames.join(", ")}` };
|
|
323
323
|
}
|
|
324
|
-
const errors =
|
|
324
|
+
const errors = _chunkNTWR5TQBcjs.effectValueErrors.call(void 0, description, { [name]: value });
|
|
325
325
|
if (errors.length > 0) {
|
|
326
326
|
return { ok: false, message: valueErrorMessage(errors) };
|
|
327
327
|
}
|
|
@@ -391,7 +391,7 @@ async function createEffectAuthoringSession(source, options) {
|
|
|
391
391
|
if (!validNames.includes(k)) {
|
|
392
392
|
return { ok: false, message: `there is no control "${k}"; the controls are ${validNames.join(", ")}` };
|
|
393
393
|
}
|
|
394
|
-
const errors =
|
|
394
|
+
const errors = _chunkNTWR5TQBcjs.effectValueErrors.call(void 0, description, { [k]: v });
|
|
395
395
|
if (errors.length > 0) {
|
|
396
396
|
return { ok: false, message: valueErrorMessage(errors) };
|
|
397
397
|
}
|
|
@@ -528,7 +528,7 @@ async function createEffectAuthoringSession(source, options) {
|
|
|
528
528
|
return { ok: false, message: `invalid easing: ${String(easing)}` };
|
|
529
529
|
}
|
|
530
530
|
const targetValue = value !== void 0 ? value : valuesAtTime(time, baseValues, tracks)[name];
|
|
531
|
-
const errors =
|
|
531
|
+
const errors = _chunkNTWR5TQBcjs.effectValueErrors.call(void 0, description, { [name]: targetValue });
|
|
532
532
|
if (errors.length > 0) {
|
|
533
533
|
return { ok: false, message: valueErrorMessage(errors) };
|
|
534
534
|
}
|
|
@@ -705,7 +705,7 @@ async function createEffectAuthoringSession(source, options) {
|
|
|
705
705
|
},
|
|
706
706
|
async createPreview(opts) {
|
|
707
707
|
if (disposed) {
|
|
708
|
-
throw new (0,
|
|
708
|
+
throw new (0, _chunkNTWR5TQBcjs.EffectDisposedError)(effectId);
|
|
709
709
|
}
|
|
710
710
|
let renderer;
|
|
711
711
|
try {
|
|
@@ -730,7 +730,7 @@ async function createEffectAuthoringSession(source, options) {
|
|
|
730
730
|
height: renderer.height,
|
|
731
731
|
depth: renderer.depth,
|
|
732
732
|
render: async (req) => {
|
|
733
|
-
if (disposed) throw new (0,
|
|
733
|
+
if (disposed) throw new (0, _chunkNTWR5TQBcjs.EffectDisposedError)(effectId);
|
|
734
734
|
const effectiveValues = _nullishCoalesce(req.values, () => ( valuesAtTime(req.time, baseValues, tracks)));
|
|
735
735
|
const pixels = await renderer.render({
|
|
736
736
|
...req,
|
|
@@ -68,6 +68,12 @@ function resolveEffectValues(description, values) {
|
|
|
68
68
|
if (errors.length) throw new EffectControlError(description.id, errors);
|
|
69
69
|
return { ...description.defaults, ...values ?? {} };
|
|
70
70
|
}
|
|
71
|
+
function effectOffered(e, uses) {
|
|
72
|
+
if (!uses) return e.kind !== "motion" && e.kind !== "camera";
|
|
73
|
+
if (e.kind === "motion" && !uses.includes("motion")) return false;
|
|
74
|
+
if (e.kind === "camera" && !uses.includes("camera")) return false;
|
|
75
|
+
return e.uses.some((u) => uses.includes(u));
|
|
76
|
+
}
|
|
71
77
|
function normaliseEffectTag(tag) {
|
|
72
78
|
return tag.trim().toLowerCase().replace(/[\s_-]+/g, "-");
|
|
73
79
|
}
|
|
@@ -167,10 +173,47 @@ var EffectsSlot = class {
|
|
|
167
173
|
return () => this.listeners.delete(listener);
|
|
168
174
|
}
|
|
169
175
|
};
|
|
176
|
+
var BEFORE_CUT = 1e-6;
|
|
177
|
+
function isCameraView(view) {
|
|
178
|
+
if (!view || typeof view !== "object") return false;
|
|
179
|
+
const v = view;
|
|
180
|
+
if (!(typeof v.zoom === "number" && v.zoom > 0 && Number.isFinite(v.zoom))) return false;
|
|
181
|
+
if (!Number.isFinite(v.scrollX) || !Number.isFinite(v.scrollY)) return false;
|
|
182
|
+
return ["tilt", "turn", "roll", "perspective", "blur", "blurAngle"].every((k) => v[k] === void 0 || Number.isFinite(v[k]));
|
|
183
|
+
}
|
|
184
|
+
function sampleCameraViews(view, options) {
|
|
185
|
+
const { ms, fps, cut } = options;
|
|
186
|
+
if (!(Number.isFinite(ms) && ms >= 0)) throw new EffectUnsupportedError(`ms must be a finite number of ms \u2265 0, got ${ms}.`);
|
|
187
|
+
if (!(Number.isFinite(fps) && fps > 0)) throw new EffectUnsupportedError(`fps must be a number > 0, got ${fps}.`);
|
|
188
|
+
if (cut !== void 0 && !(cut >= 0 && cut <= 1)) throw new EffectUnsupportedError(`cut must be 0\u20131, got ${cut}.`);
|
|
189
|
+
if (ms === 0) return { keys: [{ t: 0, view: view(0) }, { t: 0, view: view(1) }], ...cut !== void 0 ? { cut: 0 } : {} };
|
|
190
|
+
const step = 1e3 / fps;
|
|
191
|
+
const cutMs = cut === void 0 ? void 0 : cut * ms;
|
|
192
|
+
const keys = [];
|
|
193
|
+
const frames = Math.ceil(ms / step - 1e-9);
|
|
194
|
+
for (let i = 0; i <= frames; i++) {
|
|
195
|
+
const t = Math.min(ms, i * step);
|
|
196
|
+
if (cutMs !== void 0 && (keys.length ? keys[keys.length - 1].t : -1) < cutMs && t >= cutMs) {
|
|
197
|
+
keys.push({ t: cutMs, view: view(Math.max(0, cut - BEFORE_CUT)) }, { t: cutMs, view: view(cut) });
|
|
198
|
+
if (t === cutMs) continue;
|
|
199
|
+
}
|
|
200
|
+
keys.push({ t, view: view(t / ms) });
|
|
201
|
+
}
|
|
202
|
+
return { keys, ...cutMs !== void 0 ? { cut: cutMs } : {} };
|
|
203
|
+
}
|
|
204
|
+
async function sampleEffectCameraMove(provider, id, request) {
|
|
205
|
+
if (!provider.capabilities.supportsCamera || !provider.cameraView) throw new EffectUnsupportedError(`${provider.name} has no camera moves (capabilities.supportsCamera is not set).`, id);
|
|
206
|
+
if (provider.sampleCameraMove) return provider.sampleCameraMove(id, request);
|
|
207
|
+
const d = await provider.describe(id);
|
|
208
|
+
if (d.kind !== "camera" || !d.camera) throw new EffectUnsupportedError(`"${id}" is a ${d.kind} effect, not a camera move.`, id);
|
|
209
|
+
const { from, to, ms, stage, values } = request;
|
|
210
|
+
return sampleCameraViews((u) => provider.cameraView(id, { from, to, u, ms, stage }, values), { ms, fps: request.fps, cut: d.camera.cut });
|
|
211
|
+
}
|
|
170
212
|
|
|
171
213
|
// src/effects/types.ts
|
|
172
|
-
var EFFECT_KINDS = ["shader", "vector", "motion"];
|
|
173
|
-
var EFFECT_USES = ["filter", "transition", "generator", "overlay", "title", "motion", "interactive"];
|
|
214
|
+
var EFFECT_KINDS = ["shader", "vector", "motion", "camera"];
|
|
215
|
+
var EFFECT_USES = ["filter", "transition", "generator", "overlay", "title", "motion", "interactive", "camera"];
|
|
216
|
+
var CAMERA_MOVE_ROLES = ["transition", "hold"];
|
|
174
217
|
|
|
175
218
|
// src/effects/tools.ts
|
|
176
219
|
var ANNOTATIONS = {
|
|
@@ -203,7 +246,8 @@ var summaryOut = (e) => ({
|
|
|
203
246
|
...e.tags?.length ? { tags: e.tags } : {},
|
|
204
247
|
transparent: e.transparent,
|
|
205
248
|
loop: e.loop,
|
|
206
|
-
...e.duration !== void 0 ? { duration: e.duration } : {}
|
|
249
|
+
...e.duration !== void 0 ? { duration: e.duration } : {},
|
|
250
|
+
...e.camera ? { camera: e.camera } : {}
|
|
207
251
|
});
|
|
208
252
|
function createEffectToolProvider(host) {
|
|
209
253
|
let catalog = null;
|
|
@@ -247,7 +291,7 @@ function createEffectToolProvider(host) {
|
|
|
247
291
|
description: `${what}: control name \u2192 value, as listed by describe_effect (its "controls" schema: types, ranges, units and defaults). Only the given controls change; colours are "#rrggbb".${keyframes ? " A number control may instead be keyframes { keys: [{ t: ms from the start, v, ease }] }." : ""} Unknown controls and out-of-range values are refused with the valid ones.`
|
|
248
292
|
});
|
|
249
293
|
const effectIdSchema = (uses) => {
|
|
250
|
-
const effects = catalogFor(host.provider())?.filter((e) => (e
|
|
294
|
+
const effects = catalogFor(host.provider())?.filter((e) => effectOffered(e, uses));
|
|
251
295
|
const base = `An effect id from search_effects (use ${uses.map((u) => `"${u}"`).join(" or ")}).`;
|
|
252
296
|
return effects && effects.length && effects.length <= ENUM_LIMIT ? { type: "string", enum: effects.map((e) => e.id), description: `${base} One of: ${effects.map((e) => `${e.id} (${e.name})`).join(", ")}.` } : { type: "string", minLength: 1, description: base };
|
|
253
297
|
};
|
|
@@ -261,12 +305,12 @@ function createEffectToolProvider(host) {
|
|
|
261
305
|
{
|
|
262
306
|
name: "search_effects",
|
|
263
307
|
title: "Search effects",
|
|
264
|
-
description: `Searches the effects provider's catalog. Every word of query must appear in an effect's id, name, category, tags or description; filter by kind (shader, vector, motion), category, use (${EFFECT_USES.join(", ")}) or tags (effects carrying every one). For this editor, apply_effect takes uses ${host.applyUses.join(" or ")}. Returns { provider, effects: [{ id, name, kind, category, uses, description, tags, transparent, loop, duration (ms) }], total, tags: [{ tag, count }] }: tags lists the tags of every match, the most used first, so a broad search (or none) shows the tags to narrow by. A tag the catalog does not have comes back in unknownTags with the nearest ones. With no provider registered it returns available: false and the reason. Call describe_effect next for an effect's controls.`,
|
|
308
|
+
description: `Searches the effects provider's catalog. Every word of query must appear in an effect's id, name, category, tags or description; filter by kind (shader, vector, motion, camera), category, use (${EFFECT_USES.join(", ")}) or tags (effects carrying every one). For this editor, apply_effect takes uses ${host.applyUses.join(" or ")}. Returns { provider, effects: [{ id, name, kind, category, uses, description, tags, transparent, loop, duration (ms), camera: { role, durationMs, cut } for camera moves }], total, tags: [{ tag, count }] }: tags lists the tags of every match, the most used first, so a broad search (or none) shows the tags to narrow by. A tag the catalog does not have comes back in unknownTags with the nearest ones. With no provider registered it returns available: false and the reason. Call describe_effect next for an effect's controls.`,
|
|
265
309
|
inputSchema: object({
|
|
266
310
|
query: { type: "string", description: "Words to match (default: every effect)." },
|
|
267
|
-
kind: { type: "string", enum: [...EFFECT_KINDS], description: "shader (pixels), vector (animated SVG)
|
|
311
|
+
kind: { type: "string", enum: [...EFFECT_KINDS], description: "shader (pixels), vector (animated SVG), motion (animates vector art) or camera (moves a scene's camera; no pixels)." },
|
|
268
312
|
category: { type: "string", minLength: 1, description: `The provider's category, e.g. "gradient", "light", "transition".` },
|
|
269
|
-
use: { type: "string", enum: [...EFFECT_USES], description: "What the effect is for: filter changes a picture, transition blends two, generator draws a background, overlay draws over content, title draws a title, motion animates vector art, interactive reacts to input." },
|
|
313
|
+
use: { type: "string", enum: [...EFFECT_USES], description: "What the effect is for: filter changes a picture, transition blends two, generator draws a background, overlay draws over content, title draws a title, motion animates vector art, interactive reacts to input, camera moves a scene's camera." },
|
|
270
314
|
tags: { type: "array", items: { type: "string", minLength: 1 }, description: "Only effects carrying every one of these tags, as search_effects lists them (any case; spaces count as hyphens)." },
|
|
271
315
|
limit: { type: "integer", minimum: 1, maximum: 200, description: "Most effects to return (default 20)." }
|
|
272
316
|
}),
|
|
@@ -290,14 +334,14 @@ function createEffectToolProvider(host) {
|
|
|
290
334
|
{
|
|
291
335
|
name: "describe_effect",
|
|
292
336
|
title: "Describe an effect",
|
|
293
|
-
description: "Returns one effect's controls as a strict JSON Schema (each control described, with its type, range and units), its defaults, presets (named sets of values) and inputs, plus its summary. Use the control names and ranges for apply_effect and update_effect values. With no provider registered it returns available: false and the reason.",
|
|
337
|
+
description: "Returns one effect's controls as a strict JSON Schema (each control described, with its type, range and units), its defaults, presets (named sets of values) and inputs, plus its summary (for a camera move, camera: { role transition or hold, durationMs, cut 0\u20131 where the view jumps }). Use the control names and ranges for apply_effect and update_effect values. With no provider registered it returns available: false and the reason.",
|
|
294
338
|
inputSchema: object({ effect: { type: "string", minLength: 1, description: "An effect id from search_effects or list_applied_effects." } }, ["effect"]),
|
|
295
339
|
annotations: { title: "Describe an effect", ...ANNOTATIONS.read },
|
|
296
340
|
handler: async (args) => {
|
|
297
341
|
const p = host.provider();
|
|
298
342
|
if (!p) return { available: false, reason: NO_PROVIDER };
|
|
299
343
|
const d = await explain(async () => p.describe(args.effect));
|
|
300
|
-
return { available: true, ...summaryOut(d), controls: d.controls, defaults: d.defaults, presets: d.presets, inputs: d.inputs, appliesHere: (d
|
|
344
|
+
return { available: true, ...summaryOut(d), controls: d.controls, defaults: d.defaults, presets: d.presets, inputs: d.inputs, appliesHere: effectOffered(d, host.applyUses) };
|
|
301
345
|
}
|
|
302
346
|
},
|
|
303
347
|
{
|
|
@@ -403,6 +447,7 @@ export {
|
|
|
403
447
|
isEffectError,
|
|
404
448
|
effectValueErrors,
|
|
405
449
|
resolveEffectValues,
|
|
450
|
+
effectOffered,
|
|
406
451
|
normaliseEffectTag,
|
|
407
452
|
hasEffectTags,
|
|
408
453
|
countEffectTags,
|
|
@@ -414,7 +459,11 @@ export {
|
|
|
414
459
|
encodeEffectFloat,
|
|
415
460
|
applyEffectMask,
|
|
416
461
|
EffectsSlot,
|
|
462
|
+
isCameraView,
|
|
463
|
+
sampleCameraViews,
|
|
464
|
+
sampleEffectCameraMove,
|
|
417
465
|
EFFECT_KINDS,
|
|
418
466
|
EFFECT_USES,
|
|
467
|
+
CAMERA_MOVE_ROLES,
|
|
419
468
|
createEffectToolProvider
|
|
420
469
|
};
|
|
@@ -7,7 +7,7 @@ var _chunkPY4GWSE2cjs = require('./chunk-PY4GWSE2.cjs');
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _chunkNTWR5TQBcjs = require('./chunk-NTWR5TQB.cjs');
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
var _chunkWOFXZ3XUcjs = require('./chunk-WOFXZ3XU.cjs');
|
|
@@ -1307,12 +1307,12 @@ function videoEffectLayerKey(layer, width, height) {
|
|
|
1307
1307
|
}
|
|
1308
1308
|
function mixEffectPixels(a, b, k) {
|
|
1309
1309
|
if (k >= 1) return b;
|
|
1310
|
-
const out =
|
|
1310
|
+
const out = _chunkNTWR5TQBcjs.createEffectPixels.call(void 0, a.width, a.height);
|
|
1311
1311
|
for (let i = 0; i < out.data.length; i++) out.data[i] = a.data[i] + (b.data[i] - a.data[i]) * k;
|
|
1312
1312
|
return out;
|
|
1313
1313
|
}
|
|
1314
1314
|
function overEffectPixels(base, top, opacity = 1) {
|
|
1315
|
-
const out =
|
|
1315
|
+
const out = _chunkNTWR5TQBcjs.createEffectPixels.call(void 0, base.width, base.height);
|
|
1316
1316
|
const o = out.data;
|
|
1317
1317
|
const b = base.data;
|
|
1318
1318
|
const t = top.data;
|
|
@@ -1357,7 +1357,7 @@ var VideoEffectsEngine = (_class2 = class {
|
|
|
1357
1357
|
__init10() {this.generation = 0}
|
|
1358
1358
|
|
|
1359
1359
|
constructor(options = {}) {;_class2.prototype.__init5.call(this);_class2.prototype.__init6.call(this);_class2.prototype.__init7.call(this);_class2.prototype.__init8.call(this);_class2.prototype.__init9.call(this);_class2.prototype.__init10.call(this);
|
|
1360
|
-
this.slot = _nullishCoalesce(options.slot, () => ( new (0,
|
|
1360
|
+
this.slot = _nullishCoalesce(options.slot, () => ( new (0, _chunkNTWR5TQBcjs.EffectsSlot)()));
|
|
1361
1361
|
this.maxEntries = _nullishCoalesce(options.maxEntries, () => ( 120));
|
|
1362
1362
|
this.toImage = _nullishCoalesce(options.toImage, () => ( defaultToImage));
|
|
1363
1363
|
this.pool = new (0, _chunkPY4GWSE2cjs.EffectRendererPool)({ maxRenderers: options.maxRenderers });
|
|
@@ -1499,7 +1499,7 @@ function checkVideoEffectPlace(d, place) {
|
|
|
1499
1499
|
if (d.kind === "motion" || !d.uses.some((u) => allowed.includes(u))) {
|
|
1500
1500
|
const where = place === "clip" ? "on a clip" : place === "transition" ? "as a transition" : "as an effect clip";
|
|
1501
1501
|
const instead = d.uses.includes("transition") ? "set_video_effect_transition" : d.uses.some((u) => VIDEO_EFFECT_PLACES.generator.includes(u)) ? "add_video_effect_clip" : d.uses.some((u) => u === "filter") ? "apply_effect" : null;
|
|
1502
|
-
throw new (0,
|
|
1502
|
+
throw new (0, _chunkNTWR5TQBcjs.EffectUnsupportedError)(
|
|
1503
1503
|
`"${d.id}" (${d.name}) is a ${d.uses.join(" / ")} effect and cannot be used ${where}, which takes ${allowed.join(" or ")} effects${instead ? `; use ${instead} instead` : ""}. search_effects with use "${allowed[0]}" lists ones that fit.`,
|
|
1504
1504
|
d.id
|
|
1505
1505
|
);
|
|
@@ -1520,12 +1520,12 @@ function checkVideoEffectValues(d, values, options = {}) {
|
|
|
1520
1520
|
else if (type !== "number" && type !== "integer") errors.push({ path: `/${k}`, message: "only number controls can be keyframed." });
|
|
1521
1521
|
else for (const [i, key] of v.keys.entries()) for (const e of _chunkWOFXZ3XUcjs.validateJsonSchema.call(void 0, key.v, schema)) errors.push({ path: `/${k}/keys/${i}/v`, message: e.message });
|
|
1522
1522
|
}
|
|
1523
|
-
for (const e of
|
|
1523
|
+
for (const e of _chunkNTWR5TQBcjs.effectValueErrors.call(void 0, d, plain)) {
|
|
1524
1524
|
const name = e.path.split("/")[1];
|
|
1525
1525
|
const about = name && _optionalChain([d, 'access', _46 => _46.controls, 'access', _47 => _47.properties, 'access', _48 => _48[name], 'optionalAccess', _49 => _49.description]);
|
|
1526
1526
|
errors.push(about ? { path: e.path, message: `${e.message} (${about})` } : e);
|
|
1527
1527
|
}
|
|
1528
|
-
if (errors.length) throw new (0,
|
|
1528
|
+
if (errors.length) throw new (0, _chunkNTWR5TQBcjs.EffectControlError)(d.id, errors);
|
|
1529
1529
|
return { ..._nullishCoalesce(options.base, () => ( d.defaults)), ..._nullishCoalesce(values, () => ( {})) };
|
|
1530
1530
|
}
|
|
1531
1531
|
|
|
@@ -68,6 +68,12 @@ function resolveEffectValues(description, values) {
|
|
|
68
68
|
if (errors.length) throw new EffectControlError(description.id, errors);
|
|
69
69
|
return { ...description.defaults, ..._nullishCoalesce(values, () => ( {})) };
|
|
70
70
|
}
|
|
71
|
+
function effectOffered(e, uses) {
|
|
72
|
+
if (!uses) return e.kind !== "motion" && e.kind !== "camera";
|
|
73
|
+
if (e.kind === "motion" && !uses.includes("motion")) return false;
|
|
74
|
+
if (e.kind === "camera" && !uses.includes("camera")) return false;
|
|
75
|
+
return e.uses.some((u) => uses.includes(u));
|
|
76
|
+
}
|
|
71
77
|
function normaliseEffectTag(tag) {
|
|
72
78
|
return tag.trim().toLowerCase().replace(/[\s_-]+/g, "-");
|
|
73
79
|
}
|
|
@@ -167,10 +173,47 @@ var EffectsSlot = (_class = class {constructor() { _class.prototype.__init.call(
|
|
|
167
173
|
return () => this.listeners.delete(listener);
|
|
168
174
|
}
|
|
169
175
|
}, _class);
|
|
176
|
+
var BEFORE_CUT = 1e-6;
|
|
177
|
+
function isCameraView(view) {
|
|
178
|
+
if (!view || typeof view !== "object") return false;
|
|
179
|
+
const v = view;
|
|
180
|
+
if (!(typeof v.zoom === "number" && v.zoom > 0 && Number.isFinite(v.zoom))) return false;
|
|
181
|
+
if (!Number.isFinite(v.scrollX) || !Number.isFinite(v.scrollY)) return false;
|
|
182
|
+
return ["tilt", "turn", "roll", "perspective", "blur", "blurAngle"].every((k) => v[k] === void 0 || Number.isFinite(v[k]));
|
|
183
|
+
}
|
|
184
|
+
function sampleCameraViews(view, options) {
|
|
185
|
+
const { ms, fps, cut } = options;
|
|
186
|
+
if (!(Number.isFinite(ms) && ms >= 0)) throw new EffectUnsupportedError(`ms must be a finite number of ms \u2265 0, got ${ms}.`);
|
|
187
|
+
if (!(Number.isFinite(fps) && fps > 0)) throw new EffectUnsupportedError(`fps must be a number > 0, got ${fps}.`);
|
|
188
|
+
if (cut !== void 0 && !(cut >= 0 && cut <= 1)) throw new EffectUnsupportedError(`cut must be 0\u20131, got ${cut}.`);
|
|
189
|
+
if (ms === 0) return { keys: [{ t: 0, view: view(0) }, { t: 0, view: view(1) }], ...cut !== void 0 ? { cut: 0 } : {} };
|
|
190
|
+
const step = 1e3 / fps;
|
|
191
|
+
const cutMs = cut === void 0 ? void 0 : cut * ms;
|
|
192
|
+
const keys = [];
|
|
193
|
+
const frames = Math.ceil(ms / step - 1e-9);
|
|
194
|
+
for (let i = 0; i <= frames; i++) {
|
|
195
|
+
const t = Math.min(ms, i * step);
|
|
196
|
+
if (cutMs !== void 0 && (keys.length ? keys[keys.length - 1].t : -1) < cutMs && t >= cutMs) {
|
|
197
|
+
keys.push({ t: cutMs, view: view(Math.max(0, cut - BEFORE_CUT)) }, { t: cutMs, view: view(cut) });
|
|
198
|
+
if (t === cutMs) continue;
|
|
199
|
+
}
|
|
200
|
+
keys.push({ t, view: view(t / ms) });
|
|
201
|
+
}
|
|
202
|
+
return { keys, ...cutMs !== void 0 ? { cut: cutMs } : {} };
|
|
203
|
+
}
|
|
204
|
+
async function sampleEffectCameraMove(provider, id, request) {
|
|
205
|
+
if (!provider.capabilities.supportsCamera || !provider.cameraView) throw new EffectUnsupportedError(`${provider.name} has no camera moves (capabilities.supportsCamera is not set).`, id);
|
|
206
|
+
if (provider.sampleCameraMove) return provider.sampleCameraMove(id, request);
|
|
207
|
+
const d = await provider.describe(id);
|
|
208
|
+
if (d.kind !== "camera" || !d.camera) throw new EffectUnsupportedError(`"${id}" is a ${d.kind} effect, not a camera move.`, id);
|
|
209
|
+
const { from, to, ms, stage, values } = request;
|
|
210
|
+
return sampleCameraViews((u) => provider.cameraView(id, { from, to, u, ms, stage }, values), { ms, fps: request.fps, cut: d.camera.cut });
|
|
211
|
+
}
|
|
170
212
|
|
|
171
213
|
// src/effects/types.ts
|
|
172
|
-
var EFFECT_KINDS = ["shader", "vector", "motion"];
|
|
173
|
-
var EFFECT_USES = ["filter", "transition", "generator", "overlay", "title", "motion", "interactive"];
|
|
214
|
+
var EFFECT_KINDS = ["shader", "vector", "motion", "camera"];
|
|
215
|
+
var EFFECT_USES = ["filter", "transition", "generator", "overlay", "title", "motion", "interactive", "camera"];
|
|
216
|
+
var CAMERA_MOVE_ROLES = ["transition", "hold"];
|
|
174
217
|
|
|
175
218
|
// src/effects/tools.ts
|
|
176
219
|
var ANNOTATIONS = {
|
|
@@ -203,7 +246,8 @@ var summaryOut = (e) => ({
|
|
|
203
246
|
..._optionalChain([e, 'access', _2 => _2.tags, 'optionalAccess', _3 => _3.length]) ? { tags: e.tags } : {},
|
|
204
247
|
transparent: e.transparent,
|
|
205
248
|
loop: e.loop,
|
|
206
|
-
...e.duration !== void 0 ? { duration: e.duration } : {}
|
|
249
|
+
...e.duration !== void 0 ? { duration: e.duration } : {},
|
|
250
|
+
...e.camera ? { camera: e.camera } : {}
|
|
207
251
|
});
|
|
208
252
|
function createEffectToolProvider(host) {
|
|
209
253
|
let catalog = null;
|
|
@@ -247,7 +291,7 @@ function createEffectToolProvider(host) {
|
|
|
247
291
|
description: `${what}: control name \u2192 value, as listed by describe_effect (its "controls" schema: types, ranges, units and defaults). Only the given controls change; colours are "#rrggbb".${keyframes ? " A number control may instead be keyframes { keys: [{ t: ms from the start, v, ease }] }." : ""} Unknown controls and out-of-range values are refused with the valid ones.`
|
|
248
292
|
});
|
|
249
293
|
const effectIdSchema = (uses) => {
|
|
250
|
-
const effects = _optionalChain([catalogFor, 'call', _5 => _5(host.provider()), 'optionalAccess', _6 => _6.filter, 'call', _7 => _7((e) => (e
|
|
294
|
+
const effects = _optionalChain([catalogFor, 'call', _5 => _5(host.provider()), 'optionalAccess', _6 => _6.filter, 'call', _7 => _7((e) => effectOffered(e, uses))]);
|
|
251
295
|
const base = `An effect id from search_effects (use ${uses.map((u) => `"${u}"`).join(" or ")}).`;
|
|
252
296
|
return effects && effects.length && effects.length <= ENUM_LIMIT ? { type: "string", enum: effects.map((e) => e.id), description: `${base} One of: ${effects.map((e) => `${e.id} (${e.name})`).join(", ")}.` } : { type: "string", minLength: 1, description: base };
|
|
253
297
|
};
|
|
@@ -261,12 +305,12 @@ function createEffectToolProvider(host) {
|
|
|
261
305
|
{
|
|
262
306
|
name: "search_effects",
|
|
263
307
|
title: "Search effects",
|
|
264
|
-
description: `Searches the effects provider's catalog. Every word of query must appear in an effect's id, name, category, tags or description; filter by kind (shader, vector, motion), category, use (${EFFECT_USES.join(", ")}) or tags (effects carrying every one). For this editor, apply_effect takes uses ${host.applyUses.join(" or ")}. Returns { provider, effects: [{ id, name, kind, category, uses, description, tags, transparent, loop, duration (ms) }], total, tags: [{ tag, count }] }: tags lists the tags of every match, the most used first, so a broad search (or none) shows the tags to narrow by. A tag the catalog does not have comes back in unknownTags with the nearest ones. With no provider registered it returns available: false and the reason. Call describe_effect next for an effect's controls.`,
|
|
308
|
+
description: `Searches the effects provider's catalog. Every word of query must appear in an effect's id, name, category, tags or description; filter by kind (shader, vector, motion, camera), category, use (${EFFECT_USES.join(", ")}) or tags (effects carrying every one). For this editor, apply_effect takes uses ${host.applyUses.join(" or ")}. Returns { provider, effects: [{ id, name, kind, category, uses, description, tags, transparent, loop, duration (ms), camera: { role, durationMs, cut } for camera moves }], total, tags: [{ tag, count }] }: tags lists the tags of every match, the most used first, so a broad search (or none) shows the tags to narrow by. A tag the catalog does not have comes back in unknownTags with the nearest ones. With no provider registered it returns available: false and the reason. Call describe_effect next for an effect's controls.`,
|
|
265
309
|
inputSchema: object({
|
|
266
310
|
query: { type: "string", description: "Words to match (default: every effect)." },
|
|
267
|
-
kind: { type: "string", enum: [...EFFECT_KINDS], description: "shader (pixels), vector (animated SVG)
|
|
311
|
+
kind: { type: "string", enum: [...EFFECT_KINDS], description: "shader (pixels), vector (animated SVG), motion (animates vector art) or camera (moves a scene's camera; no pixels)." },
|
|
268
312
|
category: { type: "string", minLength: 1, description: `The provider's category, e.g. "gradient", "light", "transition".` },
|
|
269
|
-
use: { type: "string", enum: [...EFFECT_USES], description: "What the effect is for: filter changes a picture, transition blends two, generator draws a background, overlay draws over content, title draws a title, motion animates vector art, interactive reacts to input." },
|
|
313
|
+
use: { type: "string", enum: [...EFFECT_USES], description: "What the effect is for: filter changes a picture, transition blends two, generator draws a background, overlay draws over content, title draws a title, motion animates vector art, interactive reacts to input, camera moves a scene's camera." },
|
|
270
314
|
tags: { type: "array", items: { type: "string", minLength: 1 }, description: "Only effects carrying every one of these tags, as search_effects lists them (any case; spaces count as hyphens)." },
|
|
271
315
|
limit: { type: "integer", minimum: 1, maximum: 200, description: "Most effects to return (default 20)." }
|
|
272
316
|
}),
|
|
@@ -290,14 +334,14 @@ function createEffectToolProvider(host) {
|
|
|
290
334
|
{
|
|
291
335
|
name: "describe_effect",
|
|
292
336
|
title: "Describe an effect",
|
|
293
|
-
description: "Returns one effect's controls as a strict JSON Schema (each control described, with its type, range and units), its defaults, presets (named sets of values) and inputs, plus its summary. Use the control names and ranges for apply_effect and update_effect values. With no provider registered it returns available: false and the reason.",
|
|
337
|
+
description: "Returns one effect's controls as a strict JSON Schema (each control described, with its type, range and units), its defaults, presets (named sets of values) and inputs, plus its summary (for a camera move, camera: { role transition or hold, durationMs, cut 0\u20131 where the view jumps }). Use the control names and ranges for apply_effect and update_effect values. With no provider registered it returns available: false and the reason.",
|
|
294
338
|
inputSchema: object({ effect: { type: "string", minLength: 1, description: "An effect id from search_effects or list_applied_effects." } }, ["effect"]),
|
|
295
339
|
annotations: { title: "Describe an effect", ...ANNOTATIONS.read },
|
|
296
340
|
handler: async (args) => {
|
|
297
341
|
const p = host.provider();
|
|
298
342
|
if (!p) return { available: false, reason: NO_PROVIDER };
|
|
299
343
|
const d = await explain(async () => p.describe(args.effect));
|
|
300
|
-
return { available: true, ...summaryOut(d), controls: d.controls, defaults: d.defaults, presets: d.presets, inputs: d.inputs, appliesHere: (d
|
|
344
|
+
return { available: true, ...summaryOut(d), controls: d.controls, defaults: d.defaults, presets: d.presets, inputs: d.inputs, appliesHere: effectOffered(d, host.applyUses) };
|
|
301
345
|
}
|
|
302
346
|
},
|
|
303
347
|
{
|
|
@@ -417,4 +461,9 @@ function createEffectToolProvider(host) {
|
|
|
417
461
|
|
|
418
462
|
|
|
419
463
|
|
|
420
|
-
|
|
464
|
+
|
|
465
|
+
|
|
466
|
+
|
|
467
|
+
|
|
468
|
+
|
|
469
|
+
exports.EFFECT_ERROR_CODES = EFFECT_ERROR_CODES; exports.EffectError = EffectError; exports.UnknownEffectError = UnknownEffectError; exports.EffectControlError = EffectControlError; exports.EffectUnsupportedError = EffectUnsupportedError; exports.EffectDisposedError = EffectDisposedError; exports.NoEffectsProviderError = NoEffectsProviderError; exports.isEffectError = isEffectError; exports.effectValueErrors = effectValueErrors; exports.resolveEffectValues = resolveEffectValues; exports.effectOffered = effectOffered; exports.normaliseEffectTag = normaliseEffectTag; exports.hasEffectTags = hasEffectTags; exports.countEffectTags = countEffectTags; exports.searchEffectSummaries = searchEffectSummaries; exports.createEffectPixels = createEffectPixels; exports.isEffectPixels = isEffectPixels; exports.srgbToLinear = srgbToLinear; exports.linearToSrgb = linearToSrgb; exports.encodeEffectFloat = encodeEffectFloat; exports.applyEffectMask = applyEffectMask; exports.EffectsSlot = EffectsSlot; exports.isCameraView = isCameraView; exports.sampleCameraViews = sampleCameraViews; exports.sampleEffectCameraMove = sampleEffectCameraMove; exports.EFFECT_KINDS = EFFECT_KINDS; exports.EFFECT_USES = EFFECT_USES; exports.CAMERA_MOVE_ROLES = CAMERA_MOVE_ROLES; exports.createEffectToolProvider = createEffectToolProvider;
|