pixi-effects 0.48.0 → 0.48.2
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 +14 -0
- package/README.md +5 -5
- package/ai/chat-template.html +3 -3
- package/dist/Composition-5FKV2IBP.js +7 -0
- package/dist/{Composition-ZCRJHBB5.js.map → Composition-5FKV2IBP.js.map} +1 -1
- package/dist/Composition-TJ5D7Z63.cjs +16 -0
- package/dist/{Composition-PMWLJQPI.cjs.map → Composition-TJ5D7Z63.cjs.map} +1 -1
- package/dist/{Spans-KTUPDFSR.cjs → Spans-5ENZ3XGS.cjs} +9 -9
- package/dist/{Spans-KTUPDFSR.cjs.map → Spans-5ENZ3XGS.cjs.map} +1 -1
- package/dist/{Spans-FMAVPATS.js → Spans-6A3VLHRH.js} +4 -4
- package/dist/{Spans-FMAVPATS.js.map → Spans-6A3VLHRH.js.map} +1 -1
- package/dist/{chunk-NGK4E536.cjs → chunk-45ALIMAF.cjs} +85 -60
- package/dist/chunk-45ALIMAF.cjs.map +1 -0
- package/dist/{chunk-UI7CEUTP.js → chunk-6D4W2KZQ.js} +3 -3
- package/dist/{chunk-UI7CEUTP.js.map → chunk-6D4W2KZQ.js.map} +1 -1
- package/dist/{chunk-OGLRSR6C.cjs → chunk-CCPJD76D.cjs} +63 -63
- package/dist/{chunk-OGLRSR6C.cjs.map → chunk-CCPJD76D.cjs.map} +1 -1
- package/dist/{chunk-4PYVHLIK.js → chunk-IVKI6CPH.js} +23 -22
- package/dist/chunk-IVKI6CPH.js.map +1 -0
- package/dist/{chunk-GX2WQV4A.js → chunk-RCKLUCB7.js} +45 -20
- package/dist/chunk-RCKLUCB7.js.map +1 -0
- package/dist/{chunk-ECLBZV4N.cjs → chunk-Z3DM4ETD.cjs} +68 -86
- package/dist/chunk-Z3DM4ETD.cjs.map +1 -0
- package/dist/index.cjs +33 -33
- package/dist/index.js +3 -3
- package/dist/loader.css +1 -1
- package/dist/present.cjs +3 -3
- package/dist/present.js +3 -3
- package/dist/three.cjs +5 -5
- package/dist/three.js +1 -1
- package/llms-full.txt +2 -2
- package/package.json +1 -1
- package/skills/pixi-effects/SKILL.md +1 -1
- package/skills/pixi-effects/reference/pitfalls.md +1 -1
- package/skills/pixi-effects/template.html +6 -6
- package/dist/Composition-PMWLJQPI.cjs +0 -16
- package/dist/Composition-ZCRJHBB5.js +0 -7
- package/dist/chunk-4PYVHLIK.js.map +0 -1
- package/dist/chunk-ECLBZV4N.cjs.map +0 -1
- package/dist/chunk-GX2WQV4A.js.map +0 -1
- package/dist/chunk-NGK4E536.cjs.map +0 -1
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { describeLayer, collectPropKeys } from './chunk-BFRWSV3R.js';
|
|
2
2
|
import { suggestName, warnUnknownOptions } from './chunk-WGRWFQOB.js';
|
|
3
|
-
import
|
|
4
|
-
import { Rectangle, Container, FillGradient, Text, Color, GraphicsPath, Sprite, Texture, Graphics, Assets, Filter, GlProgram, defaultFilterVert, GpuProgram, UniformGroup, TextStyle, CanvasTextMetrics } from 'pixi.js';
|
|
3
|
+
import { Rectangle, Container, FillGradient, Text, Color, GraphicsPath, Sprite, Texture, Graphics, Assets, Filter, GlProgram, defaultFilterVert, GpuProgram, UniformGroup, AlphaFilter, NoiseFilter, BlurFilter, TextStyle, CanvasTextMetrics, ColorMatrixFilter } from 'pixi.js';
|
|
5
4
|
|
|
6
5
|
// src/core/spring.ts
|
|
7
6
|
var SETTLE_TOL = 5e-3;
|
|
@@ -2185,7 +2184,7 @@ var WarpFilter = class extends Filter {
|
|
|
2185
2184
|
};
|
|
2186
2185
|
|
|
2187
2186
|
// src/filters/named.ts
|
|
2188
|
-
var CORE = { blur:
|
|
2187
|
+
var CORE = { blur: () => BlurFilter, noise: () => NoiseFilter, alpha: () => AlphaFilter };
|
|
2189
2188
|
var CORE_TYPES = ["blur", "noise", "alpha", "colorMatrix", "grain", "warp"];
|
|
2190
2189
|
var LIBRARY_TYPES = [
|
|
2191
2190
|
"adjustment",
|
|
@@ -2246,11 +2245,11 @@ function registerFilterLibrary(mod) {
|
|
|
2246
2245
|
if (key.endsWith("Filter") && typeof value === "function") library.set(lower(key.slice(0, -"Filter".length)), value);
|
|
2247
2246
|
}
|
|
2248
2247
|
}
|
|
2249
|
-
var MISSING = (
|
|
2250
|
-
`pixi-effects: the filter
|
|
2248
|
+
var MISSING = (what, why, many = false) => new Error(
|
|
2249
|
+
`pixi-effects: the ${many ? "filters" : "filter"} ${what} ${many ? "come" : "comes"} from the pixi-filters package${why ? ` (${why})` : ""}. Add it to your import map ("pixi-filters": "https://esm.sh/pixi-filters@6.1.5?external=pixi.js") or run \`npm i pixi-filters\`.`
|
|
2251
2250
|
);
|
|
2252
|
-
function
|
|
2253
|
-
|
|
2251
|
+
function libraryFilters(spec) {
|
|
2252
|
+
const found = /* @__PURE__ */ new Map();
|
|
2254
2253
|
const visit = (node) => {
|
|
2255
2254
|
if (!node || typeof node !== "object") return;
|
|
2256
2255
|
if (Array.isArray(node)) {
|
|
@@ -2261,27 +2260,30 @@ function needsFilterLibrary(spec) {
|
|
|
2261
2260
|
if (Array.isArray(o.filters)) {
|
|
2262
2261
|
for (const f of o.filters) {
|
|
2263
2262
|
if (typeof f?.type !== "string" || !isNamedFilterType(f.type)) continue;
|
|
2264
|
-
if (isLibraryType(f.type))
|
|
2265
|
-
|
|
2263
|
+
if (isLibraryType(f.type)) {
|
|
2264
|
+
if (!found.get(f.type)) found.set(f.type, typeof o.name === "string" && o.name ? o.name : void 0);
|
|
2265
|
+
} else if (!isCoreType(f.type)) throw unknownType(f.type);
|
|
2266
2266
|
}
|
|
2267
2267
|
}
|
|
2268
2268
|
for (const key of ["sequences", "mask", "layer"]) visit(o[key]);
|
|
2269
2269
|
};
|
|
2270
2270
|
visit(spec);
|
|
2271
|
-
return
|
|
2271
|
+
return found;
|
|
2272
2272
|
}
|
|
2273
2273
|
async function ensureFilterLibrary(spec, load = () => import('pixi-filters')) {
|
|
2274
|
-
|
|
2274
|
+
const used = libraryFilters(spec);
|
|
2275
|
+
if (!used.size || library) return;
|
|
2275
2276
|
try {
|
|
2276
2277
|
registerFilterLibrary(await load());
|
|
2277
2278
|
} catch (e) {
|
|
2278
|
-
|
|
2279
|
+
const what = [...used].map(([type, layer]) => `"${type}"${layer ? ` (layer "${layer}")` : ""}`).join(", ");
|
|
2280
|
+
throw MISSING(what, e.message, used.size > 1);
|
|
2279
2281
|
}
|
|
2280
2282
|
}
|
|
2281
2283
|
var SINGLE_VALUE = { pixelate: "size", emboss: "strength" };
|
|
2282
2284
|
var MATRIX_PRESETS = ["sepia", "grayscale", "negative", "polaroid", "technicolor", "vintage", "kodachrome", "browni"];
|
|
2283
2285
|
function colorMatrix(params) {
|
|
2284
|
-
const f = new
|
|
2286
|
+
const f = new ColorMatrixFilter();
|
|
2285
2287
|
const preset = params.preset;
|
|
2286
2288
|
if (preset !== void 0) {
|
|
2287
2289
|
if (!MATRIX_PRESETS.includes(preset)) {
|
|
@@ -2311,9 +2313,8 @@ function lintBulgeCenter(params) {
|
|
|
2311
2313
|
function fixRadialBlurGpu(f) {
|
|
2312
2314
|
const holder = f;
|
|
2313
2315
|
const gp = holder.gpuProgram;
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
holder.gpuProgram = GpuProgram5.from({ name: gp.name, vertex: gp.vertex, fragment: { ...gp.fragment, source: gp.fragment.source.replace(/uKernelSize(\s*):\s*f32/, "uKernelSize$1: i32") } });
|
|
2316
|
+
if (!gp || !/uKernelSize\s*:\s*f32/.test(gp.fragment.source)) return f;
|
|
2317
|
+
holder.gpuProgram = GpuProgram.from({ name: gp.name, vertex: gp.vertex, fragment: { ...gp.fragment, source: gp.fragment.source.replace(/uKernelSize(\s*):\s*f32/, "uKernelSize$1: i32") } });
|
|
2317
2318
|
return f;
|
|
2318
2319
|
}
|
|
2319
2320
|
function createNamedFilter(type, params) {
|
|
@@ -2322,10 +2323,10 @@ function createNamedFilter(type, params) {
|
|
|
2322
2323
|
if (lower(type) === "grain") return new GrainFilter(params);
|
|
2323
2324
|
if (lower(type) === "warp") return new WarpFilter(params);
|
|
2324
2325
|
const core = Object.entries(CORE).find(([k]) => lower(k) === lower(type));
|
|
2325
|
-
if (core) return new
|
|
2326
|
+
if (core) return new (core[1]())(params);
|
|
2326
2327
|
if (!isLibraryType(type)) throw unknownType(type);
|
|
2327
2328
|
const Ctor = library?.get(lower(type));
|
|
2328
|
-
if (!Ctor) throw MISSING(type
|
|
2329
|
+
if (!Ctor) throw MISSING(`"${type}"`, library ? "not found in the loaded package" : "not loaded yet");
|
|
2329
2330
|
const single = SINGLE_VALUE[Object.keys(SINGLE_VALUE).find((k) => lower(k) === lower(type)) ?? ""];
|
|
2330
2331
|
if (single) return new Ctor(params[single]);
|
|
2331
2332
|
const made = new Ctor(lower(type) === "colorgradient" ? colorGradientParams(params) : params);
|
|
@@ -6069,13 +6070,13 @@ var CanvasSequence = class extends Sequence {
|
|
|
6069
6070
|
var _CompositionSequence = null;
|
|
6070
6071
|
async function getCompositionSequence() {
|
|
6071
6072
|
if (!_CompositionSequence) {
|
|
6072
|
-
_CompositionSequence = (await import('./Composition-
|
|
6073
|
+
_CompositionSequence = (await import('./Composition-5FKV2IBP.js')).CompositionSequence;
|
|
6073
6074
|
}
|
|
6074
6075
|
return _CompositionSequence;
|
|
6075
6076
|
}
|
|
6076
6077
|
var _SpansSequence = null;
|
|
6077
6078
|
async function getSpansSequence() {
|
|
6078
|
-
if (!_SpansSequence) _SpansSequence = (await import('./Spans-
|
|
6079
|
+
if (!_SpansSequence) _SpansSequence = (await import('./Spans-6A3VLHRH.js')).SpansSequence;
|
|
6079
6080
|
return _SpansSequence;
|
|
6080
6081
|
}
|
|
6081
6082
|
var staticTypes = {
|
|
@@ -6121,5 +6122,5 @@ async function buildSequenceTree(specs, parent, root, out = []) {
|
|
|
6121
6122
|
}
|
|
6122
6123
|
|
|
6123
6124
|
export { CameraSequence, DEFAULT_FOV, DEG3 as DEG, EXPRESSION_NAMES, FALLOFFS, LIGHT_KINDS, LIGHT_PROPS, LightSequence, MANY_BLURRED, MAX_BLUR, MAX_CASTERS, MAX_LIGHTS, MIN_BLUR, NEAR, NullSequence, SHADOW_TAPS, Sequence, TextSequence, bindClock, bindCounterKeyframes, blurRadius, buildScope, buildSequenceTree, cameraBasis, checkEase, clockTable, contentLength, createTimeline, ensureFilterLibrary, evaluateExpr, flattenSvgPath, focusProblems, homeCamera, homeDistance, layerInitialZ, layerToWorld, lengthen, lightLevel, noise, noise2, packLights, parseEase, parseSpring, projectLayer, projectPoint, rand, random, registerSequenceType, remapOf, resolveAt, resolveNumber, spansMeta, springDuration, timeRemapOf, trimPolylines };
|
|
6124
|
-
//# sourceMappingURL=chunk-
|
|
6125
|
-
//# sourceMappingURL=chunk-
|
|
6125
|
+
//# sourceMappingURL=chunk-IVKI6CPH.js.map
|
|
6126
|
+
//# sourceMappingURL=chunk-IVKI6CPH.js.map
|