@framefields/node-blur 2.0.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/.turbo/turbo-build.log +19 -0
- package/CHANGELOG.md +23 -0
- package/LICENCE +202 -0
- package/dist/index.d.mts +75 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +3 -0
- package/dist/renderer.d.mts +7 -0
- package/dist/renderer.d.mts.map +1 -0
- package/dist/renderer.mjs +3 -0
- package/dist/renderers-DAmsgkhH.mjs +1156 -0
- package/dist/renderers-DAmsgkhH.mjs.map +1 -0
- package/package.json +48 -0
- package/src/index.ts +2 -0
- package/src/renderers/index.ts +6 -0
- package/src/renderers/webgpu-renderer.ts +1238 -0
- package/src/shared/config.ts +107 -0
- package/src/shared/index.ts +1 -0
- package/tsconfig.json +12 -0
- package/tsdown.config.ts +13 -0
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import {
|
|
2
|
+
configBuilder,
|
|
3
|
+
ImageResultSchema,
|
|
4
|
+
VideoResultSchema,
|
|
5
|
+
} from "@framefields/node-sdk";
|
|
6
|
+
import { z } from "zod";
|
|
7
|
+
|
|
8
|
+
export const MAX_BLUR = 100;
|
|
9
|
+
|
|
10
|
+
export const blurConfig = configBuilder()
|
|
11
|
+
.field(
|
|
12
|
+
"blurType",
|
|
13
|
+
z
|
|
14
|
+
.enum([
|
|
15
|
+
"Gaussian",
|
|
16
|
+
"Box",
|
|
17
|
+
"Median",
|
|
18
|
+
"Motion",
|
|
19
|
+
"Bilateral",
|
|
20
|
+
"Edge-preserving",
|
|
21
|
+
"Radial",
|
|
22
|
+
"Zoom",
|
|
23
|
+
])
|
|
24
|
+
.default("Gaussian"),
|
|
25
|
+
{
|
|
26
|
+
bindable: false,
|
|
27
|
+
label: "Blur Type",
|
|
28
|
+
},
|
|
29
|
+
)
|
|
30
|
+
.field("strength", z.number().min(0).max(MAX_BLUR).default(5), {
|
|
31
|
+
bindable: true,
|
|
32
|
+
dataTypes: ["Number", "Signal"],
|
|
33
|
+
label: "Strength Signal",
|
|
34
|
+
description:
|
|
35
|
+
"The intensity of the blur. 0 = no blur. Can be modulated by a static number or a dynamic signal.",
|
|
36
|
+
})
|
|
37
|
+
.field("angle", z.number().int().min(0).max(360).default(0), {
|
|
38
|
+
bindable: false,
|
|
39
|
+
// No editor handle, but effect signals are sampled per frame before the
|
|
40
|
+
// renderer runs, so authoring code may animate it.
|
|
41
|
+
signal: true,
|
|
42
|
+
label: "Angle",
|
|
43
|
+
description: "Direction of a Motion blur, in degrees.",
|
|
44
|
+
})
|
|
45
|
+
.field("sigmaColor", z.number().min(0.01).max(1.0).default(0.1), {
|
|
46
|
+
bindable: true,
|
|
47
|
+
dataTypes: ["Number", "Signal"],
|
|
48
|
+
label: "Color Sigma Signal",
|
|
49
|
+
description:
|
|
50
|
+
"Sigma value for color space in Bilateral / Edge-preserving blurs. Can be modulated by a static number or a dynamic signal.",
|
|
51
|
+
})
|
|
52
|
+
.field("centerX", z.number().min(0).max(1.0).default(0.5), {
|
|
53
|
+
bindable: true,
|
|
54
|
+
dataTypes: ["Number", "Signal"],
|
|
55
|
+
label: "Center X Signal",
|
|
56
|
+
description:
|
|
57
|
+
"The X coordinate of the blur center (0.0 to 1.0). Can be modulated by a static number or a dynamic signal.",
|
|
58
|
+
})
|
|
59
|
+
.field("centerY", z.number().min(0).max(1.0).default(0.5), {
|
|
60
|
+
bindable: true,
|
|
61
|
+
dataTypes: ["Number", "Signal"],
|
|
62
|
+
label: "Center Y Signal",
|
|
63
|
+
description:
|
|
64
|
+
"The Y coordinate of the blur center (0.0 to 1.0). Can be modulated by a static number or a dynamic signal.",
|
|
65
|
+
})
|
|
66
|
+
.field("partialBlur", z.boolean().default(false), {
|
|
67
|
+
bindable: false,
|
|
68
|
+
signal: true,
|
|
69
|
+
label: "Partial Blur",
|
|
70
|
+
description: "Blurs only a specific circular area around center point.",
|
|
71
|
+
})
|
|
72
|
+
.field("radius", z.number().min(0.01).max(1.0).default(0.3), {
|
|
73
|
+
bindable: true,
|
|
74
|
+
dataTypes: ["Number", "Signal"],
|
|
75
|
+
label: "Partial Radius Signal",
|
|
76
|
+
description:
|
|
77
|
+
"Radius of the partial blur region (0.01 to 1.0). Can be modulated by a static number or a dynamic signal.",
|
|
78
|
+
})
|
|
79
|
+
.field("radiusY", z.number().min(0).max(1.0).default(0), {
|
|
80
|
+
bindable: true,
|
|
81
|
+
dataTypes: ["Number", "Signal"],
|
|
82
|
+
label: "Partial Radius Y Signal",
|
|
83
|
+
description:
|
|
84
|
+
"Vertical radius of the partial blur region (0 to 1.0). 0 reuses the horizontal radius.",
|
|
85
|
+
})
|
|
86
|
+
.field("shape", z.enum(["ellipse", "circle", "rect"]).default("circle"), {
|
|
87
|
+
bindable: false,
|
|
88
|
+
label: "Partial Shape",
|
|
89
|
+
description: "Shape of the partial blur region.",
|
|
90
|
+
})
|
|
91
|
+
.build();
|
|
92
|
+
|
|
93
|
+
export const BlurNodeConfigSchema = blurConfig.schema;
|
|
94
|
+
|
|
95
|
+
export type BlurNodeConfig = z.infer<typeof BlurNodeConfigSchema>;
|
|
96
|
+
|
|
97
|
+
export const BlurResultSchema = z.union([ImageResultSchema, VideoResultSchema]);
|
|
98
|
+
|
|
99
|
+
export type BlurResult = z.infer<typeof BlurResultSchema>;
|
|
100
|
+
|
|
101
|
+
export const BLUR_OUTPUT_TYPE_MAP: Record<string, "Image" | "Video" | "GIF"> = {
|
|
102
|
+
Video: "Video",
|
|
103
|
+
Lottie: "Video",
|
|
104
|
+
GIF: "GIF",
|
|
105
|
+
Image: "Image",
|
|
106
|
+
SVG: "Image",
|
|
107
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./config.js";
|
package/tsconfig.json
ADDED
package/tsdown.config.ts
ADDED