Skip to content

Code-first video & image, rendered natively on WebGPU.

feat: stylize pack, Styles presets, stepped timing, shape morphing, Layer.vfx

okanasl668571916ed6
diff --git a/.changeset/stylize-pack.md b/.changeset/stylize-pack.md
new file mode 100644
index 00000000..4b7d93d3
--- /dev/null
+++ b/.changeset/stylize-pack.md
@@ -0,0 +1,11 @@
+---
+"framefields": minor
+---
+
+Add a stylize effect pack: `Pixelate` (square, circle/LED and diamond cells), `Posterize` (levels or retro palettes: GameBoy, teletext, CGA, PICO-8, C64, grayscale, sepia, custom; with Bayer dithering and big pixels), `Dither` (Bayer, noise and halftone; 1-bit duotone or per channel), `Ascii`, `Toon` (cel bands and ink outlines), `RGBSplit`, `CRT` (curvature, scanlines, aperture mask, plus VHS tracking and colour bleed), `Painterly` (Kuwahara oil and watercolour), `Contour` (topographic lines), `Kaleidoscope`, `OpArt`, `Iridescence` (holographic foil) and `Gooey` (metaballs).
+
+`Styles.*` presets return ready-made effect stacks for common looks (`pixelArt`, `gameBoy`, `teletext`, `ledWall`, `ascii`, `oneBit`, `risograph`, `comic`, `cartoon`, `thermal`, `vhs`, `crt`, `glitch`, `oilPainting`, `watercolor`, `topographic`, `kaleidoscope`, `opArt`, `holographic`, `noir`, `film`): `layer.withEffects(Styles.vhs())`.
+
+`LayerAnimation.stepped(n)` gives a layer stepped timing ("on twos"): every animated value is held for `n` frames, eases kept. A shape's `d` is now animatable: keyframed SVG paths morph into each other, resampled and aligned so paths with different point counts, curves and subpaths morph cleanly.
+
+`Layer.vfx()` draws `ProceduralVFX` looks as their own layer (the node was not registered before), and adds an `Aurora` effect type.
diff --git a/nodes/node-ascii/package.json b/nodes/node-ascii/package.json
new file mode 100644
index 00000000..5e22fffd
--- /dev/null
+++ b/nodes/node-ascii/package.json
@@ -0,0 +1,45 @@
+{
+ "name": "@framefields/node-ascii",
+ "version": "2.2.0",
+ "private": false,
+ "framefields": {
+ "type": "Ascii",
+ "kind": "effect",
+ "schema": "AsciiNodeConfigSchema"
+ },
+ "type": "module",
+ "license": "Apache-2.0",
+ "exports": {
+ ".": {
+ "types": "./dist/index.d.mts",
+ "development": "./src/index.ts",
+ "import": "./dist/index.mjs",
+ "default": "./dist/index.mjs"
+ },
+ "./renderer": {
+ "types": "./dist/renderer.d.mts",
+ "development": "./src/renderers/index.ts",
+ "import": "./dist/renderer.mjs",
+ "default": "./dist/renderer.mjs"
+ }
+ },
+ "scripts": {
+ "build": "tsdown",
+ "dev": "tsdown --watch",
+ "clean": "rm -rf dist .turbo"
+ },
+ "dependencies": {
+ "@framefields/node-sdk": "workspace:*",
+ "zod": "^4.3.6"
+ },
+ "devDependencies": {
+ "@framefields/tsconfig": "workspace:*",
+ "@types/node": "^24.1.0",
+ "tsdown": "^0.19.0",
+ "typescript": "^5.8.3",
+ "webgpu": "^0.4.0"
+ },
+ "publishConfig": {
+ "access": "public"
+ }
+}
diff --git a/nodes/node-ascii/src/index.ts b/nodes/node-ascii/src/index.ts
new file mode 100644
index 00000000..944d702e
--- /dev/null
+++ b/nodes/node-ascii/src/index.ts
@@ -0,0 +1,2 @@
+export * from "./renderers/index.js";
+export * from "./shared/index.js";
diff --git a/nodes/node-ascii/src/renderers/index.ts b/nodes/node-ascii/src/renderers/index.ts
new file mode 100644
index 00000000..c386140e
--- /dev/null
+++ b/nodes/node-ascii/src/renderers/index.ts
@@ -0,0 +1,7 @@
+import { defineRenderer } from "@framefields/node-sdk/renderer";
+import { AsciiWebGPURenderer } from "./webgpu-renderer.js";
+
+export default defineRenderer({
+ WebGPURenderer: AsciiWebGPURenderer,
+});
+export { AsciiWebGPURenderer };
diff --git a/nodes/node-ascii/src/renderers/webgpu-renderer.ts b/nodes/node-ascii/src/renderers/webgpu-renderer.ts
new file mode 100644
index 00000000..7e8992b1
--- /dev/null
+++ b/nodes/node-ascii/src/renderers/webgpu-renderer.ts
@@ -0,0 +1,236 @@
+/// <reference types="webgpu" />
+/**
+ * ASCII: The layer as text characters: each cell picks a glyph from ` .:-=+*#%@` by brightness. Monochrome terminal, source colors, or green phosphor.
+ */
+import type { WebGPUNodeRenderer } from "@framefields/node-sdk";
+import {
+ drawChildToTexture,
+ drawFullscreenPass,
+ drawTextureToTarget,
+ FULLSCREEN_QUAD_WGSL,
+ fragmentBindGroupLayout,
+ perDevice,
+} from "@framefields/node-sdk/gpu";
+
+const OP = "Ascii";
+const UNIFORM_FLOATS = 16;
+
+/** One fragment shader per pass; pass 0 reads the layer, later passes read the previous pass. */
+const PASSES = [
+ `struct U { v : array<vec4<f32>, 4> };
+@group(0) @binding(0) var<uniform> u : U;
+@group(0) @binding(1) var src : texture_2d<f32>;
+@group(0) @binding(2) var prev : texture_2d<f32>;
+@group(0) @binding(3) var samp : sampler;
+${FULLSCREEN_QUAD_WGSL}
+
+fn straight(c : vec4<f32>) -> vec4<f32> {
+ if (c.a <= 0.0001) { return vec4<f32>(0.0); }
+ return vec4<f32>(c.rgb / c.a, c.a);
+}
+fn premul(c : vec4<f32>) -> vec4<f32> { return vec4<f32>(c.rgb * c.a, c.a); }
+fn res() -> vec2<f32> { return vec2<f32>(textureDimensions(src)); }
+/** Straight-alpha color of the layer at a uv (filtered). */
+fn sampleS(uv : vec2<f32>) -> vec4<f32> { return straight(textureSampleLevel(src, samp, uv, 0.0)); }
+/** Premultiplied color of the layer at a uv (filtered). */
+fn sampleP(uv : vec2<f32>) -> vec4<f32> { return textureSampleLevel(src, samp, uv, 0.0); }
+/** Straight-alpha color of the layer's texel at a pixel position (nearest). */
+fn texelS(p : vec2<f32>) -> vec4<f32> {
+ let d = vec2<i32>(textureDimensions(src));
+ let q = clamp(vec2<i32>(floor(p)), vec2<i32>(0), d - vec2<i32>(1));
+ return straight(textureLoad(src, q, 0));
+}
+fn luma(c : vec3<f32>) -> f32 { return dot(c, vec3<f32>(0.2126, 0.7152, 0.0722)); }
+fn hash12(p : vec2<f32>) -> f32 {
+ var p3 = fract(vec3<f32>(p.xyx) * 0.1031);
+ p3 += dot(p3, p3.yzx + 33.33);
+ return fract((p3.x + p3.y) * p3.z);
+}
+fn vnoise(p : vec2<f32>) -> f32 {
+ let i = floor(p);
+ let f = fract(p);
+ let u = f * f * (3.0 - 2.0 * f);
+ return mix(mix(hash12(i), hash12(i + vec2<f32>(1.0, 0.0)), u.x),
+ mix(hash12(i + vec2<f32>(0.0, 1.0)), hash12(i + vec2<f32>(1.0, 1.0)), u.x), u.y);
+}
+/** 8x8 ordered-dither threshold, 0..1. */
+fn bayer8(p : vec2<f32>) -> f32 {
+ let x = u32(p.x) & 7u;
+ let y = u32(p.y) & 7u;
+ var v = 0u;
+ for (var k = 0u; k < 3u; k++) {
+ let bx = (x >> k) & 1u;
+ let by = (y >> k) & 1u;
+ let m = ((bx ^ by) << 1u) | by;
+ v += m * (1u << (2u * (2u - k)));
+ }
+ return (f32(v) + 0.5) / 64.0;
+}
+fn rot2(a : f32) -> mat2x2<f32> { let c = cos(a); let s = sin(a); return mat2x2<f32>(c, s, -s, c); }
+const GLYPH_BITS = array<u32, 10>(0u, 4194304u, 131200u, 14336u, 459200u, 145536u, 332096u, 11512810u, 27070835u, 15652782u);
+@fragment fn fs(in : VSOut) -> @location(0) vec4<f32> {
+ let time = u.v[0].x;
+ let frame = u.v[0].y;
+ let cellSize = u.v[1].x;
+ let colorMode = u32(u.v[1].y + 0.5);
+ let fg = u.v[2];
+ let bg = u.v[3];
+ let contrast = u.v[1].z;
+ let invert = u.v[1].w;
+
+ let R = res();
+ let cs = max(cellSize, 2.0);
+ let cp = floor(in.uv * R / cs);
+ let col = sampleS((cp + 0.5) * cs / R);
+ var l = clamp((luma(col.rgb) - 0.5) * contrast + 0.5, 0.0, 1.0) * col.a;
+ if (invert > 0.5) { l = 1.0 - l; }
+ let idx = min(u32(l * 9.999), 9u);
+ let f = in.uv * R / cs - cp;
+ let gx = i32(floor(f.x * 6.0));
+ let gy = i32(floor(f.y * 6.0));
+ var on = 0.0;
+ if (gx < 5 && gy < 5) {
+ on = f32((GLYPH_BITS[idx] >> u32(gy * 5 + gx)) & 1u);
+ }
+ var fgc = fg.rgb;
+ if (colorMode == 1u) { fgc = col.rgb * 1.25; }
+ if (colorMode == 2u) { fgc = vec3<f32>(0.25, 1.0, 0.45) * (0.4 + 0.6 * l); }
+ return vec4<f32>(mix(bg.rgb, fgc, on), 1.0);
+}
+`,
+];
+
+const resources = perDevice((device: GPUDevice) => ({
+ layout: fragmentBindGroupLayout(
+ device,
+ ["uniform", "texture", "texture", "sampler"],
+ `${OP}_layout`,
+ ),
+ pipelines: new Map<GPUTextureFormat, GPURenderPipeline[]>(),
+ sampler: device.createSampler({
+ magFilter: "linear",
+ minFilter: "linear",
+ addressModeU: "clamp-to-edge",
+ addressModeV: "clamp-to-edge",
+ }),
+}));
+
+function pipelinesFor(
+ device: GPUDevice,
+ format: GPUTextureFormat,
+): GPURenderPipeline[] {
+ const r = resources(device);
+ let list = r.pipelines.get(format);
+ if (!list) {
+ list = PASSES.map((code, i) => {
+ const module = device.createShaderModule({
+ code,
+ label: `${OP}_${i}.wgsl`,
+ });
+ return device.createRenderPipeline({
+ label: `${OP}_${i}`,
+ layout: device.createPipelineLayout({ bindGroupLayouts: [r.layout] }),
+ vertex: { module, entryPoint: "vs" },
+ fragment: { module, entryPoint: "fs", targets: [{ format }] },
+ primitive: { topology: "triangle-strip" },
+ });
+ });
+ r.pipelines.set(format, list);
+ }
+ return list;
+}
+
+function num(v: unknown, fallback: number): number {
+ const n = typeof v === "number" ? v : Number(v);
+ return Number.isFinite(n) ? n : fallback;
+}
+
+function hexToRgba(hex: string): [number, number, number, number] {
+ let h = hex.trim().replace("#", "");
+ if (h.length === 3 || h.length === 4) {
+ h = [...h].map((c) => c + c).join("");
+ }
+ const n = (i: number) => Number.parseInt(h.slice(i, i + 2), 16) / 255;
+ return [n(0), n(2), n(4), h.length >= 8 ? n(6) : 1];
+}
+
+/** Packs the effect's resolved props into the uniform block the shaders read. */
+function pack(
+ raw: Record<string, unknown>,
+ data: Float32Array,
+ time: number,
+ frame: number,
+): void {
+ data.fill(0);
+ data[0] = time;
+ data[1] = frame;
+ data[4] = num(raw.cellSize, 10);
+ data[5] = Math.max(
+ 0,
+ ["mono", "source", "green"].indexOf(String(raw.colorMode ?? "mono")),
+ );
+ data.set(hexToRgba(String(raw.fg ?? "#e8e8e8")), 8);
+ data.set(hexToRgba(String(raw.bg ?? "#0b0b0b")), 12);
+ data[6] = num(raw.contrast, 1.2);
+ data[7] = raw.invert === undefined ? 0 : raw.invert ? 1 : 0;
+}
+
+export const AsciiWebGPURenderer: WebGPUNodeRenderer = async (args) => {
+ const {
+ ctx,
+ encoder,
+ pass,
+ targetTexture,
+ targetWidth,
+ targetHeight,
+ props,
+ } = args;
+ const op = props.virtualMedia?.operation as
+ | ({
+ op?: string;
+ effect?: {
+ resolveUniforms?: (ctx: unknown) => Record<string, unknown>;
+ };
+ } & Record<string, unknown>)
+ | undefined;
+ if (op?.op !== OP) return;
+ const child = props.virtualMedia?.children?.[0];
+ if (!child) return;
+ pass.end();
+
+ const fps = props.fps || 30;
+ const frame = Math.round(props.compositionFrame ?? props.frame ?? 0);
+ const raw = op.effect?.resolveUniforms
+ ? op.effect.resolveUniforms({ frame, fps, time: frame / fps })
+ : op;
+ const data = new Float32Array(UNIFORM_FLOATS);
+ pack(raw, data, frame / fps, frame);
+
+ const { texture: childTex } = await drawChildToTexture(args, child);
+ const device = ctx.device;
+ const r = resources(device);
+ const pipelines = pipelinesFor(device, ctx.renderer.format);
+ const ubo = ctx.renderer.getTemporaryBuffer(data);
+ let prev = childTex;
+ for (const pipeline of pipelines) {
+ const out = ctx.renderer.getTemporaryTexture(targetWidth, targetHeight, [
+ childTex,
+ prev,
+ targetTexture,
+ ...(props.excludeTextures || []),
+ ]);
+ drawFullscreenPass(encoder, out.createView(), pipeline, [
+ device.createBindGroup({
+ layout: r.layout,
+ entries: [
+ { binding: 0, resource: { buffer: ubo } },
+ { binding: 1, resource: childTex.createView() },
+ { binding: 2, resource: prev.createView() },
+ { binding: 3, resource: r.sampler },
+ ],
+ }),
+ ]);
+ prev = out;
+ }
+ drawTextureToTarget(args, prev);
+};
diff --git a/nodes/node-ascii/src/shared/config.ts b/nodes/node-ascii/src/shared/config.ts
new file mode 100644
index 00000000..b3d582cd
--- /dev/null
+++ b/nodes/node-ascii/src/shared/config.ts
@@ -0,0 +1,41 @@
+import { configBuilder } from "@framefields/node-sdk";
+import { z } from "zod";
+
+export const asciiConfig = configBuilder()
+ .field("cellSize", z.number().min(4).max(64).default(10), {
+ bindable: true,
+ dataTypes: ["Number", "Signal"],
+ label: "cellSize",
+ description: "Character cell size, px.",
+ })
+ .field("colorMode", z.enum(["mono", "source", "green"]).default("mono"), {
+ bindable: false,
+ label: "colorMode",
+ description:
+ "Glyph color: `fg`, the layer's own colors, or green phosphor.",
+ })
+ .field("fg", z.string().default("#e8e8e8"), {
+ bindable: false,
+ label: "fg",
+ description: "Glyph color (mono).",
+ })
+ .field("bg", z.string().default("#0b0b0b"), {
+ bindable: false,
+ label: "bg",
+ description: "Background color.",
+ })
+ .field("contrast", z.number().min(0.5).max(3).default(1.2), {
+ bindable: true,
+ dataTypes: ["Number", "Signal"],
+ label: "contrast",
+ description: "Brightness contrast before picking glyphs.",
+ })
+ .field("invert", z.boolean().default(false), {
+ bindable: false,
+ label: "invert",
+ description: "Dark areas get dense glyphs.",
+ })
+ .build();
+
+export const AsciiNodeConfigSchema = asciiConfig.schema;
+export type AsciiNodeConfig = z.infer<typeof AsciiNodeConfigSchema>;
diff --git a/nodes/node-ascii/src/shared/index.ts b/nodes/node-ascii/src/shared/index.ts
new file mode 100644
index 00000000..d1bc97e8
--- /dev/null
+++ b/nodes/node-ascii/src/shared/index.ts
@@ -0,0 +1 @@
+export * from "./config.js";
diff --git a/nodes/node-ascii/tsconfig.json b/nodes/node-ascii/tsconfig.json
new file mode 100644
index 00000000..5a0b963f
--- /dev/null
+++ b/nodes/node-ascii/tsconfig.json
@@ -0,0 +1,12 @@
+{
+ "extends": "@framefields/tsconfig/node-library.json",
+ "compilerOptions": {
+ "baseUrl": ".",
+ "paths": {
+ "@/*": ["./src/*"]
+ },
+ "experimentalDecorators": true,
+ "emitDecoratorMetadata": true
+ },
+ "include": ["src"]
+}
diff --git a/nodes/node-ascii/tsdown.config.ts b/nodes/node-ascii/tsdown.config.ts
new file mode 100644
index 00000000..73f5c2fc
--- /dev/null
+++ b/nodes/node-ascii/tsdown.config.ts
@@ -0,0 +1,13 @@
+import { defineConfig } from "tsdown";
+
+export default defineConfig({
+ entry: {
+ index: "src/index.ts",
+ renderer: "src/renderers/index.ts",
+ },
+ format: ["esm"],
+ dts: true,
+ clean: true,
+ sourcemap: true,
+ treeshake: true,
+});
diff --git a/nodes/node-compositor/src/renderers/webgpu-renderer.ts b/nodes/node-compositor/src/renderers/webgpu-renderer.ts
index 29f31cf4..e74b26a4 100644
--- a/nodes/node-compositor/src/renderers/webgpu-renderer.ts
+++ b/nodes/node-compositor/src/renderers/webgpu-renderer.ts
@@ -3387,7 +3387,7 @@ export const CompositorWebGPURenderer: WebGPUNodeRenderer = async (args) => {
shapeType,
width: layerW,
height: layerH,
- path: lop.d ?? lop.path,
+ path: target?.d ?? lop.d ?? lop.path,
cornerRadius:
target?.cornerRadius ??
lop.cornerRadius ??
diff --git a/nodes/node-compositor/src/shared/compiler.test.ts b/nodes/node-compositor/src/shared/compiler.test.ts
index 37f51408..5529cddf 100644
--- a/nodes/node-compositor/src/shared/compiler.test.ts
+++ b/nodes/node-compositor/src/shared/compiler.test.ts
@@ -1158,6 +1158,52 @@ describe("keyframe tail truncation (review M8)", () => {
expect(stub.x).toBe(160);
});
+ it("holds values for frameStep frames (stepped timing)", () => {
+ const virtualMedia: any = {
+ metadata: { width: 1920, height: 1080, durationMs: 2000 },
+ operation: { op: "Compositor" },
+ children: [
+ {
+ operation: {
+ op: "CompositorLayer",
+ id: "stepped-node",
+ x: 0,
+ startFrame: 1,
+ durationFrames: 48,
+ animation: {
+ frameStep: 3,
+ tracks: [
+ {
+ id: "t_x",
+ prop: "x" as const,
+ keyframes: [
+ { frame: 0, value: 0 },
+ { frame: 30, value: 300 },
+ ],
+ },
+ ],
+ },
+ },
+ },
+ ],
+ };
+ const compiled = compileTimeline("render-stepped-test", virtualMedia, {
+ fps: 24,
+ durationSec: 2,
+ });
+ const stub = compiled.targetsById["stepped-node"];
+ const at = (f: number) => {
+ seekTimeline(compiled, f, 24);
+ return stub.x;
+ };
+ // Layer frames 0–2 hold frame 0, 3–5 hold frame 3, …
+ expect(at(1)).toBeCloseTo(0);
+ expect(at(3)).toBeCloseTo(0);
+ expect(at(4)).toBeCloseTo(30);
+ expect(at(6)).toBeCloseTo(30);
+ expect(at(7)).toBeCloseTo(60);
+ });
+
it("compiles and evaluates procedural wiggle and signal tracks", () => {
const virtualMedia: any = {
metadata: { width: 1920, height: 1080, durationMs: 2000 },
diff --git a/nodes/node-compositor/src/shared/compiler.ts b/nodes/node-compositor/src/shared/compiler.ts
index 9e8d0d50..c3603e66 100644
--- a/nodes/node-compositor/src/shared/compiler.ts
+++ b/nodes/node-compositor/src/shared/compiler.ts
@@ -3,6 +3,7 @@ import {
type AnimationTrack,
collectNodeOps,
type EaseRef,
+ evaluateKeyframes,
evaluateTrackAtFrame,
type LayerAnimationSpec,
} from "@framefields/compositions/program";
@@ -125,6 +126,40 @@ interface LiveTrack {
track: AnimationTrack;
startFrame: number;
endFrame: number;
+ /** Stepped timing: the track is read only every `step` frames. */
+ step?: number;
+}
+
+/** GSAP's shaping for a keyframe segment, so draw-time tracks ease like baked ones. */
+function gsapEase(
+ fps: number,
+): (ease: EaseRef | undefined, deltaFrames: number, t: number) => number {
+ return (ease, deltaFrames, t) => {
+ const e = mappedEase(ease, deltaFrames, fps);
+ const fn = typeof e === "function" ? e : gsap.parseEase(e);
+ return fn ? fn(t) : t;
+ };
+}
+
+function evaluateLive(
+ live: LiveTrack,
+ frame: number,
+ fps: number,
+ signals: Record<string, any> | undefined,
+) {
+ const source = live.track.source ?? { type: "keyframe" };
+ if (source.type === "keyframe") {
+ return evaluateKeyframes(
+ live.track,
+ frame - live.startFrame,
+ gsapEase(fps),
+ );
+ }
+ return evaluateTrackAtFrame(live.track, frame, fps, {
+ startFrame: live.startFrame,
+ baseValues: live.stub,
+ signals,
+ });
}
/** Seeks the compiled timeline to a frame and applies its live signal tracks. */
@@ -135,12 +170,13 @@ export function seekTimeline(
): void {
result.tl.seek(frame / fps);
for (const live of result.live) {
- const f = Math.max(live.startFrame, Math.min(live.endFrame, frame));
- live.stub[live.track.prop] = evaluateTrackAtFrame(live.track, f, fps, {
- startFrame: live.startFrame,
- baseValues: live.stub,
- signals: result.signals,
- });
+ let f = Math.max(live.startFrame, Math.min(live.endFrame, frame));
+ if (live.step && live.step > 1) {
+ f =
+ live.startFrame +
+ Math.floor((f - live.startFrame) / live.step) * live.step;
+ }
+ live.stub[live.track.prop] = evaluateLive(live, f, fps, result.signals);
}
}
@@ -373,20 +409,32 @@ function compileTrackToTimeline(
durationFrames: number,
signals?: Record<string, any>,
live?: LiveTrack[],
+ step?: number,
): { dropped: number; maxAuthoredFrame: number } {
const prop = track.prop;
const source = track.source ?? { type: "keyframe" };
+ const stepped = step !== undefined && step > 1;
- if (source.type === "signal" && live && !track.repeat) {
+ // Signal tracks, path morphs (GSAP cannot tween an SVG path) and every
+ // track of a stepped layer are evaluated at draw time rather than baked
+ // into the GSAP timeline.
+ if (
+ (source.type === "signal" || stepped || prop === "d") &&
+ live &&
+ !track.repeat
+ ) {
const endF = Number.isFinite(durationFrames)
? durationFrames
: Math.round(fps * 5);
- stub[prop] = evaluateTrackAtFrame(track, startFrame, fps, {
+ const entry: LiveTrack = {
+ stub,
+ track,
startFrame,
- baseValues: stub,
- signals,
- });
- live.push({ stub, track, startFrame, endFrame: startFrame + endF });
+ endFrame: startFrame + endF,
+ ...(stepped && { step }),
+ };
+ stub[prop] = evaluateLive(entry, startFrame, fps, signals);
+ live.push(entry);
return { dropped: 0, maxAuthoredFrame: 0 };
}
@@ -941,6 +989,7 @@ export function compileTimeline(
durationFrames,
signals,
live,
+ lop.animation?.frameStep,
);
if (dropped > 0) {
truncations.push({
diff --git a/nodes/node-contour/package.json b/nodes/node-contour/package.json
new file mode 100644
index 00000000..403a34d2
--- /dev/null
+++ b/nodes/node-contour/package.json
@@ -0,0 +1,45 @@
+{
+ "name": "@framefields/node-contour",
+ "version": "2.2.0",
+ "private": false,
+ "framefields": {
+ "type": "Contour",
+ "kind": "effect",
+ "schema": "ContourNodeConfigSchema"
+ },
+ "type": "module",
+ "license": "Apache-2.0",
+ "exports": {
+ ".": {
+ "types": "./dist/index.d.mts",
+ "development": "./src/index.ts",
+ "import": "./dist/index.mjs",
+ "default": "./dist/index.mjs"
+ },
+ "./renderer": {
+ "types": "./dist/renderer.d.mts",
+ "development": "./src/renderers/index.ts",
+ "import": "./dist/renderer.mjs",
+ "default": "./dist/renderer.mjs"
+ }
+ },
+ "scripts": {
+ "build": "tsdown",
+ "dev": "tsdown --watch",
+ "clean": "rm -rf dist .turbo"
+ },
+ "dependencies": {
+ "@framefields/node-sdk": "workspace:*",
+ "zod": "^4.3.6"
+ },
+ "devDependencies": {
+ "@framefields/tsconfig": "workspace:*",
+ "@types/node": "^24.1.0",
+ "tsdown": "^0.19.0",
+ "typescript": "^5.8.3",
+ "webgpu": "^0.4.0"
+ },
+ "publishConfig": {
+ "access": "public"
+ }
+}
diff --git a/nodes/node-contour/src/index.ts b/nodes/node-contour/src/index.ts
new file mode 100644
index 00000000..944d702e
--- /dev/null
+++ b/nodes/node-contour/src/index.ts
@@ -0,0 +1,2 @@
+export * from "./renderers/index.js";
+export * from "./shared/index.js";
diff --git a/nodes/node-contour/src/renderers/index.ts b/nodes/node-contour/src/renderers/index.ts
new file mode 100644
index 00000000..ac7945cd
--- /dev/null
+++ b/nodes/node-contour/src/renderers/index.ts
@@ -0,0 +1,7 @@
+import { defineRenderer } from "@framefields/node-sdk/renderer";
+import { ContourWebGPURenderer } from "./webgpu-renderer.js";
+
+export default defineRenderer({
+ WebGPURenderer: ContourWebGPURenderer,
+});
+export { ContourWebGPURenderer };
diff --git a/nodes/node-contour/src/renderers/webgpu-renderer.ts b/nodes/node-contour/src/renderers/webgpu-renderer.ts
new file mode 100644
index 00000000..813e7996
--- /dev/null
+++ b/nodes/node-contour/src/renderers/webgpu-renderer.ts
@@ -0,0 +1,235 @@
+/// <reference types="webgpu" />
+/**
+ * Contour: Topographic lines: brightness read as height and drawn as evenly spaced contour lines over the source, a flat paper color, or nothing.
+ */
+import type { WebGPUNodeRenderer } from "@framefields/node-sdk";
+import {
+ drawChildToTexture,
+ drawFullscreenPass,
+ drawTextureToTarget,
+ FULLSCREEN_QUAD_WGSL,
+ fragmentBindGroupLayout,
+ perDevice,
+} from "@framefields/node-sdk/gpu";
+
+const OP = "Contour";
+const UNIFORM_FLOATS = 16;
+
+/** One fragment shader per pass; pass 0 reads the layer, later passes read the previous pass. */
+const PASSES = [
+ `struct U { v : array<vec4<f32>, 4> };
+@group(0) @binding(0) var<uniform> u : U;
+@group(0) @binding(1) var src : texture_2d<f32>;
+@group(0) @binding(2) var prev : texture_2d<f32>;
+@group(0) @binding(3) var samp : sampler;
+${FULLSCREEN_QUAD_WGSL}
+
+fn straight(c : vec4<f32>) -> vec4<f32> {
+ if (c.a <= 0.0001) { return vec4<f32>(0.0); }
+ return vec4<f32>(c.rgb / c.a, c.a);
+}
+fn premul(c : vec4<f32>) -> vec4<f32> { return vec4<f32>(c.rgb * c.a, c.a); }
+fn res() -> vec2<f32> { return vec2<f32>(textureDimensions(src)); }
+/** Straight-alpha color of the layer at a uv (filtered). */
+fn sampleS(uv : vec2<f32>) -> vec4<f32> { return straight(textureSampleLevel(src, samp, uv, 0.0)); }
+/** Premultiplied color of the layer at a uv (filtered). */
+fn sampleP(uv : vec2<f32>) -> vec4<f32> { return textureSampleLevel(src, samp, uv, 0.0); }
+/** Straight-alpha color of the layer's texel at a pixel position (nearest). */
+fn texelS(p : vec2<f32>) -> vec4<f32> {
+ let d = vec2<i32>(textureDimensions(src));
+ let q = clamp(vec2<i32>(floor(p)), vec2<i32>(0), d - vec2<i32>(1));
+ return straight(textureLoad(src, q, 0));
+}
+fn luma(c : vec3<f32>) -> f32 { return dot(c, vec3<f32>(0.2126, 0.7152, 0.0722)); }
+fn hash12(p : vec2<f32>) -> f32 {
+ var p3 = fract(vec3<f32>(p.xyx) * 0.1031);
+ p3 += dot(p3, p3.yzx + 33.33);
+ return fract((p3.x + p3.y) * p3.z);
+}
+fn vnoise(p : vec2<f32>) -> f32 {
+ let i = floor(p);
+ let f = fract(p);
+ let u = f * f * (3.0 - 2.0 * f);
+ return mix(mix(hash12(i), hash12(i + vec2<f32>(1.0, 0.0)), u.x),
+ mix(hash12(i + vec2<f32>(0.0, 1.0)), hash12(i + vec2<f32>(1.0, 1.0)), u.x), u.y);
+}
+/** 8x8 ordered-dither threshold, 0..1. */
+fn bayer8(p : vec2<f32>) -> f32 {
+ let x = u32(p.x) & 7u;
+ let y = u32(p.y) & 7u;
+ var v = 0u;
+ for (var k = 0u; k < 3u; k++) {
+ let bx = (x >> k) & 1u;
+ let by = (y >> k) & 1u;
+ let m = ((bx ^ by) << 1u) | by;
+ v += m * (1u << (2u * (2u - k)));
+ }
+ return (f32(v) + 0.5) / 64.0;
+}
+fn rot2(a : f32) -> mat2x2<f32> { let c = cos(a); let s = sin(a); return mat2x2<f32>(c, s, -s, c); }
+@fragment fn fs(in : VSOut) -> @location(0) vec4<f32> {
+ let time = u.v[0].x;
+ let frame = u.v[0].y;
+ let levels = u.v[1].x;
+ let lineWidth = u.v[1].y;
+ let lineColor = u.v[2];
+ let fill = u32(u.v[1].z + 0.5);
+ let fillColor = u.v[3];
+ let smoothing = u.v[1].w;
+
+ let R = res();
+ let s = smoothing / R;
+ var lsum = 0.0;
+ for (var j = -1; j <= 1; j++) {
+ for (var i = -1; i <= 1; i++) {
+ lsum += luma(sampleS(in.uv + vec2<f32>(f32(i), f32(j)) * s).rgb);
+ }
+ }
+ let h = lsum / 9.0 * levels;
+ let w = max(fwidth(h), 1e-4);
+ let d = abs(fract(h - 0.5) - 0.5) / w;
+ let line = 1.0 - smoothstep(lineWidth * 0.5, lineWidth * 0.5 + 1.0, d);
+ let c = sampleS(in.uv);
+ var base = vec4<f32>(c.rgb, c.a);
+ if (fill == 1u) { base = vec4<f32>(fillColor.rgb, 1.0); }
+ if (fill == 2u) { base = vec4<f32>(lineColor.rgb, 0.0); }
+ let rgb = mix(base.rgb, lineColor.rgb, line);
+ return premul(vec4<f32>(rgb, max(base.a, line * select(1.0, c.a, fill == 0u))));
+}
+`,
+];
+
+const resources = perDevice((device: GPUDevice) => ({
+ layout: fragmentBindGroupLayout(
+ device,
+ ["uniform", "texture", "texture", "sampler"],
+ `${OP}_layout`,
+ ),
+ pipelines: new Map<GPUTextureFormat, GPURenderPipeline[]>(),
+ sampler: device.createSampler({
+ magFilter: "linear",
+ minFilter: "linear",
+ addressModeU: "clamp-to-edge",
+ addressModeV: "clamp-to-edge",
+ }),
+}));
+
+function pipelinesFor(
+ device: GPUDevice,
+ format: GPUTextureFormat,
+): GPURenderPipeline[] {
+ const r = resources(device);
+ let list = r.pipelines.get(format);
+ if (!list) {
+ list = PASSES.map((code, i) => {
+ const module = device.createShaderModule({
+ code,
+ label: `${OP}_${i}.wgsl`,
+ });
+ return device.createRenderPipeline({
+ label: `${OP}_${i}`,
+ layout: device.createPipelineLayout({ bindGroupLayouts: [r.layout] }),
+ vertex: { module, entryPoint: "vs" },
+ fragment: { module, entryPoint: "fs", targets: [{ format }] },
+ primitive: { topology: "triangle-strip" },
+ });
+ });
+ r.pipelines.set(format, list);
+ }
+ return list;
+}
+
+function num(v: unknown, fallback: number): number {
+ const n = typeof v === "number" ? v : Number(v);
+ return Number.isFinite(n) ? n : fallback;
+}
+
+function hexToRgba(hex: string): [number, number, number, number] {
+ let h = hex.trim().replace("#", "");
+ if (h.length === 3 || h.length === 4) {
+ h = [...h].map((c) => c + c).join("");
+ }
+ const n = (i: number) => Number.parseInt(h.slice(i, i + 2), 16) / 255;
+ return [n(0), n(2), n(4), h.length >= 8 ? n(6) : 1];
+}
+
+/** Packs the effect's resolved props into the uniform block the shaders read. */
+function pack(
+ raw: Record<string, unknown>,
+ data: Float32Array,
+ time: number,
+ frame: number,
+): void {
+ data.fill(0);
+ data[0] = time;
+ data[1] = frame;
+ data[4] = num(raw.levels, 14);
+ data[5] = num(raw.lineWidth, 1.2);
+ data.set(hexToRgba(String(raw.lineColor ?? "#2b1d0e")), 8);
+ data[6] = Math.max(
+ 0,
+ ["source", "flat", "none"].indexOf(String(raw.fill ?? "source")),
+ );
+ data.set(hexToRgba(String(raw.fillColor ?? "#f3ead8")), 12);
+ data[7] = num(raw.smoothing, 2);
+}
+
+export const ContourWebGPURenderer: WebGPUNodeRenderer = async (args) => {
+ const {
+ ctx,
+ encoder,
+ pass,
+ targetTexture,
+ targetWidth,
+ targetHeight,
+ props,
+ } = args;
+ const op = props.virtualMedia?.operation as
+ | ({
+ op?: string;
+ effect?: {
+ resolveUniforms?: (ctx: unknown) => Record<string, unknown>;
+ };
+ } & Record<string, unknown>)
+ | undefined;
+ if (op?.op !== OP) return;
+ const child = props.virtualMedia?.children?.[0];
+ if (!child) return;
+ pass.end();
+
+ const fps = props.fps || 30;
+ const frame = Math.round(props.compositionFrame ?? props.frame ?? 0);
+ const raw = op.effect?.resolveUniforms
+ ? op.effect.resolveUniforms({ frame, fps, time: frame / fps })
+ : op;
+ const data = new Float32Array(UNIFORM_FLOATS);
+ pack(raw, data, frame / fps, frame);
+
+ const { texture: childTex } = await drawChildToTexture(args, child);
+ const device = ctx.device;
+ const r = resources(device);
+ const pipelines = pipelinesFor(device, ctx.renderer.format);
+ const ubo = ctx.renderer.getTemporaryBuffer(data);
+ let prev = childTex;
+ for (const pipeline of pipelines) {
+ const out = ctx.renderer.getTemporaryTexture(targetWidth, targetHeight, [
+ childTex,
+ prev,
+ targetTexture,
+ ...(props.excludeTextures || []),
+ ]);
+ drawFullscreenPass(encoder, out.createView(), pipeline, [
+ device.createBindGroup({
+ layout: r.layout,
+ entries: [
+ { binding: 0, resource: { buffer: ubo } },
+ { binding: 1, resource: childTex.createView() },
+ { binding: 2, resource: prev.createView() },
+ { binding: 3, resource: r.sampler },
+ ],
+ }),
+ ]);
+ prev = out;
+ }
+ drawTextureToTarget(args, prev);
+};
diff --git a/nodes/node-contour/src/shared/config.ts b/nodes/node-contour/src/shared/config.ts
new file mode 100644
index 00000000..7d344aae
--- /dev/null
+++ b/nodes/node-contour/src/shared/config.ts
@@ -0,0 +1,41 @@
+import { configBuilder } from "@framefields/node-sdk";
+import { z } from "zod";
+
+export const contourConfig = configBuilder()
+ .field("levels", z.number().int().min(2).max(64).default(14), {
+ bindable: true,
+ dataTypes: ["Number", "Signal"],
+ label: "levels",
+ description: "Contour lines from dark to light.",
+ })
+ .field("lineWidth", z.number().min(0.5).max(8).default(1.2), {
+ bindable: true,
+ dataTypes: ["Number", "Signal"],
+ label: "lineWidth",
+ description: "Line width, px.",
+ })
+ .field("lineColor", z.string().default("#2b1d0e"), {
+ bindable: false,
+ label: "lineColor",
+ description: "Line color.",
+ })
+ .field("fill", z.enum(["source", "flat", "none"]).default("source"), {
+ bindable: false,
+ label: "fill",
+ description: "Under the lines: the layer, `fillColor`, or transparent.",
+ })
+ .field("fillColor", z.string().default("#f3ead8"), {
+ bindable: false,
+ label: "fillColor",
+ description: "Paper color (flat fill).",
+ })
+ .field("smoothing", z.number().min(0).max(8).default(2), {
+ bindable: true,
+ dataTypes: ["Number", "Signal"],
+ label: "smoothing",
+ description: "Blur before tracing, px (smoother lines).",
+ })
+ .build();
+
+export const ContourNodeConfigSchema = contourConfig.schema;
+export type ContourNodeConfig = z.infer<typeof ContourNodeConfigSchema>;
diff --git a/nodes/node-contour/src/shared/index.ts b/nodes/node-contour/src/shared/index.ts
new file mode 100644
index 00000000..d1bc97e8
--- /dev/null
+++ b/nodes/node-contour/src/shared/index.ts
@@ -0,0 +1 @@
+export * from "./config.js";
diff --git a/nodes/node-contour/tsconfig.json b/nodes/node-contour/tsconfig.json
new file mode 100644
index 00000000..5a0b963f
--- /dev/null
+++ b/nodes/node-contour/tsconfig.json
@@ -0,0 +1,12 @@
+{
+ "extends": "@framefields/tsconfig/node-library.json",
+ "compilerOptions": {
+ "baseUrl": ".",
+ "paths": {
+ "@/*": ["./src/*"]
+ },
+ "experimentalDecorators": true,
+ "emitDecoratorMetadata": true
+ },
+ "include": ["src"]
+}
diff --git a/nodes/node-contour/tsdown.config.ts b/nodes/node-contour/tsdown.config.ts
new file mode 100644
index 00000000..73f5c2fc
--- /dev/null
+++ b/nodes/node-contour/tsdown.config.ts
@@ -0,0 +1,13 @@
+import { defineConfig } from "tsdown";
+
+export default defineConfig({
+ entry: {
+ index: "src/index.ts",
+ renderer: "src/renderers/index.ts",
+ },
+ format: ["esm"],
+ dts: true,
+ clean: true,
+ sourcemap: true,
+ treeshake: true,
+});
diff --git a/nodes/node-crt/package.json b/nodes/node-crt/package.json
new file mode 100644
index 00000000..d30e5fd7
--- /dev/null
+++ b/nodes/node-crt/package.json
@@ -0,0 +1,45 @@
+{
+ "name": "@framefields/node-crt",
+ "version": "2.2.0",
+ "private": false,
+ "framefields": {
+ "type": "CRT",
+ "kind": "effect",
+ "schema": "CRTNodeConfigSchema"
+ },
+ "type": "module",
+ "license": "Apache-2.0",
+ "exports": {
+ ".": {
+ "types": "./dist/index.d.mts",
+ "development": "./src/index.ts",
+ "import": "./dist/index.mjs",
+ "default": "./dist/index.mjs"
+ },
+ "./renderer": {
+ "types": "./dist/renderer.d.mts",
+ "development": "./src/renderers/index.ts",
+ "import": "./dist/renderer.mjs",
+ "default": "./dist/renderer.mjs"
+ }
+ },
+ "scripts": {
+ "build": "tsdown",
+ "dev": "tsdown --watch",
+ "clean": "rm -rf dist .turbo"
+ },
+ "dependencies": {
+ "@framefields/node-sdk": "workspace:*",
+ "zod": "^4.3.6"
+ },
+ "devDependencies": {
+ "@framefields/tsconfig": "workspace:*",
+ "@types/node": "^24.1.0",
+ "tsdown": "^0.19.0",
+ "typescript": "^5.8.3",
+ "webgpu": "^0.4.0"
+ },
+ "publishConfig": {
+ "access": "public"
+ }
+}
diff --git a/nodes/node-crt/src/index.ts b/nodes/node-crt/src/index.ts
new file mode 100644
index 00000000..944d702e
--- /dev/null
+++ b/nodes/node-crt/src/index.ts
@@ -0,0 +1,2 @@
+export * from "./renderers/index.js";
+export * from "./shared/index.js";
diff --git a/nodes/node-crt/src/renderers/index.ts b/nodes/node-crt/src/renderers/index.ts
new file mode 100644
index 00000000..6dc11aab
--- /dev/null
+++ b/nodes/node-crt/src/renderers/index.ts
@@ -0,0 +1,7 @@
+import { defineRenderer } from "@framefields/node-sdk/renderer";
+import { CRTWebGPURenderer } from "./webgpu-renderer.js";
+
+export default defineRenderer({
+ WebGPURenderer: CRTWebGPURenderer,
+});
+export { CRTWebGPURenderer };
diff --git a/nodes/node-crt/src/renderers/webgpu-renderer.ts b/nodes/node-crt/src/renderers/webgpu-renderer.ts
new file mode 100644
index 00000000..5c542885
--- /dev/null
+++ b/nodes/node-crt/src/renderers/webgpu-renderer.ts
@@ -0,0 +1,240 @@
+/// <reference types="webgpu" />
+/**
+ * CRT / VHS: An old screen: barrel curvature, scanlines, aperture-grille mask, noise, flicker and vignette; `tracking` and `chroma` add VHS tape wobble, rolling bands and color bleed.
+ */
+import type { WebGPUNodeRenderer } from "@framefields/node-sdk";
+import {
+ drawChildToTexture,
+ drawFullscreenPass,
+ drawTextureToTarget,
+ FULLSCREEN_QUAD_WGSL,
+ fragmentBindGroupLayout,
+ perDevice,
+} from "@framefields/node-sdk/gpu";
+
+const OP = "CRT";
+const UNIFORM_FLOATS = 16;
+
+/** One fragment shader per pass; pass 0 reads the layer, later passes read the previous pass. */
+const PASSES = [
+ `struct U { v : array<vec4<f32>, 4> };
+@group(0) @binding(0) var<uniform> u : U;
+@group(0) @binding(1) var src : texture_2d<f32>;
+@group(0) @binding(2) var prev : texture_2d<f32>;
+@group(0) @binding(3) var samp : sampler;
+${FULLSCREEN_QUAD_WGSL}
+
+fn straight(c : vec4<f32>) -> vec4<f32> {
+ if (c.a <= 0.0001) { return vec4<f32>(0.0); }
+ return vec4<f32>(c.rgb / c.a, c.a);
+}
+fn premul(c : vec4<f32>) -> vec4<f32> { return vec4<f32>(c.rgb * c.a, c.a); }
+fn res() -> vec2<f32> { return vec2<f32>(textureDimensions(src)); }
+/** Straight-alpha color of the layer at a uv (filtered). */
+fn sampleS(uv : vec2<f32>) -> vec4<f32> { return straight(textureSampleLevel(src, samp, uv, 0.0)); }
+/** Premultiplied color of the layer at a uv (filtered). */
+fn sampleP(uv : vec2<f32>) -> vec4<f32> { return textureSampleLevel(src, samp, uv, 0.0); }
+/** Straight-alpha color of the layer's texel at a pixel position (nearest). */
+fn texelS(p : vec2<f32>) -> vec4<f32> {
+ let d = vec2<i32>(textureDimensions(src));
+ let q = clamp(vec2<i32>(floor(p)), vec2<i32>(0), d - vec2<i32>(1));
+ return straight(textureLoad(src, q, 0));
+}
+fn luma(c : vec3<f32>) -> f32 { return dot(c, vec3<f32>(0.2126, 0.7152, 0.0722)); }
+fn hash12(p : vec2<f32>) -> f32 {
+ var p3 = fract(vec3<f32>(p.xyx) * 0.1031);
+ p3 += dot(p3, p3.yzx + 33.33);
+ return fract((p3.x + p3.y) * p3.z);
+}
+fn vnoise(p : vec2<f32>) -> f32 {
+ let i = floor(p);
+ let f = fract(p);
+ let u = f * f * (3.0 - 2.0 * f);
+ return mix(mix(hash12(i), hash12(i + vec2<f32>(1.0, 0.0)), u.x),
+ mix(hash12(i + vec2<f32>(0.0, 1.0)), hash12(i + vec2<f32>(1.0, 1.0)), u.x), u.y);
+}
+/** 8x8 ordered-dither threshold, 0..1. */
+fn bayer8(p : vec2<f32>) -> f32 {
+ let x = u32(p.x) & 7u;
+ let y = u32(p.y) & 7u;
+ var v = 0u;
+ for (var k = 0u; k < 3u; k++) {
+ let bx = (x >> k) & 1u;
+ let by = (y >> k) & 1u;
+ let m = ((bx ^ by) << 1u) | by;
+ v += m * (1u << (2u * (2u - k)));
+ }
+ return (f32(v) + 0.5) / 64.0;
+}
+fn rot2(a : f32) -> mat2x2<f32> { let c = cos(a); let s = sin(a); return mat2x2<f32>(c, s, -s, c); }
+@fragment fn fs(in : VSOut) -> @location(0) vec4<f32> {
+ let time = u.v[0].x;
+ let frame = u.v[0].y;
+ let scanlines = u.v[1].x;
+ let lineCount = u.v[1].y;
+ let curvature = u.v[1].z;
+ let mask = u.v[1].w;
+ let vignette = u.v[2].x;
+ let noise = u.v[2].y;
+ let flicker = u.v[2].z;
+ let tracking = u.v[2].w;
+ let chroma = u.v[3].x;
+
+ let R = res();
+ let t = time;
+ let cc = in.uv * 2.0 - 1.0;
+ var uv = (cc * (1.0 + curvature * 0.25 * dot(cc, cc))) * 0.5 + 0.5;
+ if (uv.x < 0.0 || uv.y < 0.0 || uv.x > 1.0 || uv.y > 1.0) { return vec4<f32>(0.0, 0.0, 0.0, 1.0); }
+ let line = floor(uv.y * lineCount);
+ let jitter = (hash12(vec2<f32>(line, floor(t * 30.0))) - 0.5) * tracking * 0.006;
+ let bandY = fract(t * 0.13);
+ let band = smoothstep(0.07, 0.0, abs(uv.y - bandY)) * tracking;
+ uv.x += jitter + band * 0.015 * sin(uv.y * 400.0 + t * 20.0);
+ let base = sampleS(uv);
+ var rgb = base.rgb;
+ if (chroma > 0.0) {
+ let off = chroma / R.x;
+ let avg = (sampleS(uv - vec2<f32>(off, 0.0)).rgb + base.rgb + sampleS(uv + vec2<f32>(off * 2.0, 0.0)).rgb) / 3.0;
+ let y = luma(base.rgb);
+ rgb = vec3<f32>(y) + (avg - vec3<f32>(luma(avg)));
+ }
+ let sl = 0.5 + 0.5 * cos(uv.y * lineCount * 6.2831853);
+ rgb *= 1.0 - scanlines * (1.0 - sl) * 0.7;
+ let tri = u32(floor(in.uv.x * R.x)) % 3u;
+ var m = vec3<f32>(0.75);
+ if (tri == 0u) { m.r = 1.25; } else if (tri == 1u) { m.g = 1.25; } else { m.b = 1.25; }
+ rgb *= mix(vec3<f32>(1.0), m, mask);
+ rgb += (hash12(in.uv * R + vec2<f32>(t * 61.0, t * 17.0)) - 0.5) * noise * 0.3;
+ rgb *= 1.0 - flicker * hash12(vec2<f32>(floor(t * 24.0), 3.0));
+ rgb *= 1.0 - vignette * dot(cc, cc) * 0.35;
+ rgb += band * 0.12;
+ return vec4<f32>(clamp(rgb, vec3<f32>(0.0), vec3<f32>(1.0)), 1.0);
+}
+`,
+];
+
+const resources = perDevice((device: GPUDevice) => ({
+ layout: fragmentBindGroupLayout(
+ device,
+ ["uniform", "texture", "texture", "sampler"],
+ `${OP}_layout`,
+ ),
+ pipelines: new Map<GPUTextureFormat, GPURenderPipeline[]>(),
+ sampler: device.createSampler({
+ magFilter: "linear",
+ minFilter: "linear",
+ addressModeU: "clamp-to-edge",
+ addressModeV: "clamp-to-edge",
+ }),
+}));
+
+function pipelinesFor(
+ device: GPUDevice,
+ format: GPUTextureFormat,
+): GPURenderPipeline[] {
+ const r = resources(device);
+ let list = r.pipelines.get(format);
+ if (!list) {
+ list = PASSES.map((code, i) => {
+ const module = device.createShaderModule({
+ code,
+ label: `${OP}_${i}.wgsl`,
+ });
+ return device.createRenderPipeline({
+ label: `${OP}_${i}`,
+ layout: device.createPipelineLayout({ bindGroupLayouts: [r.layout] }),
+ vertex: { module, entryPoint: "vs" },
+ fragment: { module, entryPoint: "fs", targets: [{ format }] },
+ primitive: { topology: "triangle-strip" },
+ });
+ });
+ r.pipelines.set(format, list);
+ }
+ return list;
+}
+
+function num(v: unknown, fallback: number): number {
+ const n = typeof v === "number" ? v : Number(v);
+ return Number.isFinite(n) ? n : fallback;
+}
+
+/** Packs the effect's resolved props into the uniform block the shaders read. */
+function pack(
+ raw: Record<string, unknown>,
+ data: Float32Array,
+ time: number,
+ frame: number,
+): void {
+ data.fill(0);
+ data[0] = time;
+ data[1] = frame;
+ data[4] = num(raw.scanlines, 0.45);
+ data[5] = num(raw.lineCount, 540);
+ data[6] = num(raw.curvature, 0.12);
+ data[7] = num(raw.mask, 0.25);
+ data[8] = num(raw.vignette, 0.35);
+ data[9] = num(raw.noise, 0.08);
+ data[10] = num(raw.flicker, 0.03);
+ data[11] = num(raw.tracking, 0);
+ data[12] = num(raw.chroma, 0);
+}
+
+export const CRTWebGPURenderer: WebGPUNodeRenderer = async (args) => {
+ const {
+ ctx,
+ encoder,
+ pass,
+ targetTexture,
+ targetWidth,
+ targetHeight,
+ props,
+ } = args;
+ const op = props.virtualMedia?.operation as
+ | ({
+ op?: string;
+ effect?: {
+ resolveUniforms?: (ctx: unknown) => Record<string, unknown>;
+ };
+ } & Record<string, unknown>)
+ | undefined;
+ if (op?.op !== OP) return;
+ const child = props.virtualMedia?.children?.[0];
+ if (!child) return;
+ pass.end();
+
+ const fps = props.fps || 30;
+ const frame = Math.round(props.compositionFrame ?? props.frame ?? 0);
+ const raw = op.effect?.resolveUniforms
+ ? op.effect.resolveUniforms({ frame, fps, time: frame / fps })
+ : op;
+ const data = new Float32Array(UNIFORM_FLOATS);
+ pack(raw, data, frame / fps, frame);
+
+ const { texture: childTex } = await drawChildToTexture(args, child);
+ const device = ctx.device;
+ const r = resources(device);
+ const pipelines = pipelinesFor(device, ctx.renderer.format);
+ const ubo = ctx.renderer.getTemporaryBuffer(data);
+ let prev = childTex;
+ for (const pipeline of pipelines) {
+ const out = ctx.renderer.getTemporaryTexture(targetWidth, targetHeight, [
+ childTex,
+ prev,
+ targetTexture,
+ ...(props.excludeTextures || []),
+ ]);
+ drawFullscreenPass(encoder, out.createView(), pipeline, [
+ device.createBindGroup({
+ layout: r.layout,
+ entries: [
+ { binding: 0, resource: { buffer: ubo } },
+ { binding: 1, resource: childTex.createView() },
+ { binding: 2, resource: prev.createView() },
+ { binding: 3, resource: r.sampler },
+ ],
+ }),
+ ]);
+ prev = out;
+ }
+ drawTextureToTarget(args, prev);
+};
diff --git a/nodes/node-crt/src/shared/config.ts b/nodes/node-crt/src/shared/config.ts
new file mode 100644
index 00000000..450157f2
--- /dev/null
+++ b/nodes/node-crt/src/shared/config.ts
@@ -0,0 +1,62 @@
+import { configBuilder } from "@framefields/node-sdk";
+import { z } from "zod";
+
+export const cRTConfig = configBuilder()
+ .field("scanlines", z.number().min(0).max(1).default(0.45), {
+ bindable: true,
+ dataTypes: ["Number", "Signal"],
+ label: "scanlines",
+ description: "Scanline darkness.",
+ })
+ .field("lineCount", z.number().int().min(100).max(2160).default(540), {
+ bindable: true,
+ dataTypes: ["Number", "Signal"],
+ label: "lineCount",
+ description: "Scanlines over the height.",
+ })
+ .field("curvature", z.number().min(0).max(1).default(0.12), {
+ bindable: true,
+ dataTypes: ["Number", "Signal"],
+ label: "curvature",
+ description: "Barrel distortion of the tube.",
+ })
+ .field("mask", z.number().min(0).max(1).default(0.25), {
+ bindable: true,
+ dataTypes: ["Number", "Signal"],
+ label: "mask",
+ description: "RGB aperture-grille strength.",
+ })
+ .field("vignette", z.number().min(0).max(1).default(0.35), {
+ bindable: true,
+ dataTypes: ["Number", "Signal"],
+ label: "vignette",
+ description: "Darkening toward the edges.",
+ })
+ .field("noise", z.number().min(0).max(1).default(0.08), {
+ bindable: true,
+ dataTypes: ["Number", "Signal"],
+ label: "noise",
+ description: "Animated static.",
+ })
+ .field("flicker", z.number().min(0).max(1).default(0.03), {
+ bindable: true,
+ dataTypes: ["Number", "Signal"],
+ label: "flicker",
+ description: "Brightness flicker.",
+ })
+ .field("tracking", z.number().min(0).max(1).default(0), {
+ bindable: true,
+ dataTypes: ["Number", "Signal"],
+ label: "tracking",
+ description: "VHS tracking error: line jitter and a rolling band.",
+ })
+ .field("chroma", z.number().min(0).max(20).default(0), {
+ bindable: true,
+ dataTypes: ["Number", "Signal"],
+ label: "chroma",
+ description: "VHS color bleed, px.",
+ })
+ .build();
+
+export const CRTNodeConfigSchema = cRTConfig.schema;
+export type CRTNodeConfig = z.infer<typeof CRTNodeConfigSchema>;
diff --git a/nodes/node-crt/src/shared/index.ts b/nodes/node-crt/src/shared/index.ts
new file mode 100644
index 00000000..d1bc97e8
--- /dev/null
+++ b/nodes/node-crt/src/shared/index.ts
@@ -0,0 +1 @@
+export * from "./config.js";
diff --git a/nodes/node-crt/tsconfig.json b/nodes/node-crt/tsconfig.json
new file mode 100644
index 00000000..5a0b963f
--- /dev/null
+++ b/nodes/node-crt/tsconfig.json
@@ -0,0 +1,12 @@
+{
+ "extends": "@framefields/tsconfig/node-library.json",
+ "compilerOptions": {
+ "baseUrl": ".",
+ "paths": {
+ "@/*": ["./src/*"]
+ },
+ "experimentalDecorators": true,
+ "emitDecoratorMetadata": true
+ },
+ "include": ["src"]
+}
diff --git a/nodes/node-crt/tsdown.config.ts b/nodes/node-crt/tsdown.config.ts
new file mode 100644
index 00000000..73f5c2fc
--- /dev/null
+++ b/nodes/node-crt/tsdown.config.ts
@@ -0,0 +1,13 @@
+import { defineConfig } from "tsdown";
+
+export default defineConfig({
+ entry: {
+ index: "src/index.ts",
+ renderer: "src/renderers/index.ts",
+ },
+ format: ["esm"],
+ dts: true,
+ clean: true,
+ sourcemap: true,
+ treeshake: true,
+});
diff --git a/nodes/node-dither/package.json b/nodes/node-dither/package.json
new file mode 100644
index 00000000..ad4fc665
--- /dev/null
+++ b/nodes/node-dither/package.json
@@ -0,0 +1,45 @@
+{
+ "name": "@framefields/node-dither",
+ "version": "2.2.0",
+ "private": false,
+ "framefields": {
+ "type": "Dither",
+ "kind": "effect",
+ "schema": "DitherNodeConfigSchema"
+ },
+ "type": "module",
+ "license": "Apache-2.0",
+ "exports": {
+ ".": {
+ "types": "./dist/index.d.mts",
+ "development": "./src/index.ts",
+ "import": "./dist/index.mjs",
+ "default": "./dist/index.mjs"
+ },
+ "./renderer": {
+ "types": "./dist/renderer.d.mts",
+ "development": "./src/renderers/index.ts",
+ "import": "./dist/renderer.mjs",
+ "default": "./dist/renderer.mjs"
+ }
+ },
+ "scripts": {
+ "build": "tsdown",
+ "dev": "tsdown --watch",
+ "clean": "rm -rf dist .turbo"
+ },
+ "dependencies": {
+ "@framefields/node-sdk": "workspace:*",
+ "zod": "^4.3.6"
+ },
+ "devDependencies": {
+ "@framefields/tsconfig": "workspace:*",
+ "@types/node": "^24.1.0",
+ "tsdown": "^0.19.0",
+ "typescript": "^5.8.3",
+ "webgpu": "^0.4.0"
+ },
+ "publishConfig": {
+ "access": "public"
+ }
+}
diff --git a/nodes/node-dither/src/index.ts b/nodes/node-dither/src/index.ts
new file mode 100644
index 00000000..944d702e
--- /dev/null
+++ b/nodes/node-dither/src/index.ts
@@ -0,0 +1,2 @@
+export * from "./renderers/index.js";
+export * from "./shared/index.js";
diff --git a/nodes/node-dither/src/renderers/index.ts b/nodes/node-dither/src/renderers/index.ts
new file mode 100644
index 00000000..2062dfe1
--- /dev/null
+++ b/nodes/node-dither/src/renderers/index.ts
@@ -0,0 +1,7 @@
+import { defineRenderer } from "@framefields/node-sdk/renderer";
+import { DitherWebGPURenderer } from "./webgpu-renderer.js";
+
+export default defineRenderer({
+ WebGPURenderer: DitherWebGPURenderer,
+});
+export { DitherWebGPURenderer };
diff --git a/nodes/node-dither/src/renderers/webgpu-renderer.ts b/nodes/node-dither/src/renderers/webgpu-renderer.ts
new file mode 100644
index 00000000..ed43d153
--- /dev/null
+++ b/nodes/node-dither/src/renderers/webgpu-renderer.ts
@@ -0,0 +1,233 @@
+/// <reference types="webgpu" />
+/**
+ * Dither: Ordered, noise or halftone dithering to a few levels: 1-bit duotone (dark/light colors) or per-channel color.
+ */
+import type { WebGPUNodeRenderer } from "@framefields/node-sdk";
+import {
+ drawChildToTexture,
+ drawFullscreenPass,
+ drawTextureToTarget,
+ FULLSCREEN_QUAD_WGSL,
+ fragmentBindGroupLayout,
+ perDevice,
+} from "@framefields/node-sdk/gpu";
+
+const OP = "Dither";
+const UNIFORM_FLOATS = 16;
+
+/** One fragment shader per pass; pass 0 reads the layer, later passes read the previous pass. */
+const PASSES = [
+ `struct U { v : array<vec4<f32>, 4> };
+@group(0) @binding(0) var<uniform> u : U;
+@group(0) @binding(1) var src : texture_2d<f32>;
+@group(0) @binding(2) var prev : texture_2d<f32>;
+@group(0) @binding(3) var samp : sampler;
+${FULLSCREEN_QUAD_WGSL}
+
+fn straight(c : vec4<f32>) -> vec4<f32> {
+ if (c.a <= 0.0001) { return vec4<f32>(0.0); }
+ return vec4<f32>(c.rgb / c.a, c.a);
+}
+fn premul(c : vec4<f32>) -> vec4<f32> { return vec4<f32>(c.rgb * c.a, c.a); }
+fn res() -> vec2<f32> { return vec2<f32>(textureDimensions(src)); }
+/** Straight-alpha color of the layer at a uv (filtered). */
+fn sampleS(uv : vec2<f32>) -> vec4<f32> { return straight(textureSampleLevel(src, samp, uv, 0.0)); }
+/** Premultiplied color of the layer at a uv (filtered). */
+fn sampleP(uv : vec2<f32>) -> vec4<f32> { return textureSampleLevel(src, samp, uv, 0.0); }
+/** Straight-alpha color of the layer's texel at a pixel position (nearest). */
+fn texelS(p : vec2<f32>) -> vec4<f32> {
+ let d = vec2<i32>(textureDimensions(src));
+ let q = clamp(vec2<i32>(floor(p)), vec2<i32>(0), d - vec2<i32>(1));
+ return straight(textureLoad(src, q, 0));
+}
+fn luma(c : vec3<f32>) -> f32 { return dot(c, vec3<f32>(0.2126, 0.7152, 0.0722)); }
+fn hash12(p : vec2<f32>) -> f32 {
+ var p3 = fract(vec3<f32>(p.xyx) * 0.1031);
+ p3 += dot(p3, p3.yzx + 33.33);
+ return fract((p3.x + p3.y) * p3.z);
+}
+fn vnoise(p : vec2<f32>) -> f32 {
+ let i = floor(p);
+ let f = fract(p);
+ let u = f * f * (3.0 - 2.0 * f);
+ return mix(mix(hash12(i), hash12(i + vec2<f32>(1.0, 0.0)), u.x),
+ mix(hash12(i + vec2<f32>(0.0, 1.0)), hash12(i + vec2<f32>(1.0, 1.0)), u.x), u.y);
+}
+/** 8x8 ordered-dither threshold, 0..1. */
+fn bayer8(p : vec2<f32>) -> f32 {
+ let x = u32(p.x) & 7u;
+ let y = u32(p.y) & 7u;
+ var v = 0u;
+ for (var k = 0u; k < 3u; k++) {
+ let bx = (x >> k) & 1u;
+ let by = (y >> k) & 1u;
+ let m = ((bx ^ by) << 1u) | by;
+ v += m * (1u << (2u * (2u - k)));
+ }
+ return (f32(v) + 0.5) / 64.0;
+}
+fn rot2(a : f32) -> mat2x2<f32> { let c = cos(a); let s = sin(a); return mat2x2<f32>(c, s, -s, c); }
+@fragment fn fs(in : VSOut) -> @location(0) vec4<f32> {
+ let time = u.v[0].x;
+ let frame = u.v[0].y;
+ let mode = u32(u.v[1].x + 0.5);
+ let levels = u.v[1].y;
+ let scale = u.v[1].z;
+ let monochrome = u.v[1].w;
+ let dark = u.v[2];
+ let light = u.v[3];
+
+ let R = res();
+ let s = max(scale, 1.0);
+ let cellp = floor(in.uv * R / s);
+ let c = texelS(cellp * s + s * 0.5);
+ var t = bayer8(cellp);
+ if (mode == 1u) { t = hash12(cellp); }
+ if (mode == 2u) { t = clamp(length(fract(cellp / 4.0) - 0.5) * 1.414, 0.0, 1.0); }
+ let n = max(levels - 1.0, 1.0);
+ var rgb : vec3<f32>;
+ if (monochrome > 0.5) {
+ let q = clamp(floor(luma(c.rgb) * n + t) / n, 0.0, 1.0);
+ rgb = mix(dark.rgb, light.rgb, q);
+ } else {
+ rgb = clamp(floor(c.rgb * n + vec3<f32>(t)) / n, vec3<f32>(0.0), vec3<f32>(1.0));
+ }
+ return premul(vec4<f32>(rgb, c.a));
+}
+`,
+];
+
+const resources = perDevice((device: GPUDevice) => ({
+ layout: fragmentBindGroupLayout(
+ device,
+ ["uniform", "texture", "texture", "sampler"],
+ `${OP}_layout`,
+ ),
+ pipelines: new Map<GPUTextureFormat, GPURenderPipeline[]>(),
+ sampler: device.createSampler({
+ magFilter: "linear",
+ minFilter: "linear",
+ addressModeU: "clamp-to-edge",
+ addressModeV: "clamp-to-edge",
+ }),
+}));
+
+function pipelinesFor(
+ device: GPUDevice,
+ format: GPUTextureFormat,
+): GPURenderPipeline[] {
+ const r = resources(device);
+ let list = r.pipelines.get(format);
+ if (!list) {
+ list = PASSES.map((code, i) => {
+ const module = device.createShaderModule({
+ code,
+ label: `${OP}_${i}.wgsl`,
+ });
+ return device.createRenderPipeline({
+ label: `${OP}_${i}`,
+ layout: device.createPipelineLayout({ bindGroupLayouts: [r.layout] }),
+ vertex: { module, entryPoint: "vs" },
+ fragment: { module, entryPoint: "fs", targets: [{ format }] },
+ primitive: { topology: "triangle-strip" },
+ });
+ });
+ r.pipelines.set(format, list);
+ }
+ return list;
+}
+
+function num(v: unknown, fallback: number): number {
+ const n = typeof v === "number" ? v : Number(v);
+ return Number.isFinite(n) ? n : fallback;
+}
+
+function hexToRgba(hex: string): [number, number, number, number] {
+ let h = hex.trim().replace("#", "");
+ if (h.length === 3 || h.length === 4) {
+ h = [...h].map((c) => c + c).join("");
+ }
+ const n = (i: number) => Number.parseInt(h.slice(i, i + 2), 16) / 255;
+ return [n(0), n(2), n(4), h.length >= 8 ? n(6) : 1];
+}
+
+/** Packs the effect's resolved props into the uniform block the shaders read. */
+function pack(
+ raw: Record<string, unknown>,
+ data: Float32Array,
+ time: number,
+ frame: number,
+): void {
+ data.fill(0);
+ data[0] = time;
+ data[1] = frame;
+ data[4] = Math.max(
+ 0,
+ ["bayer", "noise", "halftone"].indexOf(String(raw.mode ?? "bayer")),
+ );
+ data[5] = num(raw.levels, 2);
+ data[6] = num(raw.scale, 2);
+ data[7] = raw.monochrome === undefined ? 1 : raw.monochrome ? 1 : 0;
+ data.set(hexToRgba(String(raw.dark ?? "#111111")), 8);
+ data.set(hexToRgba(String(raw.light ?? "#f2efe6")), 12);
+}
+
+export const DitherWebGPURenderer: WebGPUNodeRenderer = async (args) => {
+ const {
+ ctx,
+ encoder,
+ pass,
+ targetTexture,
+ targetWidth,
+ targetHeight,
+ props,
+ } = args;
+ const op = props.virtualMedia?.operation as
+ | ({
+ op?: string;
+ effect?: {
+ resolveUniforms?: (ctx: unknown) => Record<string, unknown>;
+ };
+ } & Record<string, unknown>)
+ | undefined;
+ if (op?.op !== OP) return;
+ const child = props.virtualMedia?.children?.[0];
+ if (!child) return;
+ pass.end();
+
+ const fps = props.fps || 30;
+ const frame = Math.round(props.compositionFrame ?? props.frame ?? 0);
+ const raw = op.effect?.resolveUniforms
+ ? op.effect.resolveUniforms({ frame, fps, time: frame / fps })
+ : op;
+ const data = new Float32Array(UNIFORM_FLOATS);
+ pack(raw, data, frame / fps, frame);
+
+ const { texture: childTex } = await drawChildToTexture(args, child);
+ const device = ctx.device;
+ const r = resources(device);
+ const pipelines = pipelinesFor(device, ctx.renderer.format);
+ const ubo = ctx.renderer.getTemporaryBuffer(data);
+ let prev = childTex;
+ for (const pipeline of pipelines) {
+ const out = ctx.renderer.getTemporaryTexture(targetWidth, targetHeight, [
+ childTex,
+ prev,
+ targetTexture,
+ ...(props.excludeTextures || []),
+ ]);
+ drawFullscreenPass(encoder, out.createView(), pipeline, [
+ device.createBindGroup({
+ layout: r.layout,
+ entries: [
+ { binding: 0, resource: { buffer: ubo } },
+ { binding: 1, resource: childTex.createView() },
+ { binding: 2, resource: prev.createView() },
+ { binding: 3, resource: r.sampler },
+ ],
+ }),
+ ]);
+ prev = out;
+ }
+ drawTextureToTarget(args, prev);
+};
diff --git a/nodes/node-dither/src/shared/config.ts b/nodes/node-dither/src/shared/config.ts
new file mode 100644
index 00000000..8f711fc8
--- /dev/null
+++ b/nodes/node-dither/src/shared/config.ts
@@ -0,0 +1,42 @@
+import { configBuilder } from "@framefields/node-sdk";
+import { z } from "zod";
+
+export const ditherConfig = configBuilder()
+ .field("mode", z.enum(["bayer", "noise", "halftone"]).default("bayer"), {
+ bindable: false,
+ label: "mode",
+ description:
+ "Pattern: Bayer matrix, blue-ish noise or round halftone dots.",
+ })
+ .field("levels", z.number().int().min(2).max(16).default(2), {
+ bindable: true,
+ dataTypes: ["Number", "Signal"],
+ label: "levels",
+ description: "Levels per channel (2 = 1-bit).",
+ })
+ .field("scale", z.number().min(1).max(16).default(2), {
+ bindable: true,
+ dataTypes: ["Number", "Signal"],
+ label: "scale",
+ description: "Dither pixel size, px.",
+ })
+ .field("monochrome", z.boolean().default(true), {
+ bindable: false,
+ label: "monochrome",
+ description:
+ "Map brightness to the dark \u2192 light colors instead of dithering each channel.",
+ })
+ .field("dark", z.string().default("#111111"), {
+ bindable: false,
+ label: "dark",
+ description: "Dark color (monochrome).",
+ })
+ .field("light", z.string().default("#f2efe6"), {
+ bindable: false,
+ label: "light",
+ description: "Light color (monochrome).",
+ })
+ .build();
+
+export const DitherNodeConfigSchema = ditherConfig.schema;
+export type DitherNodeConfig = z.infer<typeof DitherNodeConfigSchema>;
diff --git a/nodes/node-dither/src/shared/index.ts b/nodes/node-dither/src/shared/index.ts
new file mode 100644
index 00000000..d1bc97e8
--- /dev/null
+++ b/nodes/node-dither/src/shared/index.ts
@@ -0,0 +1 @@
+export * from "./config.js";
diff --git a/nodes/node-dither/tsconfig.json b/nodes/node-dither/tsconfig.json
new file mode 100644
index 00000000..5a0b963f
--- /dev/null
+++ b/nodes/node-dither/tsconfig.json
@@ -0,0 +1,12 @@
+{
+ "extends": "@framefields/tsconfig/node-library.json",
+ "compilerOptions": {
+ "baseUrl": ".",
+ "paths": {
+ "@/*": ["./src/*"]
+ },
+ "experimentalDecorators": true,
+ "emitDecoratorMetadata": true
+ },
+ "include": ["src"]
+}
diff --git a/nodes/node-dither/tsdown.config.ts b/nodes/node-dither/tsdown.config.ts
new file mode 100644
index 00000000..73f5c2fc
--- /dev/null
+++ b/nodes/node-dither/tsdown.config.ts
@@ -0,0 +1,13 @@
+import { defineConfig } from "tsdown";
+
+export default defineConfig({
+ entry: {
+ index: "src/index.ts",
+ renderer: "src/renderers/index.ts",
+ },
+ format: ["esm"],
+ dts: true,
+ clean: true,
+ sourcemap: true,
+ treeshake: true,
+});
diff --git a/nodes/node-gooey/package.json b/nodes/node-gooey/package.json
new file mode 100644
index 00000000..86cc3177
--- /dev/null
+++ b/nodes/node-gooey/package.json
@@ -0,0 +1,45 @@
+{
+ "name": "@framefields/node-gooey",
+ "version": "2.2.0",
+ "private": false,
+ "framefields": {
+ "type": "Gooey",
+ "kind": "effect",
+ "schema": "GooeyNodeConfigSchema"
+ },
+ "type": "module",
+ "license": "Apache-2.0",
+ "exports": {
+ ".": {
+ "types": "./dist/index.d.mts",
+ "development": "./src/index.ts",
+ "import": "./dist/index.mjs",
+ "default": "./dist/index.mjs"
+ },
+ "./renderer": {
+ "types": "./dist/renderer.d.mts",
+ "development": "./src/renderers/index.ts",
+ "import": "./dist/renderer.mjs",
+ "default": "./dist/renderer.mjs"
+ }
+ },
+ "scripts": {
+ "build": "tsdown",
+ "dev": "tsdown --watch",
+ "clean": "rm -rf dist .turbo"
+ },
+ "dependencies": {
+ "@framefields/node-sdk": "workspace:*",
+ "zod": "^4.3.6"
+ },
+ "devDependencies": {
+ "@framefields/tsconfig": "workspace:*",
+ "@types/node": "^24.1.0",
+ "tsdown": "^0.19.0",
+ "typescript": "^5.8.3",
+ "webgpu": "^0.4.0"
+ },
+ "publishConfig": {
+ "access": "public"
+ }
+}
diff --git a/nodes/node-gooey/src/index.ts b/nodes/node-gooey/src/index.ts
new file mode 100644
index 00000000..944d702e
--- /dev/null
+++ b/nodes/node-gooey/src/index.ts
@@ -0,0 +1,2 @@
+export * from "./renderers/index.js";
+export * from "./shared/index.js";
diff --git a/nodes/node-gooey/src/renderers/index.ts b/nodes/node-gooey/src/renderers/index.ts
new file mode 100644
index 00000000..c58aaa33
--- /dev/null
+++ b/nodes/node-gooey/src/renderers/index.ts
@@ -0,0 +1,7 @@
+import { defineRenderer } from "@framefields/node-sdk/renderer";
+import { GooeyWebGPURenderer } from "./webgpu-renderer.js";
+
+export default defineRenderer({
+ WebGPURenderer: GooeyWebGPURenderer,
+});
+export { GooeyWebGPURenderer };
diff --git a/nodes/node-gooey/src/renderers/webgpu-renderer.ts b/nodes/node-gooey/src/renderers/webgpu-renderer.ts
new file mode 100644
index 00000000..4059ddc0
--- /dev/null
+++ b/nodes/node-gooey/src/renderers/webgpu-renderer.ts
@@ -0,0 +1,345 @@
+/// <reference types="webgpu" />
+/**
+ * Gooey: Metaballs: the layer blurred and its alpha re-thresholded, so nearby shapes melt into one blob and pull apart in strings. Put it on a group of circles or particles for liquid morphs.
+ */
+import type { WebGPUNodeRenderer } from "@framefields/node-sdk";
+import {
+ drawChildToTexture,
+ drawFullscreenPass,
+ drawTextureToTarget,
+ FULLSCREEN_QUAD_WGSL,
+ fragmentBindGroupLayout,
+ perDevice,
+} from "@framefields/node-sdk/gpu";
+
+const OP = "Gooey";
+const UNIFORM_FLOATS = 8;
+
+/** One fragment shader per pass; pass 0 reads the layer, later passes read the previous pass. */
+const PASSES = [
+ `struct U { v : array<vec4<f32>, 2> };
+@group(0) @binding(0) var<uniform> u : U;
+@group(0) @binding(1) var src : texture_2d<f32>;
+@group(0) @binding(2) var prev : texture_2d<f32>;
+@group(0) @binding(3) var samp : sampler;
+${FULLSCREEN_QUAD_WGSL}
+
+fn straight(c : vec4<f32>) -> vec4<f32> {
+ if (c.a <= 0.0001) { return vec4<f32>(0.0); }
+ return vec4<f32>(c.rgb / c.a, c.a);
+}
+fn premul(c : vec4<f32>) -> vec4<f32> { return vec4<f32>(c.rgb * c.a, c.a); }
+fn res() -> vec2<f32> { return vec2<f32>(textureDimensions(src)); }
+/** Straight-alpha color of the layer at a uv (filtered). */
+fn sampleS(uv : vec2<f32>) -> vec4<f32> { return straight(textureSampleLevel(src, samp, uv, 0.0)); }
+/** Premultiplied color of the layer at a uv (filtered). */
+fn sampleP(uv : vec2<f32>) -> vec4<f32> { return textureSampleLevel(src, samp, uv, 0.0); }
+/** Straight-alpha color of the layer's texel at a pixel position (nearest). */
+fn texelS(p : vec2<f32>) -> vec4<f32> {
+ let d = vec2<i32>(textureDimensions(src));
+ let q = clamp(vec2<i32>(floor(p)), vec2<i32>(0), d - vec2<i32>(1));
+ return straight(textureLoad(src, q, 0));
+}
+fn luma(c : vec3<f32>) -> f32 { return dot(c, vec3<f32>(0.2126, 0.7152, 0.0722)); }
+fn hash12(p : vec2<f32>) -> f32 {
+ var p3 = fract(vec3<f32>(p.xyx) * 0.1031);
+ p3 += dot(p3, p3.yzx + 33.33);
+ return fract((p3.x + p3.y) * p3.z);
+}
+fn vnoise(p : vec2<f32>) -> f32 {
+ let i = floor(p);
+ let f = fract(p);
+ let u = f * f * (3.0 - 2.0 * f);
+ return mix(mix(hash12(i), hash12(i + vec2<f32>(1.0, 0.0)), u.x),
+ mix(hash12(i + vec2<f32>(0.0, 1.0)), hash12(i + vec2<f32>(1.0, 1.0)), u.x), u.y);
+}
+/** 8x8 ordered-dither threshold, 0..1. */
+fn bayer8(p : vec2<f32>) -> f32 {
+ let x = u32(p.x) & 7u;
+ let y = u32(p.y) & 7u;
+ var v = 0u;
+ for (var k = 0u; k < 3u; k++) {
+ let bx = (x >> k) & 1u;
+ let by = (y >> k) & 1u;
+ let m = ((bx ^ by) << 1u) | by;
+ v += m * (1u << (2u * (2u - k)));
+ }
+ return (f32(v) + 0.5) / 64.0;
+}
+fn rot2(a : f32) -> mat2x2<f32> { let c = cos(a); let s = sin(a); return mat2x2<f32>(c, s, -s, c); }
+@fragment fn fs(in : VSOut) -> @location(0) vec4<f32> {
+ let time = u.v[0].x;
+ let frame = u.v[0].y;
+ let radius = u.v[1].x;
+ let threshold = u.v[1].y;
+ let softness = u.v[1].z;
+
+ let R = res();
+ let rr = max(radius, 0.5);
+ let stepPx = max(1.0, rr / 16.0);
+ let sigma = rr * 0.5;
+ var acc = vec4<f32>(0.0);
+ var wsum = 0.0;
+ for (var k = -rr; k <= rr; k += stepPx) {
+ let w = exp(-(k * k) / (2.0 * sigma * sigma));
+ acc += textureSampleLevel(prev, samp, in.uv + vec2<f32>(1.0, 0.0) * k / R, 0.0) * w;
+ wsum += w;
+ }
+ return acc / wsum;
+}
+`,
+ `struct U { v : array<vec4<f32>, 2> };
+@group(0) @binding(0) var<uniform> u : U;
+@group(0) @binding(1) var src : texture_2d<f32>;
+@group(0) @binding(2) var prev : texture_2d<f32>;
+@group(0) @binding(3) var samp : sampler;
+${FULLSCREEN_QUAD_WGSL}
+
+fn straight(c : vec4<f32>) -> vec4<f32> {
+ if (c.a <= 0.0001) { return vec4<f32>(0.0); }
+ return vec4<f32>(c.rgb / c.a, c.a);
+}
+fn premul(c : vec4<f32>) -> vec4<f32> { return vec4<f32>(c.rgb * c.a, c.a); }
+fn res() -> vec2<f32> { return vec2<f32>(textureDimensions(src)); }
+/** Straight-alpha color of the layer at a uv (filtered). */
+fn sampleS(uv : vec2<f32>) -> vec4<f32> { return straight(textureSampleLevel(src, samp, uv, 0.0)); }
+/** Premultiplied color of the layer at a uv (filtered). */
+fn sampleP(uv : vec2<f32>) -> vec4<f32> { return textureSampleLevel(src, samp, uv, 0.0); }
+/** Straight-alpha color of the layer's texel at a pixel position (nearest). */
+fn texelS(p : vec2<f32>) -> vec4<f32> {
+ let d = vec2<i32>(textureDimensions(src));
+ let q = clamp(vec2<i32>(floor(p)), vec2<i32>(0), d - vec2<i32>(1));
+ return straight(textureLoad(src, q, 0));
+}
+fn luma(c : vec3<f32>) -> f32 { return dot(c, vec3<f32>(0.2126, 0.7152, 0.0722)); }
+fn hash12(p : vec2<f32>) -> f32 {
+ var p3 = fract(vec3<f32>(p.xyx) * 0.1031);
+ p3 += dot(p3, p3.yzx + 33.33);
+ return fract((p3.x + p3.y) * p3.z);
+}
+fn vnoise(p : vec2<f32>) -> f32 {
+ let i = floor(p);
+ let f = fract(p);
+ let u = f * f * (3.0 - 2.0 * f);
+ return mix(mix(hash12(i), hash12(i + vec2<f32>(1.0, 0.0)), u.x),
+ mix(hash12(i + vec2<f32>(0.0, 1.0)), hash12(i + vec2<f32>(1.0, 1.0)), u.x), u.y);
+}
+/** 8x8 ordered-dither threshold, 0..1. */
+fn bayer8(p : vec2<f32>) -> f32 {
+ let x = u32(p.x) & 7u;
+ let y = u32(p.y) & 7u;
+ var v = 0u;
+ for (var k = 0u; k < 3u; k++) {
+ let bx = (x >> k) & 1u;
+ let by = (y >> k) & 1u;
+ let m = ((bx ^ by) << 1u) | by;
+ v += m * (1u << (2u * (2u - k)));
+ }
+ return (f32(v) + 0.5) / 64.0;
+}
+fn rot2(a : f32) -> mat2x2<f32> { let c = cos(a); let s = sin(a); return mat2x2<f32>(c, s, -s, c); }
+@fragment fn fs(in : VSOut) -> @location(0) vec4<f32> {
+ let time = u.v[0].x;
+ let frame = u.v[0].y;
+ let radius = u.v[1].x;
+ let threshold = u.v[1].y;
+ let softness = u.v[1].z;
+
+ let R = res();
+ let rr = max(radius, 0.5);
+ let stepPx = max(1.0, rr / 16.0);
+ let sigma = rr * 0.5;
+ var acc = vec4<f32>(0.0);
+ var wsum = 0.0;
+ for (var k = -rr; k <= rr; k += stepPx) {
+ let w = exp(-(k * k) / (2.0 * sigma * sigma));
+ acc += textureSampleLevel(prev, samp, in.uv + vec2<f32>(0.0, 1.0) * k / R, 0.0) * w;
+ wsum += w;
+ }
+ return acc / wsum;
+}
+`,
+ `struct U { v : array<vec4<f32>, 2> };
+@group(0) @binding(0) var<uniform> u : U;
+@group(0) @binding(1) var src : texture_2d<f32>;
+@group(0) @binding(2) var prev : texture_2d<f32>;
+@group(0) @binding(3) var samp : sampler;
+${FULLSCREEN_QUAD_WGSL}
+
+fn straight(c : vec4<f32>) -> vec4<f32> {
+ if (c.a <= 0.0001) { return vec4<f32>(0.0); }
+ return vec4<f32>(c.rgb / c.a, c.a);
+}
+fn premul(c : vec4<f32>) -> vec4<f32> { return vec4<f32>(c.rgb * c.a, c.a); }
+fn res() -> vec2<f32> { return vec2<f32>(textureDimensions(src)); }
+/** Straight-alpha color of the layer at a uv (filtered). */
+fn sampleS(uv : vec2<f32>) -> vec4<f32> { return straight(textureSampleLevel(src, samp, uv, 0.0)); }
+/** Premultiplied color of the layer at a uv (filtered). */
+fn sampleP(uv : vec2<f32>) -> vec4<f32> { return textureSampleLevel(src, samp, uv, 0.0); }
+/** Straight-alpha color of the layer's texel at a pixel position (nearest). */
+fn texelS(p : vec2<f32>) -> vec4<f32> {
+ let d = vec2<i32>(textureDimensions(src));
+ let q = clamp(vec2<i32>(floor(p)), vec2<i32>(0), d - vec2<i32>(1));
+ return straight(textureLoad(src, q, 0));
+}
+fn luma(c : vec3<f32>) -> f32 { return dot(c, vec3<f32>(0.2126, 0.7152, 0.0722)); }
+fn hash12(p : vec2<f32>) -> f32 {
+ var p3 = fract(vec3<f32>(p.xyx) * 0.1031);
+ p3 += dot(p3, p3.yzx + 33.33);
+ return fract((p3.x + p3.y) * p3.z);
+}
+fn vnoise(p : vec2<f32>) -> f32 {
+ let i = floor(p);
+ let f = fract(p);
+ let u = f * f * (3.0 - 2.0 * f);
+ return mix(mix(hash12(i), hash12(i + vec2<f32>(1.0, 0.0)), u.x),
+ mix(hash12(i + vec2<f32>(0.0, 1.0)), hash12(i + vec2<f32>(1.0, 1.0)), u.x), u.y);
+}
+/** 8x8 ordered-dither threshold, 0..1. */
+fn bayer8(p : vec2<f32>) -> f32 {
+ let x = u32(p.x) & 7u;
+ let y = u32(p.y) & 7u;
+ var v = 0u;
+ for (var k = 0u; k < 3u; k++) {
+ let bx = (x >> k) & 1u;
+ let by = (y >> k) & 1u;
+ let m = ((bx ^ by) << 1u) | by;
+ v += m * (1u << (2u * (2u - k)));
+ }
+ return (f32(v) + 0.5) / 64.0;
+}
+fn rot2(a : f32) -> mat2x2<f32> { let c = cos(a); let s = sin(a); return mat2x2<f32>(c, s, -s, c); }
+@fragment fn fs(in : VSOut) -> @location(0) vec4<f32> {
+ let time = u.v[0].x;
+ let frame = u.v[0].y;
+ let radius = u.v[1].x;
+ let threshold = u.v[1].y;
+ let softness = u.v[1].z;
+
+ let b = textureSampleLevel(prev, samp, in.uv, 0.0);
+ let a = smoothstep(threshold - softness, threshold + softness, b.a);
+ if (b.a <= 0.0001) { return vec4<f32>(0.0); }
+ return vec4<f32>(b.rgb / b.a * a, a);
+}
+`,
+];
+
+const resources = perDevice((device: GPUDevice) => ({
+ layout: fragmentBindGroupLayout(
+ device,
+ ["uniform", "texture", "texture", "sampler"],
+ `${OP}_layout`,
+ ),
+ pipelines: new Map<GPUTextureFormat, GPURenderPipeline[]>(),
+ sampler: device.createSampler({
+ magFilter: "linear",
+ minFilter: "linear",
+ addressModeU: "clamp-to-edge",
+ addressModeV: "clamp-to-edge",
+ }),
+}));
+
+function pipelinesFor(
+ device: GPUDevice,
+ format: GPUTextureFormat,
+): GPURenderPipeline[] {
+ const r = resources(device);
+ let list = r.pipelines.get(format);
+ if (!list) {
+ list = PASSES.map((code, i) => {
+ const module = device.createShaderModule({
+ code,
+ label: `${OP}_${i}.wgsl`,
+ });
+ return device.createRenderPipeline({
+ label: `${OP}_${i}`,
+ layout: device.createPipelineLayout({ bindGroupLayouts: [r.layout] }),
+ vertex: { module, entryPoint: "vs" },
+ fragment: { module, entryPoint: "fs", targets: [{ format }] },
+ primitive: { topology: "triangle-strip" },
+ });
+ });
+ r.pipelines.set(format, list);
+ }
+ return list;
+}
+
+function num(v: unknown, fallback: number): number {
+ const n = typeof v === "number" ? v : Number(v);
+ return Number.isFinite(n) ? n : fallback;
+}
+
+/** Packs the effect's resolved props into the uniform block the shaders read. */
+function pack(
+ raw: Record<string, unknown>,
+ data: Float32Array,
+ time: number,
+ frame: number,
+): void {
+ data.fill(0);
+ data[0] = time;
+ data[1] = frame;
+ data[4] = num(raw.radius, 12);
+ data[5] = num(raw.threshold, 0.5);
+ data[6] = num(raw.softness, 0.04);
+}
+
+export const GooeyWebGPURenderer: WebGPUNodeRenderer = async (args) => {
+ const {
+ ctx,
+ encoder,
+ pass,
+ targetTexture,
+ targetWidth,
+ targetHeight,
+ props,
+ } = args;
+ const op = props.virtualMedia?.operation as
+ | ({
+ op?: string;
+ effect?: {
+ resolveUniforms?: (ctx: unknown) => Record<string, unknown>;
+ };
+ } & Record<string, unknown>)
+ | undefined;
+ if (op?.op !== OP) return;
+ const child = props.virtualMedia?.children?.[0];
+ if (!child) return;
+ pass.end();
+
+ const fps = props.fps || 30;
+ const frame = Math.round(props.compositionFrame ?? props.frame ?? 0);
+ const raw = op.effect?.resolveUniforms
+ ? op.effect.resolveUniforms({ frame, fps, time: frame / fps })
+ : op;
+ const data = new Float32Array(UNIFORM_FLOATS);
+ pack(raw, data, frame / fps, frame);
+
+ const { texture: childTex } = await drawChildToTexture(args, child);
+ const device = ctx.device;
+ const r = resources(device);
+ const pipelines = pipelinesFor(device, ctx.renderer.format);
+ const ubo = ctx.renderer.getTemporaryBuffer(data);
+ let prev = childTex;
+ for (const pipeline of pipelines) {
+ const out = ctx.renderer.getTemporaryTexture(targetWidth, targetHeight, [
+ childTex,
+ prev,
+ targetTexture,
+ ...(props.excludeTextures || []),
+ ]);
+ drawFullscreenPass(encoder, out.createView(), pipeline, [
+ device.createBindGroup({
+ layout: r.layout,
+ entries: [
+ { binding: 0, resource: { buffer: ubo } },
+ { binding: 1, resource: childTex.createView() },
+ { binding: 2, resource: prev.createView() },
+ { binding: 3, resource: r.sampler },
+ ],
+ }),
+ ]);
+ prev = out;
+ }
+ drawTextureToTarget(args, prev);
+};
diff --git a/nodes/node-gooey/src/shared/config.ts b/nodes/node-gooey/src/shared/config.ts
new file mode 100644
index 00000000..a689c453
--- /dev/null
+++ b/nodes/node-gooey/src/shared/config.ts
@@ -0,0 +1,26 @@
+import { configBuilder } from "@framefields/node-sdk";
+import { z } from "zod";
+
+export const gooeyConfig = configBuilder()
+ .field("radius", z.number().min(1).max(60).default(12), {
+ bindable: true,
+ dataTypes: ["Number", "Signal"],
+ label: "radius",
+ description: "Melt distance, px.",
+ })
+ .field("threshold", z.number().min(0).max(1).default(0.5), {
+ bindable: true,
+ dataTypes: ["Number", "Signal"],
+ label: "threshold",
+ description: "Alpha cut, 0\u20131 (higher = thinner blobs).",
+ })
+ .field("softness", z.number().min(0.001).max(0.5).default(0.04), {
+ bindable: true,
+ dataTypes: ["Number", "Signal"],
+ label: "softness",
+ description: "Edge softness.",
+ })
+ .build();
+
+export const GooeyNodeConfigSchema = gooeyConfig.schema;
+export type GooeyNodeConfig = z.infer<typeof GooeyNodeConfigSchema>;
diff --git a/nodes/node-gooey/src/shared/index.ts b/nodes/node-gooey/src/shared/index.ts
new file mode 100644
index 00000000..d1bc97e8
--- /dev/null
+++ b/nodes/node-gooey/src/shared/index.ts
@@ -0,0 +1 @@
+export * from "./config.js";
diff --git a/nodes/node-gooey/tsconfig.json b/nodes/node-gooey/tsconfig.json
new file mode 100644
index 00000000..5a0b963f
--- /dev/null
+++ b/nodes/node-gooey/tsconfig.json
@@ -0,0 +1,12 @@
+{
+ "extends": "@framefields/tsconfig/node-library.json",
+ "compilerOptions": {
+ "baseUrl": ".",
+ "paths": {
+ "@/*": ["./src/*"]
+ },
+ "experimentalDecorators": true,
+ "emitDecoratorMetadata": true
+ },
+ "include": ["src"]
+}
diff --git a/nodes/node-gooey/tsdown.config.ts b/nodes/node-gooey/tsdown.config.ts
new file mode 100644
index 00000000..73f5c2fc
--- /dev/null
+++ b/nodes/node-gooey/tsdown.config.ts
@@ -0,0 +1,13 @@
+import { defineConfig } from "tsdown";
+
+export default defineConfig({
+ entry: {
+ index: "src/index.ts",
+ renderer: "src/renderers/index.ts",
+ },
+ format: ["esm"],
+ dts: true,
+ clean: true,
+ sourcemap: true,
+ treeshake: true,
+});
diff --git a/nodes/node-iridescence/package.json b/nodes/node-iridescence/package.json
new file mode 100644
index 00000000..6e998863
--- /dev/null
+++ b/nodes/node-iridescence/package.json
@@ -0,0 +1,45 @@
+{
+ "name": "@framefields/node-iridescence",
+ "version": "2.2.0",
+ "private": false,
+ "framefields": {
+ "type": "Iridescence",
+ "kind": "effect",
+ "schema": "IridescenceNodeConfigSchema"
+ },
+ "type": "module",
+ "license": "Apache-2.0",
+ "exports": {
+ ".": {
+ "types": "./dist/index.d.mts",
+ "development": "./src/index.ts",
+ "import": "./dist/index.mjs",
+ "default": "./dist/index.mjs"
+ },
+ "./renderer": {
+ "types": "./dist/renderer.d.mts",
+ "development": "./src/renderers/index.ts",
+ "import": "./dist/renderer.mjs",
+ "default": "./dist/renderer.mjs"
+ }
+ },
+ "scripts": {
+ "build": "tsdown",
+ "dev": "tsdown --watch",
+ "clean": "rm -rf dist .turbo"
+ },
+ "dependencies": {
+ "@framefields/node-sdk": "workspace:*",
+ "zod": "^4.3.6"
+ },
+ "devDependencies": {
+ "@framefields/tsconfig": "workspace:*",
+ "@types/node": "^24.1.0",
+ "tsdown": "^0.19.0",
+ "typescript": "^5.8.3",
+ "webgpu": "^0.4.0"
+ },
+ "publishConfig": {
+ "access": "public"
+ }
+}
diff --git a/nodes/node-iridescence/src/index.ts b/nodes/node-iridescence/src/index.ts
new file mode 100644
index 00000000..944d702e
--- /dev/null
+++ b/nodes/node-iridescence/src/index.ts
@@ -0,0 +1,2 @@
+export * from "./renderers/index.js";
+export * from "./shared/index.js";
diff --git a/nodes/node-iridescence/src/renderers/index.ts b/nodes/node-iridescence/src/renderers/index.ts
new file mode 100644
index 00000000..b806ebcb
--- /dev/null
+++ b/nodes/node-iridescence/src/renderers/index.ts
@@ -0,0 +1,7 @@
+import { defineRenderer } from "@framefields/node-sdk/renderer";
+import { IridescenceWebGPURenderer } from "./webgpu-renderer.js";
+
+export default defineRenderer({
+ WebGPURenderer: IridescenceWebGPURenderer,
+});
+export { IridescenceWebGPURenderer };
diff --git a/nodes/node-iridescence/src/renderers/webgpu-renderer.ts b/nodes/node-iridescence/src/renderers/webgpu-renderer.ts
new file mode 100644
index 00000000..5ba9286d
--- /dev/null
+++ b/nodes/node-iridescence/src/renderers/webgpu-renderer.ts
@@ -0,0 +1,222 @@
+/// <reference types="webgpu" />
+/**
+ * Iridescence: Holographic foil: thin-film rainbow colors driven by the layer's brightness or its relief (surface slope), screened over it. Animate `shift` to make the sheen move.
+ */
+import type { WebGPUNodeRenderer } from "@framefields/node-sdk";
+import {
+ drawChildToTexture,
+ drawFullscreenPass,
+ drawTextureToTarget,
+ FULLSCREEN_QUAD_WGSL,
+ fragmentBindGroupLayout,
+ perDevice,
+} from "@framefields/node-sdk/gpu";
+
+const OP = "Iridescence";
+const UNIFORM_FLOATS = 8;
+
+/** One fragment shader per pass; pass 0 reads the layer, later passes read the previous pass. */
+const PASSES = [
+ `struct U { v : array<vec4<f32>, 2> };
+@group(0) @binding(0) var<uniform> u : U;
+@group(0) @binding(1) var src : texture_2d<f32>;
+@group(0) @binding(2) var prev : texture_2d<f32>;
+@group(0) @binding(3) var samp : sampler;
+${FULLSCREEN_QUAD_WGSL}
+
+fn straight(c : vec4<f32>) -> vec4<f32> {
+ if (c.a <= 0.0001) { return vec4<f32>(0.0); }
+ return vec4<f32>(c.rgb / c.a, c.a);
+}
+fn premul(c : vec4<f32>) -> vec4<f32> { return vec4<f32>(c.rgb * c.a, c.a); }
+fn res() -> vec2<f32> { return vec2<f32>(textureDimensions(src)); }
+/** Straight-alpha color of the layer at a uv (filtered). */
+fn sampleS(uv : vec2<f32>) -> vec4<f32> { return straight(textureSampleLevel(src, samp, uv, 0.0)); }
+/** Premultiplied color of the layer at a uv (filtered). */
+fn sampleP(uv : vec2<f32>) -> vec4<f32> { return textureSampleLevel(src, samp, uv, 0.0); }
+/** Straight-alpha color of the layer's texel at a pixel position (nearest). */
+fn texelS(p : vec2<f32>) -> vec4<f32> {
+ let d = vec2<i32>(textureDimensions(src));
+ let q = clamp(vec2<i32>(floor(p)), vec2<i32>(0), d - vec2<i32>(1));
+ return straight(textureLoad(src, q, 0));
+}
+fn luma(c : vec3<f32>) -> f32 { return dot(c, vec3<f32>(0.2126, 0.7152, 0.0722)); }
+fn hash12(p : vec2<f32>) -> f32 {
+ var p3 = fract(vec3<f32>(p.xyx) * 0.1031);
+ p3 += dot(p3, p3.yzx + 33.33);
+ return fract((p3.x + p3.y) * p3.z);
+}
+fn vnoise(p : vec2<f32>) -> f32 {
+ let i = floor(p);
+ let f = fract(p);
+ let u = f * f * (3.0 - 2.0 * f);
+ return mix(mix(hash12(i), hash12(i + vec2<f32>(1.0, 0.0)), u.x),
+ mix(hash12(i + vec2<f32>(0.0, 1.0)), hash12(i + vec2<f32>(1.0, 1.0)), u.x), u.y);
+}
+/** 8x8 ordered-dither threshold, 0..1. */
+fn bayer8(p : vec2<f32>) -> f32 {
+ let x = u32(p.x) & 7u;
+ let y = u32(p.y) & 7u;
+ var v = 0u;
+ for (var k = 0u; k < 3u; k++) {
+ let bx = (x >> k) & 1u;
+ let by = (y >> k) & 1u;
+ let m = ((bx ^ by) << 1u) | by;
+ v += m * (1u << (2u * (2u - k)));
+ }
+ return (f32(v) + 0.5) / 64.0;
+}
+fn rot2(a : f32) -> mat2x2<f32> { let c = cos(a); let s = sin(a); return mat2x2<f32>(c, s, -s, c); }
+@fragment fn fs(in : VSOut) -> @location(0) vec4<f32> {
+ let time = u.v[0].x;
+ let frame = u.v[0].y;
+ let strength = u.v[1].x;
+ let scale = u.v[1].y;
+ let shift = u.v[1].z;
+ let mode = u32(u.v[1].w + 0.5);
+
+ let R = res();
+ let c = sampleS(in.uv);
+ let l = luma(c.rgb);
+ var phase = l;
+ var amount = strength;
+ if (mode == 1u) {
+ let o = 5.0 / R;
+ let gx = luma(sampleS(in.uv + vec2<f32>(o.x, 0.0)).rgb) - luma(sampleS(in.uv - vec2<f32>(o.x, 0.0)).rgb);
+ let gy = luma(sampleS(in.uv + vec2<f32>(0.0, o.y)).rgb) - luma(sampleS(in.uv - vec2<f32>(0.0, o.y)).rgb);
+ let n = normalize(vec3<f32>(-gx * 3.0, -gy * 3.0, 1.0));
+ let slope = 1.0 - n.z;
+ phase = slope * 3.0 + l * 0.6 + in.uv.x * 0.4 + in.uv.y * 0.3;
+ amount = strength * clamp(0.3 + slope * 6.0, 0.0, 1.0);
+ }
+ phase = phase * scale + shift / 360.0;
+ let rainbow = 0.5 + 0.5 * cos(6.2831853 * (phase + vec3<f32>(0.0, 0.33, 0.67)));
+ let screened = vec3<f32>(1.0) - (vec3<f32>(1.0) - c.rgb) * (vec3<f32>(1.0) - rainbow * 0.85);
+ return premul(vec4<f32>(mix(c.rgb, screened, amount), c.a));
+}
+`,
+];
+
+const resources = perDevice((device: GPUDevice) => ({
+ layout: fragmentBindGroupLayout(
+ device,
+ ["uniform", "texture", "texture", "sampler"],
+ `${OP}_layout`,
+ ),
+ pipelines: new Map<GPUTextureFormat, GPURenderPipeline[]>(),
+ sampler: device.createSampler({
+ magFilter: "linear",
+ minFilter: "linear",
+ addressModeU: "clamp-to-edge",
+ addressModeV: "clamp-to-edge",
+ }),
+}));
+
+function pipelinesFor(
+ device: GPUDevice,
+ format: GPUTextureFormat,
+): GPURenderPipeline[] {
+ const r = resources(device);
+ let list = r.pipelines.get(format);
+ if (!list) {
+ list = PASSES.map((code, i) => {
+ const module = device.createShaderModule({
+ code,
+ label: `${OP}_${i}.wgsl`,
+ });
+ return device.createRenderPipeline({
+ label: `${OP}_${i}`,
+ layout: device.createPipelineLayout({ bindGroupLayouts: [r.layout] }),
+ vertex: { module, entryPoint: "vs" },
+ fragment: { module, entryPoint: "fs", targets: [{ format }] },
+ primitive: { topology: "triangle-strip" },
+ });
+ });
+ r.pipelines.set(format, list);
+ }
+ return list;
+}
+
+function num(v: unknown, fallback: number): number {
+ const n = typeof v === "number" ? v : Number(v);
+ return Number.isFinite(n) ? n : fallback;
+}
+
+/** Packs the effect's resolved props into the uniform block the shaders read. */
+function pack(
+ raw: Record<string, unknown>,
+ data: Float32Array,
+ time: number,
+ frame: number,
+): void {
+ data.fill(0);
+ data[0] = time;
+ data[1] = frame;
+ data[4] = num(raw.strength, 0.6);
+ data[5] = num(raw.scale, 2);
+ data[6] = num(raw.shift, 0);
+ data[7] = Math.max(
+ 0,
+ ["luminance", "relief"].indexOf(String(raw.mode ?? "relief")),
+ );
+}
+
+export const IridescenceWebGPURenderer: WebGPUNodeRenderer = async (args) => {
+ const {
+ ctx,
+ encoder,
+ pass,
+ targetTexture,
+ targetWidth,
+ targetHeight,
+ props,
+ } = args;
+ const op = props.virtualMedia?.operation as
+ | ({
+ op?: string;
+ effect?: {
+ resolveUniforms?: (ctx: unknown) => Record<string, unknown>;
+ };
+ } & Record<string, unknown>)
+ | undefined;
+ if (op?.op !== OP) return;
+ const child = props.virtualMedia?.children?.[0];
+ if (!child) return;
+ pass.end();
+
+ const fps = props.fps || 30;
+ const frame = Math.round(props.compositionFrame ?? props.frame ?? 0);
+ const raw = op.effect?.resolveUniforms
+ ? op.effect.resolveUniforms({ frame, fps, time: frame / fps })
+ : op;
+ const data = new Float32Array(UNIFORM_FLOATS);
+ pack(raw, data, frame / fps, frame);
+
+ const { texture: childTex } = await drawChildToTexture(args, child);
+ const device = ctx.device;
+ const r = resources(device);
+ const pipelines = pipelinesFor(device, ctx.renderer.format);
+ const ubo = ctx.renderer.getTemporaryBuffer(data);
+ let prev = childTex;
+ for (const pipeline of pipelines) {
+ const out = ctx.renderer.getTemporaryTexture(targetWidth, targetHeight, [
+ childTex,
+ prev,
+ targetTexture,
+ ...(props.excludeTextures || []),
+ ]);
+ drawFullscreenPass(encoder, out.createView(), pipeline, [
+ device.createBindGroup({
+ layout: r.layout,
+ entries: [
+ { binding: 0, resource: { buffer: ubo } },
+ { binding: 1, resource: childTex.createView() },
+ { binding: 2, resource: prev.createView() },
+ { binding: 3, resource: r.sampler },
+ ],
+ }),
+ ]);
+ prev = out;
+ }
+ drawTextureToTarget(args, prev);
+};
diff --git a/nodes/node-iridescence/src/shared/config.ts b/nodes/node-iridescence/src/shared/config.ts
new file mode 100644
index 00000000..9798f13c
--- /dev/null
+++ b/nodes/node-iridescence/src/shared/config.ts
@@ -0,0 +1,32 @@
+import { configBuilder } from "@framefields/node-sdk";
+import { z } from "zod";
+
+export const iridescenceConfig = configBuilder()
+ .field("strength", z.number().min(0).max(1).default(0.6), {
+ bindable: true,
+ dataTypes: ["Number", "Signal"],
+ label: "strength",
+ description: "How much rainbow, 0\u20131.",
+ })
+ .field("scale", z.number().min(0.1).max(10).default(2), {
+ bindable: true,
+ dataTypes: ["Number", "Signal"],
+ label: "scale",
+ description: "Rainbow bands over the range.",
+ })
+ .field("shift", z.number().min(-3600).max(3600).default(0), {
+ bindable: true,
+ dataTypes: ["Number", "Signal"],
+ label: "shift",
+ description: "Hue shift, degrees (animate it).",
+ })
+ .field("mode", z.enum(["luminance", "relief"]).default("relief"), {
+ bindable: false,
+ label: "mode",
+ description:
+ "Bands from brightness, or from the slope of the image (foil).",
+ })
+ .build();
+
+export const IridescenceNodeConfigSchema = iridescenceConfig.schema;
+export type IridescenceNodeConfig = z.infer<typeof IridescenceNodeConfigSchema>;
diff --git a/nodes/node-iridescence/src/shared/index.ts b/nodes/node-iridescence/src/shared/index.ts
new file mode 100644
index 00000000..d1bc97e8
--- /dev/null
+++ b/nodes/node-iridescence/src/shared/index.ts
@@ -0,0 +1 @@
+export * from "./config.js";
diff --git a/nodes/node-iridescence/tsconfig.json b/nodes/node-iridescence/tsconfig.json
new file mode 100644
index 00000000..5a0b963f
--- /dev/null
+++ b/nodes/node-iridescence/tsconfig.json
@@ -0,0 +1,12 @@
+{
+ "extends": "@framefields/tsconfig/node-library.json",
+ "compilerOptions": {
+ "baseUrl": ".",
+ "paths": {
+ "@/*": ["./src/*"]
+ },
+ "experimentalDecorators": true,
+ "emitDecoratorMetadata": true
+ },
+ "include": ["src"]
+}
diff --git a/nodes/node-iridescence/tsdown.config.ts b/nodes/node-iridescence/tsdown.config.ts
new file mode 100644
index 00000000..73f5c2fc
--- /dev/null
+++ b/nodes/node-iridescence/tsdown.config.ts
@@ -0,0 +1,13 @@
+import { defineConfig } from "tsdown";
+
+export default defineConfig({
+ entry: {
+ index: "src/index.ts",
+ renderer: "src/renderers/index.ts",
+ },
+ format: ["esm"],
+ dts: true,
+ clean: true,
+ sourcemap: true,
+ treeshake: true,
+});
diff --git a/nodes/node-kaleidoscope/package.json b/nodes/node-kaleidoscope/package.json
new file mode 100644
index 00000000..d6cd22d5
--- /dev/null
+++ b/nodes/node-kaleidoscope/package.json
@@ -0,0 +1,45 @@
+{
+ "name": "@framefields/node-kaleidoscope",
+ "version": "2.2.0",
+ "private": false,
+ "framefields": {
+ "type": "Kaleidoscope",
+ "kind": "effect",
+ "schema": "KaleidoscopeNodeConfigSchema"
+ },
+ "type": "module",
+ "license": "Apache-2.0",
+ "exports": {
+ ".": {
+ "types": "./dist/index.d.mts",
+ "development": "./src/index.ts",
+ "import": "./dist/index.mjs",
+ "default": "./dist/index.mjs"
+ },
+ "./renderer": {
+ "types": "./dist/renderer.d.mts",
+ "development": "./src/renderers/index.ts",
+ "import": "./dist/renderer.mjs",
+ "default": "./dist/renderer.mjs"
+ }
+ },
+ "scripts": {
+ "build": "tsdown",
+ "dev": "tsdown --watch",
+ "clean": "rm -rf dist .turbo"
+ },
+ "dependencies": {
+ "@framefields/node-sdk": "workspace:*",
+ "zod": "^4.3.6"
+ },
+ "devDependencies": {
+ "@framefields/tsconfig": "workspace:*",
+ "@types/node": "^24.1.0",
+ "tsdown": "^0.19.0",
+ "typescript": "^5.8.3",
+ "webgpu": "^0.4.0"
+ },
+ "publishConfig": {
+ "access": "public"
+ }
+}
diff --git a/nodes/node-kaleidoscope/src/index.ts b/nodes/node-kaleidoscope/src/index.ts
new file mode 100644
index 00000000..944d702e
--- /dev/null
+++ b/nodes/node-kaleidoscope/src/index.ts
@@ -0,0 +1,2 @@
+export * from "./renderers/index.js";
+export * from "./shared/index.js";
diff --git a/nodes/node-kaleidoscope/src/renderers/index.ts b/nodes/node-kaleidoscope/src/renderers/index.ts
new file mode 100644
index 00000000..c5179be7
--- /dev/null
+++ b/nodes/node-kaleidoscope/src/renderers/index.ts
@@ -0,0 +1,7 @@
+import { defineRenderer } from "@framefields/node-sdk/renderer";
+import { KaleidoscopeWebGPURenderer } from "./webgpu-renderer.js";
+
+export default defineRenderer({
+ WebGPURenderer: KaleidoscopeWebGPURenderer,
+});
+export { KaleidoscopeWebGPURenderer };
diff --git a/nodes/node-kaleidoscope/src/renderers/webgpu-renderer.ts b/nodes/node-kaleidoscope/src/renderers/webgpu-renderer.ts
new file mode 100644
index 00000000..4dced0ab
--- /dev/null
+++ b/nodes/node-kaleidoscope/src/renderers/webgpu-renderer.ts
@@ -0,0 +1,219 @@
+/// <reference types="webgpu" />
+/**
+ * Kaleidoscope: Mirror segments around a center: the layer folded into a kaleidoscope. Animate `rotation` (and `zoom`) for the classic turning pattern.
+ */
+import type { WebGPUNodeRenderer } from "@framefields/node-sdk";
+import {
+ drawChildToTexture,
+ drawFullscreenPass,
+ drawTextureToTarget,
+ FULLSCREEN_QUAD_WGSL,
+ fragmentBindGroupLayout,
+ perDevice,
+} from "@framefields/node-sdk/gpu";
+
+const OP = "Kaleidoscope";
+const UNIFORM_FLOATS = 12;
+
+/** One fragment shader per pass; pass 0 reads the layer, later passes read the previous pass. */
+const PASSES = [
+ `struct U { v : array<vec4<f32>, 3> };
+@group(0) @binding(0) var<uniform> u : U;
+@group(0) @binding(1) var src : texture_2d<f32>;
+@group(0) @binding(2) var prev : texture_2d<f32>;
+@group(0) @binding(3) var samp : sampler;
+${FULLSCREEN_QUAD_WGSL}
+
+fn straight(c : vec4<f32>) -> vec4<f32> {
+ if (c.a <= 0.0001) { return vec4<f32>(0.0); }
+ return vec4<f32>(c.rgb / c.a, c.a);
+}
+fn premul(c : vec4<f32>) -> vec4<f32> { return vec4<f32>(c.rgb * c.a, c.a); }
+fn res() -> vec2<f32> { return vec2<f32>(textureDimensions(src)); }
+/** Straight-alpha color of the layer at a uv (filtered). */
+fn sampleS(uv : vec2<f32>) -> vec4<f32> { return straight(textureSampleLevel(src, samp, uv, 0.0)); }
+/** Premultiplied color of the layer at a uv (filtered). */
+fn sampleP(uv : vec2<f32>) -> vec4<f32> { return textureSampleLevel(src, samp, uv, 0.0); }
+/** Straight-alpha color of the layer's texel at a pixel position (nearest). */
+fn texelS(p : vec2<f32>) -> vec4<f32> {
+ let d = vec2<i32>(textureDimensions(src));
+ let q = clamp(vec2<i32>(floor(p)), vec2<i32>(0), d - vec2<i32>(1));
+ return straight(textureLoad(src, q, 0));
+}
+fn luma(c : vec3<f32>) -> f32 { return dot(c, vec3<f32>(0.2126, 0.7152, 0.0722)); }
+fn hash12(p : vec2<f32>) -> f32 {
+ var p3 = fract(vec3<f32>(p.xyx) * 0.1031);
+ p3 += dot(p3, p3.yzx + 33.33);
+ return fract((p3.x + p3.y) * p3.z);
+}
+fn vnoise(p : vec2<f32>) -> f32 {
+ let i = floor(p);
+ let f = fract(p);
+ let u = f * f * (3.0 - 2.0 * f);
+ return mix(mix(hash12(i), hash12(i + vec2<f32>(1.0, 0.0)), u.x),
+ mix(hash12(i + vec2<f32>(0.0, 1.0)), hash12(i + vec2<f32>(1.0, 1.0)), u.x), u.y);
+}
+/** 8x8 ordered-dither threshold, 0..1. */
+fn bayer8(p : vec2<f32>) -> f32 {
+ let x = u32(p.x) & 7u;
+ let y = u32(p.y) & 7u;
+ var v = 0u;
+ for (var k = 0u; k < 3u; k++) {
+ let bx = (x >> k) & 1u;
+ let by = (y >> k) & 1u;
+ let m = ((bx ^ by) << 1u) | by;
+ v += m * (1u << (2u * (2u - k)));
+ }
+ return (f32(v) + 0.5) / 64.0;
+}
+fn rot2(a : f32) -> mat2x2<f32> { let c = cos(a); let s = sin(a); return mat2x2<f32>(c, s, -s, c); }
+@fragment fn fs(in : VSOut) -> @location(0) vec4<f32> {
+ let time = u.v[0].x;
+ let frame = u.v[0].y;
+ let segments = u.v[1].x;
+ let rotation = u.v[1].y;
+ let centerX = u.v[1].z;
+ let centerY = u.v[1].w;
+ let zoom = u.v[2].x;
+
+ let R = res();
+ let aspect = R.x / R.y;
+ let center = vec2<f32>(centerX, centerY);
+ var p = in.uv - center;
+ p.x *= aspect;
+ let rad = length(p) / zoom;
+ let rot = radians(rotation);
+ let seg = 6.2831853 / segments;
+ var a = atan2(p.y, p.x) - rot;
+ a = a - seg * floor(a / seg);
+ a = min(a, seg - a);
+ var q = vec2<f32>(cos(a + rot), sin(a + rot)) * rad;
+ q.x /= aspect;
+ let uv = q + center;
+ let m = vec2<f32>(1.0) - abs(fract(uv * 0.5) * 2.0 - vec2<f32>(1.0));
+ return sampleP(m);
+}
+`,
+];
+
+const resources = perDevice((device: GPUDevice) => ({
+ layout: fragmentBindGroupLayout(
+ device,
+ ["uniform", "texture", "texture", "sampler"],
+ `${OP}_layout`,
+ ),
+ pipelines: new Map<GPUTextureFormat, GPURenderPipeline[]>(),
+ sampler: device.createSampler({
+ magFilter: "linear",
+ minFilter: "linear",
+ addressModeU: "clamp-to-edge",
+ addressModeV: "clamp-to-edge",
+ }),
+}));
+
+function pipelinesFor(
+ device: GPUDevice,
+ format: GPUTextureFormat,
+): GPURenderPipeline[] {
+ const r = resources(device);
+ let list = r.pipelines.get(format);
+ if (!list) {
+ list = PASSES.map((code, i) => {
+ const module = device.createShaderModule({
+ code,
+ label: `${OP}_${i}.wgsl`,
+ });
+ return device.createRenderPipeline({
+ label: `${OP}_${i}`,
+ layout: device.createPipelineLayout({ bindGroupLayouts: [r.layout] }),
+ vertex: { module, entryPoint: "vs" },
+ fragment: { module, entryPoint: "fs", targets: [{ format }] },
+ primitive: { topology: "triangle-strip" },
+ });
+ });
+ r.pipelines.set(format, list);
+ }
+ return list;
+}
+
+function num(v: unknown, fallback: number): number {
+ const n = typeof v === "number" ? v : Number(v);
+ return Number.isFinite(n) ? n : fallback;
+}
+
+/** Packs the effect's resolved props into the uniform block the shaders read. */
+function pack(
+ raw: Record<string, unknown>,
+ data: Float32Array,
+ time: number,
+ frame: number,
+): void {
+ data.fill(0);
+ data[0] = time;
+ data[1] = frame;
+ data[4] = num(raw.segments, 6);
+ data[5] = num(raw.rotation, 0);
+ data[6] = num(raw.centerX, 0.5);
+ data[7] = num(raw.centerY, 0.5);
+ data[8] = num(raw.zoom, 1);
+}
+
+export const KaleidoscopeWebGPURenderer: WebGPUNodeRenderer = async (args) => {
+ const {
+ ctx,
+ encoder,
+ pass,
+ targetTexture,
+ targetWidth,
+ targetHeight,
+ props,
+ } = args;
+ const op = props.virtualMedia?.operation as
+ | ({
+ op?: string;
+ effect?: {
+ resolveUniforms?: (ctx: unknown) => Record<string, unknown>;
+ };
+ } & Record<string, unknown>)
+ | undefined;
+ if (op?.op !== OP) return;
+ const child = props.virtualMedia?.children?.[0];
+ if (!child) return;
+ pass.end();
+
+ const fps = props.fps || 30;
+ const frame = Math.round(props.compositionFrame ?? props.frame ?? 0);
+ const raw = op.effect?.resolveUniforms
+ ? op.effect.resolveUniforms({ frame, fps, time: frame / fps })
+ : op;
+ const data = new Float32Array(UNIFORM_FLOATS);
+ pack(raw, data, frame / fps, frame);
+
+ const { texture: childTex } = await drawChildToTexture(args, child);
+ const device = ctx.device;
+ const r = resources(device);
+ const pipelines = pipelinesFor(device, ctx.renderer.format);
+ const ubo = ctx.renderer.getTemporaryBuffer(data);
+ let prev = childTex;
+ for (const pipeline of pipelines) {
+ const out = ctx.renderer.getTemporaryTexture(targetWidth, targetHeight, [
+ childTex,
+ prev,
+ targetTexture,
+ ...(props.excludeTextures || []),
+ ]);
+ drawFullscreenPass(encoder, out.createView(), pipeline, [
+ device.createBindGroup({
+ layout: r.layout,
+ entries: [
+ { binding: 0, resource: { buffer: ubo } },
+ { binding: 1, resource: childTex.createView() },
+ { binding: 2, resource: prev.createView() },
+ { binding: 3, resource: r.sampler },
+ ],
+ }),
+ ]);
+ prev = out;
+ }
+ drawTextureToTarget(args, prev);
+};
diff --git a/nodes/node-kaleidoscope/src/shared/config.ts b/nodes/node-kaleidoscope/src/shared/config.ts
new file mode 100644
index 00000000..e9830a63
--- /dev/null
+++ b/nodes/node-kaleidoscope/src/shared/config.ts
@@ -0,0 +1,40 @@
+import { configBuilder } from "@framefields/node-sdk";
+import { z } from "zod";
+
+export const kaleidoscopeConfig = configBuilder()
+ .field("segments", z.number().int().min(2).max(32).default(6), {
+ bindable: true,
+ dataTypes: ["Number", "Signal"],
+ label: "segments",
+ description: "Mirror segments.",
+ })
+ .field("rotation", z.number().min(-3600).max(3600).default(0), {
+ bindable: true,
+ dataTypes: ["Number", "Signal"],
+ label: "rotation",
+ description: "Pattern rotation, degrees.",
+ })
+ .field("centerX", z.number().min(0).max(1).default(0.5), {
+ bindable: true,
+ dataTypes: ["Number", "Signal"],
+ label: "centerX",
+ description: "Center, 0\u20131 across.",
+ })
+ .field("centerY", z.number().min(0).max(1).default(0.5), {
+ bindable: true,
+ dataTypes: ["Number", "Signal"],
+ label: "centerY",
+ description: "Center, 0\u20131 down.",
+ })
+ .field("zoom", z.number().min(0.2).max(4).default(1), {
+ bindable: true,
+ dataTypes: ["Number", "Signal"],
+ label: "zoom",
+ description: "Scale of the folded image.",
+ })
+ .build();
+
+export const KaleidoscopeNodeConfigSchema = kaleidoscopeConfig.schema;
+export type KaleidoscopeNodeConfig = z.infer<
+ typeof KaleidoscopeNodeConfigSchema
+>;
diff --git a/nodes/node-kaleidoscope/src/shared/index.ts b/nodes/node-kaleidoscope/src/shared/index.ts
new file mode 100644
index 00000000..d1bc97e8
--- /dev/null
+++ b/nodes/node-kaleidoscope/src/shared/index.ts
@@ -0,0 +1 @@
+export * from "./config.js";
diff --git a/nodes/node-kaleidoscope/tsconfig.json b/nodes/node-kaleidoscope/tsconfig.json
new file mode 100644
index 00000000..5a0b963f
--- /dev/null
+++ b/nodes/node-kaleidoscope/tsconfig.json
@@ -0,0 +1,12 @@
+{
+ "extends": "@framefields/tsconfig/node-library.json",
+ "compilerOptions": {
+ "baseUrl": ".",
+ "paths": {
+ "@/*": ["./src/*"]
+ },
+ "experimentalDecorators": true,
+ "emitDecoratorMetadata": true
+ },
+ "include": ["src"]
+}
diff --git a/nodes/node-kaleidoscope/tsdown.config.ts b/nodes/node-kaleidoscope/tsdown.config.ts
new file mode 100644
index 00000000..73f5c2fc
--- /dev/null
+++ b/nodes/node-kaleidoscope/tsdown.config.ts
@@ -0,0 +1,13 @@
+import { defineConfig } from "tsdown";
+
+export default defineConfig({
+ entry: {
+ index: "src/index.ts",
+ renderer: "src/renderers/index.ts",
+ },
+ format: ["esm"],
+ dts: true,
+ clean: true,
+ sourcemap: true,
+ treeshake: true,
+});
diff --git a/nodes/node-op-art/package.json b/nodes/node-op-art/package.json
new file mode 100644
index 00000000..5dbc0ea1
--- /dev/null
+++ b/nodes/node-op-art/package.json
@@ -0,0 +1,45 @@
+{
+ "name": "@framefields/node-op-art",
+ "version": "2.2.0",
+ "private": false,
+ "framefields": {
+ "type": "OpArt",
+ "kind": "effect",
+ "schema": "OpArtNodeConfigSchema"
+ },
+ "type": "module",
+ "license": "Apache-2.0",
+ "exports": {
+ ".": {
+ "types": "./dist/index.d.mts",
+ "development": "./src/index.ts",
+ "import": "./dist/index.mjs",
+ "default": "./dist/index.mjs"
+ },
+ "./renderer": {
+ "types": "./dist/renderer.d.mts",
+ "development": "./src/renderers/index.ts",
+ "import": "./dist/renderer.mjs",
+ "default": "./dist/renderer.mjs"
+ }
+ },
+ "scripts": {
+ "build": "tsdown",
+ "dev": "tsdown --watch",
+ "clean": "rm -rf dist .turbo"
+ },
+ "dependencies": {
+ "@framefields/node-sdk": "workspace:*",
+ "zod": "^4.3.6"
+ },
+ "devDependencies": {
+ "@framefields/tsconfig": "workspace:*",
+ "@types/node": "^24.1.0",
+ "tsdown": "^0.19.0",
+ "typescript": "^5.8.3",
+ "webgpu": "^0.4.0"
+ },
+ "publishConfig": {
+ "access": "public"
+ }
+}
diff --git a/nodes/node-op-art/src/index.ts b/nodes/node-op-art/src/index.ts
new file mode 100644
index 00000000..944d702e
--- /dev/null
+++ b/nodes/node-op-art/src/index.ts
@@ -0,0 +1,2 @@
+export * from "./renderers/index.js";
+export * from "./shared/index.js";
diff --git a/nodes/node-op-art/src/renderers/index.ts b/nodes/node-op-art/src/renderers/index.ts
new file mode 100644
index 00000000..807c0895
--- /dev/null
+++ b/nodes/node-op-art/src/renderers/index.ts
@@ -0,0 +1,7 @@
+import { defineRenderer } from "@framefields/node-sdk/renderer";
+import { OpArtWebGPURenderer } from "./webgpu-renderer.js";
+
+export default defineRenderer({
+ WebGPURenderer: OpArtWebGPURenderer,
+});
+export { OpArtWebGPURenderer };
diff --git a/nodes/node-op-art/src/renderers/webgpu-renderer.ts b/nodes/node-op-art/src/renderers/webgpu-renderer.ts
new file mode 100644
index 00000000..f821240a
--- /dev/null
+++ b/nodes/node-op-art/src/renderers/webgpu-renderer.ts
@@ -0,0 +1,247 @@
+/// <reference types="webgpu" />
+/**
+ * Op art: Optical art from the layer: stripes, rings, checks or waves whose lines bend with the image's brightness and thicken in its darks — line-art portraits and Bridget Riley warps.
+ */
+import type { WebGPUNodeRenderer } from "@framefields/node-sdk";
+import {
+ drawChildToTexture,
+ drawFullscreenPass,
+ drawTextureToTarget,
+ FULLSCREEN_QUAD_WGSL,
+ fragmentBindGroupLayout,
+ perDevice,
+} from "@framefields/node-sdk/gpu";
+
+const OP = "OpArt";
+const UNIFORM_FLOATS = 20;
+
+/** One fragment shader per pass; pass 0 reads the layer, later passes read the previous pass. */
+const PASSES = [
+ `struct U { v : array<vec4<f32>, 5> };
+@group(0) @binding(0) var<uniform> u : U;
+@group(0) @binding(1) var src : texture_2d<f32>;
+@group(0) @binding(2) var prev : texture_2d<f32>;
+@group(0) @binding(3) var samp : sampler;
+${FULLSCREEN_QUAD_WGSL}
+
+fn straight(c : vec4<f32>) -> vec4<f32> {
+ if (c.a <= 0.0001) { return vec4<f32>(0.0); }
+ return vec4<f32>(c.rgb / c.a, c.a);
+}
+fn premul(c : vec4<f32>) -> vec4<f32> { return vec4<f32>(c.rgb * c.a, c.a); }
+fn res() -> vec2<f32> { return vec2<f32>(textureDimensions(src)); }
+/** Straight-alpha color of the layer at a uv (filtered). */
+fn sampleS(uv : vec2<f32>) -> vec4<f32> { return straight(textureSampleLevel(src, samp, uv, 0.0)); }
+/** Premultiplied color of the layer at a uv (filtered). */
+fn sampleP(uv : vec2<f32>) -> vec4<f32> { return textureSampleLevel(src, samp, uv, 0.0); }
+/** Straight-alpha color of the layer's texel at a pixel position (nearest). */
+fn texelS(p : vec2<f32>) -> vec4<f32> {
+ let d = vec2<i32>(textureDimensions(src));
+ let q = clamp(vec2<i32>(floor(p)), vec2<i32>(0), d - vec2<i32>(1));
+ return straight(textureLoad(src, q, 0));
+}
+fn luma(c : vec3<f32>) -> f32 { return dot(c, vec3<f32>(0.2126, 0.7152, 0.0722)); }
+fn hash12(p : vec2<f32>) -> f32 {
+ var p3 = fract(vec3<f32>(p.xyx) * 0.1031);
+ p3 += dot(p3, p3.yzx + 33.33);
+ return fract((p3.x + p3.y) * p3.z);
+}
+fn vnoise(p : vec2<f32>) -> f32 {
+ let i = floor(p);
+ let f = fract(p);
+ let u = f * f * (3.0 - 2.0 * f);
+ return mix(mix(hash12(i), hash12(i + vec2<f32>(1.0, 0.0)), u.x),
+ mix(hash12(i + vec2<f32>(0.0, 1.0)), hash12(i + vec2<f32>(1.0, 1.0)), u.x), u.y);
+}
+/** 8x8 ordered-dither threshold, 0..1. */
+fn bayer8(p : vec2<f32>) -> f32 {
+ let x = u32(p.x) & 7u;
+ let y = u32(p.y) & 7u;
+ var v = 0u;
+ for (var k = 0u; k < 3u; k++) {
+ let bx = (x >> k) & 1u;
+ let by = (y >> k) & 1u;
+ let m = ((bx ^ by) << 1u) | by;
+ v += m * (1u << (2u * (2u - k)));
+ }
+ return (f32(v) + 0.5) / 64.0;
+}
+fn rot2(a : f32) -> mat2x2<f32> { let c = cos(a); let s = sin(a); return mat2x2<f32>(c, s, -s, c); }
+@fragment fn fs(in : VSOut) -> @location(0) vec4<f32> {
+ let time = u.v[0].x;
+ let frame = u.v[0].y;
+ let pattern = u32(u.v[1].x + 0.5);
+ let frequency = u.v[1].y;
+ let angle = u.v[1].z;
+ let warp = u.v[1].w;
+ let source = u.v[2].x;
+ let colorA = u.v[3];
+ let colorB = u.v[4];
+
+ let R = res();
+ let c = sampleS(in.uv);
+ let l = luma(c.rgb) * c.a + (1.0 - c.a);
+ var p = (in.uv - 0.5) * vec2<f32>(R.x / R.y, 1.0);
+ p = rot2(radians(angle)) * p;
+ var v = p.y * frequency;
+ if (pattern == 1u) { v = length(p) * frequency; }
+ if (pattern == 3u) { v = p.y * frequency + sin(p.x * frequency * 0.25) * 2.0; }
+ v += (1.0 - l) * warp * 3.0;
+ var v2 = p.x * frequency + (1.0 - l) * warp * 3.0;
+ let duty = mix(0.5, clamp(1.0 - l, 0.05, 0.95), source);
+ let e = max(fwidth(v), 1e-4);
+ let e2 = max(fwidth(v2), 1e-4);
+ let s = fract(v);
+ var ink = smoothstep(duty + e, duty - e, s) * smoothstep(-e, e, s);
+ if (pattern == 2u) {
+ let s2 = fract(v2);
+ let a = step(0.5, s);
+ let b = step(0.5, s2);
+ ink = abs(a - b);
+ ink = mix(ink, 1.0 - ink, step(duty, 0.5) * 0.0);
+ let edgeA = smoothstep(0.0, e, min(s, 1.0 - s)) * smoothstep(0.0, e, abs(s - 0.5));
+ let edgeB = smoothstep(0.0, e2, min(s2, 1.0 - s2)) * smoothstep(0.0, e2, abs(s2 - 0.5));
+ ink = mix(0.5, ink, edgeA * edgeB);
+ }
+ return vec4<f32>(mix(colorB.rgb, colorA.rgb, ink), 1.0);
+}
+`,
+];
+
+const resources = perDevice((device: GPUDevice) => ({
+ layout: fragmentBindGroupLayout(
+ device,
+ ["uniform", "texture", "texture", "sampler"],
+ `${OP}_layout`,
+ ),
+ pipelines: new Map<GPUTextureFormat, GPURenderPipeline[]>(),
+ sampler: device.createSampler({
+ magFilter: "linear",
+ minFilter: "linear",
+ addressModeU: "clamp-to-edge",
+ addressModeV: "clamp-to-edge",
+ }),
+}));
+
+function pipelinesFor(
+ device: GPUDevice,
+ format: GPUTextureFormat,
+): GPURenderPipeline[] {
+ const r = resources(device);
+ let list = r.pipelines.get(format);
+ if (!list) {
+ list = PASSES.map((code, i) => {
+ const module = device.createShaderModule({
+ code,
+ label: `${OP}_${i}.wgsl`,
+ });
+ return device.createRenderPipeline({
+ label: `${OP}_${i}`,
+ layout: device.createPipelineLayout({ bindGroupLayouts: [r.layout] }),
+ vertex: { module, entryPoint: "vs" },
+ fragment: { module, entryPoint: "fs", targets: [{ format }] },
+ primitive: { topology: "triangle-strip" },
+ });
+ });
+ r.pipelines.set(format, list);
+ }
+ return list;
+}
+
+function num(v: unknown, fallback: number): number {
+ const n = typeof v === "number" ? v : Number(v);
+ return Number.isFinite(n) ? n : fallback;
+}
+
+function hexToRgba(hex: string): [number, number, number, number] {
+ let h = hex.trim().replace("#", "");
+ if (h.length === 3 || h.length === 4) {
+ h = [...h].map((c) => c + c).join("");
+ }
+ const n = (i: number) => Number.parseInt(h.slice(i, i + 2), 16) / 255;
+ return [n(0), n(2), n(4), h.length >= 8 ? n(6) : 1];
+}
+
+/** Packs the effect's resolved props into the uniform block the shaders read. */
+function pack(
+ raw: Record<string, unknown>,
+ data: Float32Array,
+ time: number,
+ frame: number,
+): void {
+ data.fill(0);
+ data[0] = time;
+ data[1] = frame;
+ data[4] = Math.max(
+ 0,
+ ["stripes", "rings", "checker", "waves"].indexOf(
+ String(raw.pattern ?? "stripes"),
+ ),
+ );
+ data[5] = num(raw.frequency, 48);
+ data[6] = num(raw.angle, 0);
+ data[7] = num(raw.warp, 0.6);
+ data[8] = num(raw.source, 1);
+ data.set(hexToRgba(String(raw.colorA ?? "#0a0a0a")), 12);
+ data.set(hexToRgba(String(raw.colorB ?? "#f5f5f5")), 16);
+}
+
+export const OpArtWebGPURenderer: WebGPUNodeRenderer = async (args) => {
+ const {
+ ctx,
+ encoder,
+ pass,
+ targetTexture,
+ targetWidth,
+ targetHeight,
+ props,
+ } = args;
+ const op = props.virtualMedia?.operation as
+ | ({
+ op?: string;
+ effect?: {
+ resolveUniforms?: (ctx: unknown) => Record<string, unknown>;
+ };
+ } & Record<string, unknown>)
+ | undefined;
+ if (op?.op !== OP) return;
+ const child = props.virtualMedia?.children?.[0];
+ if (!child) return;
+ pass.end();
+
+ const fps = props.fps || 30;
+ const frame = Math.round(props.compositionFrame ?? props.frame ?? 0);
+ const raw = op.effect?.resolveUniforms
+ ? op.effect.resolveUniforms({ frame, fps, time: frame / fps })
+ : op;
+ const data = new Float32Array(UNIFORM_FLOATS);
+ pack(raw, data, frame / fps, frame);
+
+ const { texture: childTex } = await drawChildToTexture(args, child);
+ const device = ctx.device;
+ const r = resources(device);
+ const pipelines = pipelinesFor(device, ctx.renderer.format);
+ const ubo = ctx.renderer.getTemporaryBuffer(data);
+ let prev = childTex;
+ for (const pipeline of pipelines) {
+ const out = ctx.renderer.getTemporaryTexture(targetWidth, targetHeight, [
+ childTex,
+ prev,
+ targetTexture,
+ ...(props.excludeTextures || []),
+ ]);
+ drawFullscreenPass(encoder, out.createView(), pipeline, [
+ device.createBindGroup({
+ layout: r.layout,
+ entries: [
+ { binding: 0, resource: { buffer: ubo } },
+ { binding: 1, resource: childTex.createView() },
+ { binding: 2, resource: prev.createView() },
+ { binding: 3, resource: r.sampler },
+ ],
+ }),
+ ]);
+ prev = out;
+ }
+ drawTextureToTarget(args, prev);
+};
diff --git a/nodes/node-op-art/src/shared/config.ts b/nodes/node-op-art/src/shared/config.ts
new file mode 100644
index 00000000..61904e1d
--- /dev/null
+++ b/nodes/node-op-art/src/shared/config.ts
@@ -0,0 +1,47 @@
+import { configBuilder } from "@framefields/node-sdk";
+import { z } from "zod";
+
+export const opArtConfig = configBuilder()
+ .field(
+ "pattern",
+ z.enum(["stripes", "rings", "checker", "waves"]).default("stripes"),
+ { bindable: false, label: "pattern", description: "Line pattern." },
+ )
+ .field("frequency", z.number().min(2).max(300).default(48), {
+ bindable: true,
+ dataTypes: ["Number", "Signal"],
+ label: "frequency",
+ description: "Lines across the height.",
+ })
+ .field("angle", z.number().min(-360).max(360).default(0), {
+ bindable: true,
+ dataTypes: ["Number", "Signal"],
+ label: "angle",
+ description: "Pattern angle, degrees.",
+ })
+ .field("warp", z.number().min(0).max(3).default(0.6), {
+ bindable: true,
+ dataTypes: ["Number", "Signal"],
+ label: "warp",
+ description: "How far brightness bends the lines.",
+ })
+ .field("source", z.number().min(0).max(1).default(1), {
+ bindable: true,
+ dataTypes: ["Number", "Signal"],
+ label: "source",
+ description: "How much darks thicken the lines (0 = even lines).",
+ })
+ .field("colorA", z.string().default("#0a0a0a"), {
+ bindable: false,
+ label: "colorA",
+ description: "Line color.",
+ })
+ .field("colorB", z.string().default("#f5f5f5"), {
+ bindable: false,
+ label: "colorB",
+ description: "Gap color.",
+ })
+ .build();
+
+export const OpArtNodeConfigSchema = opArtConfig.schema;
+export type OpArtNodeConfig = z.infer<typeof OpArtNodeConfigSchema>;
diff --git a/nodes/node-op-art/src/shared/index.ts b/nodes/node-op-art/src/shared/index.ts
new file mode 100644
index 00000000..d1bc97e8
--- /dev/null
+++ b/nodes/node-op-art/src/shared/index.ts
@@ -0,0 +1 @@
+export * from "./config.js";
diff --git a/nodes/node-op-art/tsconfig.json b/nodes/node-op-art/tsconfig.json
new file mode 100644
index 00000000..5a0b963f
--- /dev/null
+++ b/nodes/node-op-art/tsconfig.json
@@ -0,0 +1,12 @@
+{
+ "extends": "@framefields/tsconfig/node-library.json",
+ "compilerOptions": {
+ "baseUrl": ".",
+ "paths": {
+ "@/*": ["./src/*"]
+ },
+ "experimentalDecorators": true,
+ "emitDecoratorMetadata": true
+ },
+ "include": ["src"]
+}
diff --git a/nodes/node-op-art/tsdown.config.ts b/nodes/node-op-art/tsdown.config.ts
new file mode 100644
index 00000000..73f5c2fc
--- /dev/null
+++ b/nodes/node-op-art/tsdown.config.ts
@@ -0,0 +1,13 @@
+import { defineConfig } from "tsdown";
+
+export default defineConfig({
+ entry: {
+ index: "src/index.ts",
+ renderer: "src/renderers/index.ts",
+ },
+ format: ["esm"],
+ dts: true,
+ clean: true,
+ sourcemap: true,
+ treeshake: true,
+});
diff --git a/nodes/node-painterly/package.json b/nodes/node-painterly/package.json
new file mode 100644
index 00000000..e311ecce
--- /dev/null
+++ b/nodes/node-painterly/package.json
@@ -0,0 +1,45 @@
+{
+ "name": "@framefields/node-painterly",
+ "version": "2.2.0",
+ "private": false,
+ "framefields": {
+ "type": "Painterly",
+ "kind": "effect",
+ "schema": "PainterlyNodeConfigSchema"
+ },
+ "type": "module",
+ "license": "Apache-2.0",
+ "exports": {
+ ".": {
+ "types": "./dist/index.d.mts",
+ "development": "./src/index.ts",
+ "import": "./dist/index.mjs",
+ "default": "./dist/index.mjs"
+ },
+ "./renderer": {
+ "types": "./dist/renderer.d.mts",
+ "development": "./src/renderers/index.ts",
+ "import": "./dist/renderer.mjs",
+ "default": "./dist/renderer.mjs"
+ }
+ },
+ "scripts": {
+ "build": "tsdown",
+ "dev": "tsdown --watch",
+ "clean": "rm -rf dist .turbo"
+ },
+ "dependencies": {
+ "@framefields/node-sdk": "workspace:*",
+ "zod": "^4.3.6"
+ },
+ "devDependencies": {
+ "@framefields/tsconfig": "workspace:*",
+ "@types/node": "^24.1.0",
+ "tsdown": "^0.19.0",
+ "typescript": "^5.8.3",
+ "webgpu": "^0.4.0"
+ },
+ "publishConfig": {
+ "access": "public"
+ }
+}
diff --git a/nodes/node-painterly/src/index.ts b/nodes/node-painterly/src/index.ts
new file mode 100644
index 00000000..944d702e
--- /dev/null
+++ b/nodes/node-painterly/src/index.ts
@@ -0,0 +1,2 @@
+export * from "./renderers/index.js";
+export * from "./shared/index.js";
diff --git a/nodes/node-painterly/src/renderers/index.ts b/nodes/node-painterly/src/renderers/index.ts
new file mode 100644
index 00000000..13dfb240
--- /dev/null
+++ b/nodes/node-painterly/src/renderers/index.ts
@@ -0,0 +1,7 @@
+import { defineRenderer } from "@framefields/node-sdk/renderer";
+import { PainterlyWebGPURenderer } from "./webgpu-renderer.js";
+
+export default defineRenderer({
+ WebGPURenderer: PainterlyWebGPURenderer,
+});
+export { PainterlyWebGPURenderer };
diff --git a/nodes/node-painterly/src/renderers/webgpu-renderer.ts b/nodes/node-painterly/src/renderers/webgpu-renderer.ts
new file mode 100644
index 00000000..6a8ba456
--- /dev/null
+++ b/nodes/node-painterly/src/renderers/webgpu-renderer.ts
@@ -0,0 +1,241 @@
+/// <reference types="webgpu" />
+/**
+ * Painterly: Paint instead of pixels: a Kuwahara filter flattens detail into brush-like patches. `watercolor` adds wet edges that darken, paper grain and a lighter wash; `oil` keeps it dense.
+ */
+import type { WebGPUNodeRenderer } from "@framefields/node-sdk";
+import {
+ drawChildToTexture,
+ drawFullscreenPass,
+ drawTextureToTarget,
+ FULLSCREEN_QUAD_WGSL,
+ fragmentBindGroupLayout,
+ perDevice,
+} from "@framefields/node-sdk/gpu";
+
+const OP = "Painterly";
+const UNIFORM_FLOATS = 12;
+
+/** One fragment shader per pass; pass 0 reads the layer, later passes read the previous pass. */
+const PASSES = [
+ `struct U { v : array<vec4<f32>, 3> };
+@group(0) @binding(0) var<uniform> u : U;
+@group(0) @binding(1) var src : texture_2d<f32>;
+@group(0) @binding(2) var prev : texture_2d<f32>;
+@group(0) @binding(3) var samp : sampler;
+${FULLSCREEN_QUAD_WGSL}
+
+fn straight(c : vec4<f32>) -> vec4<f32> {
+ if (c.a <= 0.0001) { return vec4<f32>(0.0); }
+ return vec4<f32>(c.rgb / c.a, c.a);
+}
+fn premul(c : vec4<f32>) -> vec4<f32> { return vec4<f32>(c.rgb * c.a, c.a); }
+fn res() -> vec2<f32> { return vec2<f32>(textureDimensions(src)); }
+/** Straight-alpha color of the layer at a uv (filtered). */
+fn sampleS(uv : vec2<f32>) -> vec4<f32> { return straight(textureSampleLevel(src, samp, uv, 0.0)); }
+/** Premultiplied color of the layer at a uv (filtered). */
+fn sampleP(uv : vec2<f32>) -> vec4<f32> { return textureSampleLevel(src, samp, uv, 0.0); }
+/** Straight-alpha color of the layer's texel at a pixel position (nearest). */
+fn texelS(p : vec2<f32>) -> vec4<f32> {
+ let d = vec2<i32>(textureDimensions(src));
+ let q = clamp(vec2<i32>(floor(p)), vec2<i32>(0), d - vec2<i32>(1));
+ return straight(textureLoad(src, q, 0));
+}
+fn luma(c : vec3<f32>) -> f32 { return dot(c, vec3<f32>(0.2126, 0.7152, 0.0722)); }
+fn hash12(p : vec2<f32>) -> f32 {
+ var p3 = fract(vec3<f32>(p.xyx) * 0.1031);
+ p3 += dot(p3, p3.yzx + 33.33);
+ return fract((p3.x + p3.y) * p3.z);
+}
+fn vnoise(p : vec2<f32>) -> f32 {
+ let i = floor(p);
+ let f = fract(p);
+ let u = f * f * (3.0 - 2.0 * f);
+ return mix(mix(hash12(i), hash12(i + vec2<f32>(1.0, 0.0)), u.x),
+ mix(hash12(i + vec2<f32>(0.0, 1.0)), hash12(i + vec2<f32>(1.0, 1.0)), u.x), u.y);
+}
+/** 8x8 ordered-dither threshold, 0..1. */
+fn bayer8(p : vec2<f32>) -> f32 {
+ let x = u32(p.x) & 7u;
+ let y = u32(p.y) & 7u;
+ var v = 0u;
+ for (var k = 0u; k < 3u; k++) {
+ let bx = (x >> k) & 1u;
+ let by = (y >> k) & 1u;
+ let m = ((bx ^ by) << 1u) | by;
+ v += m * (1u << (2u * (2u - k)));
+ }
+ return (f32(v) + 0.5) / 64.0;
+}
+fn rot2(a : f32) -> mat2x2<f32> { let c = cos(a); let s = sin(a); return mat2x2<f32>(c, s, -s, c); }
+@fragment fn fs(in : VSOut) -> @location(0) vec4<f32> {
+ let time = u.v[0].x;
+ let frame = u.v[0].y;
+ let style = u32(u.v[1].x + 0.5);
+ let radius = u.v[1].y;
+ let edgeDarkening = u.v[1].z;
+ let paper = u.v[1].w;
+ let saturation = u.v[2].x;
+
+ let R = res();
+ let r = i32(radius);
+ var mean = array<vec3<f32>, 4>(vec3<f32>(0.0), vec3<f32>(0.0), vec3<f32>(0.0), vec3<f32>(0.0));
+ var sq = array<vec3<f32>, 4>(vec3<f32>(0.0), vec3<f32>(0.0), vec3<f32>(0.0), vec3<f32>(0.0));
+ var a = 0.0;
+ for (var j = -r; j <= r; j++) {
+ for (var i = -r; i <= r; i++) {
+ let c = sampleS(in.uv + vec2<f32>(f32(i), f32(j)) / R);
+ a += c.a;
+ let q = select(select(3, 2, i <= 0), select(1, 0, i <= 0), j <= 0);
+ mean[q] += c.rgb;
+ sq[q] += c.rgb * c.rgb;
+ }
+ }
+ let n = f32((r + 1) * (r + 1));
+ var best = vec3<f32>(0.0);
+ var bestV = 1e9;
+ for (var k = 0; k < 4; k++) {
+ let m = mean[k] / n;
+ let v = sq[k] / n - m * m;
+ let vs = v.r + v.g + v.b;
+ if (vs < bestV) { bestV = vs; best = m; }
+ }
+ var rgb = best;
+ let grain = vnoise(in.uv * R / 3.0) * 0.6 + vnoise(in.uv * R / 11.0) * 0.4;
+ if (style == 1u) {
+ rgb = mix(rgb, vec3<f32>(1.0), 0.06);
+ rgb *= 1.0 - edgeDarkening * 0.45 * smoothstep(0.004, 0.05, sqrt(max(bestV, 0.0)));
+ rgb *= 1.0 - paper * 0.18 * (grain - 0.5);
+ } else {
+ rgb *= 1.0 - paper * 0.1 * (grain - 0.5);
+ }
+ rgb = clamp(mix(vec3<f32>(luma(rgb)), rgb, saturation), vec3<f32>(0.0), vec3<f32>(1.0));
+ let alpha = a / f32((2 * r + 1) * (2 * r + 1));
+ return premul(vec4<f32>(rgb, alpha));
+}
+`,
+];
+
+const resources = perDevice((device: GPUDevice) => ({
+ layout: fragmentBindGroupLayout(
+ device,
+ ["uniform", "texture", "texture", "sampler"],
+ `${OP}_layout`,
+ ),
+ pipelines: new Map<GPUTextureFormat, GPURenderPipeline[]>(),
+ sampler: device.createSampler({
+ magFilter: "linear",
+ minFilter: "linear",
+ addressModeU: "clamp-to-edge",
+ addressModeV: "clamp-to-edge",
+ }),
+}));
+
+function pipelinesFor(
+ device: GPUDevice,
+ format: GPUTextureFormat,
+): GPURenderPipeline[] {
+ const r = resources(device);
+ let list = r.pipelines.get(format);
+ if (!list) {
+ list = PASSES.map((code, i) => {
+ const module = device.createShaderModule({
+ code,
+ label: `${OP}_${i}.wgsl`,
+ });
+ return device.createRenderPipeline({
+ label: `${OP}_${i}`,
+ layout: device.createPipelineLayout({ bindGroupLayouts: [r.layout] }),
+ vertex: { module, entryPoint: "vs" },
+ fragment: { module, entryPoint: "fs", targets: [{ format }] },
+ primitive: { topology: "triangle-strip" },
+ });
+ });
+ r.pipelines.set(format, list);
+ }
+ return list;
+}
+
+function num(v: unknown, fallback: number): number {
+ const n = typeof v === "number" ? v : Number(v);
+ return Number.isFinite(n) ? n : fallback;
+}
+
+/** Packs the effect's resolved props into the uniform block the shaders read. */
+function pack(
+ raw: Record<string, unknown>,
+ data: Float32Array,
+ time: number,
+ frame: number,
+): void {
+ data.fill(0);
+ data[0] = time;
+ data[1] = frame;
+ data[4] = Math.max(
+ 0,
+ ["oil", "watercolor"].indexOf(String(raw.style ?? "oil")),
+ );
+ data[5] = num(raw.radius, 5);
+ data[6] = num(raw.edgeDarkening, 0.5);
+ data[7] = num(raw.paper, 0.3);
+ data[8] = num(raw.saturation, 1.05);
+}
+
+export const PainterlyWebGPURenderer: WebGPUNodeRenderer = async (args) => {
+ const {
+ ctx,
+ encoder,
+ pass,
+ targetTexture,
+ targetWidth,
+ targetHeight,
+ props,
+ } = args;
+ const op = props.virtualMedia?.operation as
+ | ({
+ op?: string;
+ effect?: {
+ resolveUniforms?: (ctx: unknown) => Record<string, unknown>;
+ };
+ } & Record<string, unknown>)
+ | undefined;
+ if (op?.op !== OP) return;
+ const child = props.virtualMedia?.children?.[0];
+ if (!child) return;
+ pass.end();
+
+ const fps = props.fps || 30;
+ const frame = Math.round(props.compositionFrame ?? props.frame ?? 0);
+ const raw = op.effect?.resolveUniforms
+ ? op.effect.resolveUniforms({ frame, fps, time: frame / fps })
+ : op;
+ const data = new Float32Array(UNIFORM_FLOATS);
+ pack(raw, data, frame / fps, frame);
+
+ const { texture: childTex } = await drawChildToTexture(args, child);
+ const device = ctx.device;
+ const r = resources(device);
+ const pipelines = pipelinesFor(device, ctx.renderer.format);
+ const ubo = ctx.renderer.getTemporaryBuffer(data);
+ let prev = childTex;
+ for (const pipeline of pipelines) {
+ const out = ctx.renderer.getTemporaryTexture(targetWidth, targetHeight, [
+ childTex,
+ prev,
+ targetTexture,
+ ...(props.excludeTextures || []),
+ ]);
+ drawFullscreenPass(encoder, out.createView(), pipeline, [
+ device.createBindGroup({
+ layout: r.layout,
+ entries: [
+ { binding: 0, resource: { buffer: ubo } },
+ { binding: 1, resource: childTex.createView() },
+ { binding: 2, resource: prev.createView() },
+ { binding: 3, resource: r.sampler },
+ ],
+ }),
+ ]);
+ prev = out;
+ }
+ drawTextureToTarget(args, prev);
+};
diff --git a/nodes/node-painterly/src/shared/config.ts b/nodes/node-painterly/src/shared/config.ts
new file mode 100644
index 00000000..5f8f53f8
--- /dev/null
+++ b/nodes/node-painterly/src/shared/config.ts
@@ -0,0 +1,37 @@
+import { configBuilder } from "@framefields/node-sdk";
+import { z } from "zod";
+
+export const painterlyConfig = configBuilder()
+ .field("style", z.enum(["oil", "watercolor"]).default("oil"), {
+ bindable: false,
+ label: "style",
+ description: "Oil (dense strokes) or watercolor (wet edges, paper).",
+ })
+ .field("radius", z.number().int().min(2).max(12).default(5), {
+ bindable: true,
+ dataTypes: ["Number", "Signal"],
+ label: "radius",
+ description: "Brush size, px.",
+ })
+ .field("edgeDarkening", z.number().min(0).max(1).default(0.5), {
+ bindable: true,
+ dataTypes: ["Number", "Signal"],
+ label: "edgeDarkening",
+ description: "Watercolor: pigment pooling at patch edges.",
+ })
+ .field("paper", z.number().min(0).max(1).default(0.3), {
+ bindable: true,
+ dataTypes: ["Number", "Signal"],
+ label: "paper",
+ description: "Paper / canvas grain.",
+ })
+ .field("saturation", z.number().min(0).max(2).default(1.05), {
+ bindable: true,
+ dataTypes: ["Number", "Signal"],
+ label: "saturation",
+ description: "Color saturation.",
+ })
+ .build();
+
+export const PainterlyNodeConfigSchema = painterlyConfig.schema;
+export type PainterlyNodeConfig = z.infer<typeof PainterlyNodeConfigSchema>;
diff --git a/nodes/node-painterly/src/shared/index.ts b/nodes/node-painterly/src/shared/index.ts
new file mode 100644
index 00000000..d1bc97e8
--- /dev/null
+++ b/nodes/node-painterly/src/shared/index.ts
@@ -0,0 +1 @@
+export * from "./config.js";
diff --git a/nodes/node-painterly/tsconfig.json b/nodes/node-painterly/tsconfig.json
new file mode 100644
index 00000000..5a0b963f
--- /dev/null
+++ b/nodes/node-painterly/tsconfig.json
@@ -0,0 +1,12 @@
+{
+ "extends": "@framefields/tsconfig/node-library.json",
+ "compilerOptions": {
+ "baseUrl": ".",
+ "paths": {
+ "@/*": ["./src/*"]
+ },
+ "experimentalDecorators": true,
+ "emitDecoratorMetadata": true
+ },
+ "include": ["src"]
+}
diff --git a/nodes/node-painterly/tsdown.config.ts b/nodes/node-painterly/tsdown.config.ts
new file mode 100644
index 00000000..73f5c2fc
--- /dev/null
+++ b/nodes/node-painterly/tsdown.config.ts
@@ -0,0 +1,13 @@
+import { defineConfig } from "tsdown";
+
+export default defineConfig({
+ entry: {
+ index: "src/index.ts",
+ renderer: "src/renderers/index.ts",
+ },
+ format: ["esm"],
+ dts: true,
+ clean: true,
+ sourcemap: true,
+ treeshake: true,
+});
diff --git a/nodes/node-pixelate/package.json b/nodes/node-pixelate/package.json
new file mode 100644
index 00000000..723f9e81
--- /dev/null
+++ b/nodes/node-pixelate/package.json
@@ -0,0 +1,45 @@
+{
+ "name": "@framefields/node-pixelate",
+ "version": "2.2.0",
+ "private": false,
+ "framefields": {
+ "type": "Pixelate",
+ "kind": "effect",
+ "schema": "PixelateNodeConfigSchema"
+ },
+ "type": "module",
+ "license": "Apache-2.0",
+ "exports": {
+ ".": {
+ "types": "./dist/index.d.mts",
+ "development": "./src/index.ts",
+ "import": "./dist/index.mjs",
+ "default": "./dist/index.mjs"
+ },
+ "./renderer": {
+ "types": "./dist/renderer.d.mts",
+ "development": "./src/renderers/index.ts",
+ "import": "./dist/renderer.mjs",
+ "default": "./dist/renderer.mjs"
+ }
+ },
+ "scripts": {
+ "build": "tsdown",
+ "dev": "tsdown --watch",
+ "clean": "rm -rf dist .turbo"
+ },
+ "dependencies": {
+ "@framefields/node-sdk": "workspace:*",
+ "zod": "^4.3.6"
+ },
+ "devDependencies": {
+ "@framefields/tsconfig": "workspace:*",
+ "@types/node": "^24.1.0",
+ "tsdown": "^0.19.0",
+ "typescript": "^5.8.3",
+ "webgpu": "^0.4.0"
+ },
+ "publishConfig": {
+ "access": "public"
+ }
+}
diff --git a/nodes/node-pixelate/src/index.ts b/nodes/node-pixelate/src/index.ts
new file mode 100644
index 00000000..944d702e
--- /dev/null
+++ b/nodes/node-pixelate/src/index.ts
@@ -0,0 +1,2 @@
+export * from "./renderers/index.js";
+export * from "./shared/index.js";
diff --git a/nodes/node-pixelate/src/renderers/index.ts b/nodes/node-pixelate/src/renderers/index.ts
new file mode 100644
index 00000000..f7a5936d
--- /dev/null
+++ b/nodes/node-pixelate/src/renderers/index.ts
@@ -0,0 +1,7 @@
+import { defineRenderer } from "@framefields/node-sdk/renderer";
+import { PixelateWebGPURenderer } from "./webgpu-renderer.js";
+
+export default defineRenderer({
+ WebGPURenderer: PixelateWebGPURenderer,
+});
+export { PixelateWebGPURenderer };
diff --git a/nodes/node-pixelate/src/renderers/webgpu-renderer.ts b/nodes/node-pixelate/src/renderers/webgpu-renderer.ts
new file mode 100644
index 00000000..926cf39a
--- /dev/null
+++ b/nodes/node-pixelate/src/renderers/webgpu-renderer.ts
@@ -0,0 +1,219 @@
+/// <reference types="webgpu" />
+/**
+ * Pixelate: Big pixels: the layer sampled on a grid of cells, drawn as squares, circles (LED walls) or diamonds.
+ */
+import type { WebGPUNodeRenderer } from "@framefields/node-sdk";
+import {
+ drawChildToTexture,
+ drawFullscreenPass,
+ drawTextureToTarget,
+ FULLSCREEN_QUAD_WGSL,
+ fragmentBindGroupLayout,
+ perDevice,
+} from "@framefields/node-sdk/gpu";
+
+const OP = "Pixelate";
+const UNIFORM_FLOATS = 8;
+
+/** One fragment shader per pass; pass 0 reads the layer, later passes read the previous pass. */
+const PASSES = [
+ `struct U { v : array<vec4<f32>, 2> };
+@group(0) @binding(0) var<uniform> u : U;
+@group(0) @binding(1) var src : texture_2d<f32>;
+@group(0) @binding(2) var prev : texture_2d<f32>;
+@group(0) @binding(3) var samp : sampler;
+${FULLSCREEN_QUAD_WGSL}
+
+fn straight(c : vec4<f32>) -> vec4<f32> {
+ if (c.a <= 0.0001) { return vec4<f32>(0.0); }
+ return vec4<f32>(c.rgb / c.a, c.a);
+}
+fn premul(c : vec4<f32>) -> vec4<f32> { return vec4<f32>(c.rgb * c.a, c.a); }
+fn res() -> vec2<f32> { return vec2<f32>(textureDimensions(src)); }
+/** Straight-alpha color of the layer at a uv (filtered). */
+fn sampleS(uv : vec2<f32>) -> vec4<f32> { return straight(textureSampleLevel(src, samp, uv, 0.0)); }
+/** Premultiplied color of the layer at a uv (filtered). */
+fn sampleP(uv : vec2<f32>) -> vec4<f32> { return textureSampleLevel(src, samp, uv, 0.0); }
+/** Straight-alpha color of the layer's texel at a pixel position (nearest). */
+fn texelS(p : vec2<f32>) -> vec4<f32> {
+ let d = vec2<i32>(textureDimensions(src));
+ let q = clamp(vec2<i32>(floor(p)), vec2<i32>(0), d - vec2<i32>(1));
+ return straight(textureLoad(src, q, 0));
+}
+fn luma(c : vec3<f32>) -> f32 { return dot(c, vec3<f32>(0.2126, 0.7152, 0.0722)); }
+fn hash12(p : vec2<f32>) -> f32 {
+ var p3 = fract(vec3<f32>(p.xyx) * 0.1031);
+ p3 += dot(p3, p3.yzx + 33.33);
+ return fract((p3.x + p3.y) * p3.z);
+}
+fn vnoise(p : vec2<f32>) -> f32 {
+ let i = floor(p);
+ let f = fract(p);
+ let u = f * f * (3.0 - 2.0 * f);
+ return mix(mix(hash12(i), hash12(i + vec2<f32>(1.0, 0.0)), u.x),
+ mix(hash12(i + vec2<f32>(0.0, 1.0)), hash12(i + vec2<f32>(1.0, 1.0)), u.x), u.y);
+}
+/** 8x8 ordered-dither threshold, 0..1. */
+fn bayer8(p : vec2<f32>) -> f32 {
+ let x = u32(p.x) & 7u;
+ let y = u32(p.y) & 7u;
+ var v = 0u;
+ for (var k = 0u; k < 3u; k++) {
+ let bx = (x >> k) & 1u;
+ let by = (y >> k) & 1u;
+ let m = ((bx ^ by) << 1u) | by;
+ v += m * (1u << (2u * (2u - k)));
+ }
+ return (f32(v) + 0.5) / 64.0;
+}
+fn rot2(a : f32) -> mat2x2<f32> { let c = cos(a); let s = sin(a); return mat2x2<f32>(c, s, -s, c); }
+@fragment fn fs(in : VSOut) -> @location(0) vec4<f32> {
+ let time = u.v[0].x;
+ let frame = u.v[0].y;
+ let size = u.v[1].x;
+ let shape = u32(u.v[1].y + 0.5);
+ let gap = u.v[1].z;
+
+ let R = res();
+ let cell = max(size, 1.0);
+ let p = in.uv * R;
+ let c0 = floor(p / cell) * cell + cell * 0.5;
+ let col = texelS(c0);
+ let f = (p - c0) / cell;
+ let g = 1.0 - gap;
+ let e = 1.0 / cell;
+ var m = 1.0;
+ if (shape == 1u) {
+ m = 1.0 - smoothstep(0.5 * g - e, 0.5 * g, length(f));
+ } else if (shape == 2u) {
+ m = 1.0 - smoothstep(0.5 * g - e, 0.5 * g, abs(f.x) + abs(f.y));
+ } else if (gap > 0.0) {
+ m = 1.0 - smoothstep(0.5 * g - e, 0.5 * g, max(abs(f.x), abs(f.y)));
+ }
+ return premul(vec4<f32>(col.rgb, col.a * m));
+}
+`,
+];
+
+const resources = perDevice((device: GPUDevice) => ({
+ layout: fragmentBindGroupLayout(
+ device,
+ ["uniform", "texture", "texture", "sampler"],
+ `${OP}_layout`,
+ ),
+ pipelines: new Map<GPUTextureFormat, GPURenderPipeline[]>(),
+ sampler: device.createSampler({
+ magFilter: "linear",
+ minFilter: "linear",
+ addressModeU: "clamp-to-edge",
+ addressModeV: "clamp-to-edge",
+ }),
+}));
+
+function pipelinesFor(
+ device: GPUDevice,
+ format: GPUTextureFormat,
+): GPURenderPipeline[] {
+ const r = resources(device);
+ let list = r.pipelines.get(format);
+ if (!list) {
+ list = PASSES.map((code, i) => {
+ const module = device.createShaderModule({
+ code,
+ label: `${OP}_${i}.wgsl`,
+ });
+ return device.createRenderPipeline({
+ label: `${OP}_${i}`,
+ layout: device.createPipelineLayout({ bindGroupLayouts: [r.layout] }),
+ vertex: { module, entryPoint: "vs" },
+ fragment: { module, entryPoint: "fs", targets: [{ format }] },
+ primitive: { topology: "triangle-strip" },
+ });
+ });
+ r.pipelines.set(format, list);
+ }
+ return list;
+}
+
+function num(v: unknown, fallback: number): number {
+ const n = typeof v === "number" ? v : Number(v);
+ return Number.isFinite(n) ? n : fallback;
+}
+
+/** Packs the effect's resolved props into the uniform block the shaders read. */
+function pack(
+ raw: Record<string, unknown>,
+ data: Float32Array,
+ time: number,
+ frame: number,
+): void {
+ data.fill(0);
+ data[0] = time;
+ data[1] = frame;
+ data[4] = num(raw.size, 12);
+ data[5] = Math.max(
+ 0,
+ ["square", "circle", "diamond"].indexOf(String(raw.shape ?? "square")),
+ );
+ data[6] = num(raw.gap, 0);
+}
+
+export const PixelateWebGPURenderer: WebGPUNodeRenderer = async (args) => {
+ const {
+ ctx,
+ encoder,
+ pass,
+ targetTexture,
+ targetWidth,
+ targetHeight,
+ props,
+ } = args;
+ const op = props.virtualMedia?.operation as
+ | ({
+ op?: string;
+ effect?: {
+ resolveUniforms?: (ctx: unknown) => Record<string, unknown>;
+ };
+ } & Record<string, unknown>)
+ | undefined;
+ if (op?.op !== OP) return;
+ const child = props.virtualMedia?.children?.[0];
+ if (!child) return;
+ pass.end();
+
+ const fps = props.fps || 30;
+ const frame = Math.round(props.compositionFrame ?? props.frame ?? 0);
+ const raw = op.effect?.resolveUniforms
+ ? op.effect.resolveUniforms({ frame, fps, time: frame / fps })
+ : op;
+ const data = new Float32Array(UNIFORM_FLOATS);
+ pack(raw, data, frame / fps, frame);
+
+ const { texture: childTex } = await drawChildToTexture(args, child);
+ const device = ctx.device;
+ const r = resources(device);
+ const pipelines = pipelinesFor(device, ctx.renderer.format);
+ const ubo = ctx.renderer.getTemporaryBuffer(data);
+ let prev = childTex;
+ for (const pipeline of pipelines) {
+ const out = ctx.renderer.getTemporaryTexture(targetWidth, targetHeight, [
+ childTex,
+ prev,
+ targetTexture,
+ ...(props.excludeTextures || []),
+ ]);
+ drawFullscreenPass(encoder, out.createView(), pipeline, [
+ device.createBindGroup({
+ layout: r.layout,
+ entries: [
+ { binding: 0, resource: { buffer: ubo } },
+ { binding: 1, resource: childTex.createView() },
+ { binding: 2, resource: prev.createView() },
+ { binding: 3, resource: r.sampler },
+ ],
+ }),
+ ]);
+ prev = out;
+ }
+ drawTextureToTarget(args, prev);
+};
diff --git a/nodes/node-pixelate/src/shared/config.ts b/nodes/node-pixelate/src/shared/config.ts
new file mode 100644
index 00000000..06572387
--- /dev/null
+++ b/nodes/node-pixelate/src/shared/config.ts
@@ -0,0 +1,25 @@
+import { configBuilder } from "@framefields/node-sdk";
+import { z } from "zod";
+
+export const pixelateConfig = configBuilder()
+ .field("size", z.number().min(1).max(256).default(12), {
+ bindable: true,
+ dataTypes: ["Number", "Signal"],
+ label: "size",
+ description: "Cell size, px.",
+ })
+ .field("shape", z.enum(["square", "circle", "diamond"]).default("square"), {
+ bindable: false,
+ label: "shape",
+ description: "Cell shape: square pixels, round LEDs or diamonds.",
+ })
+ .field("gap", z.number().min(0).max(0.9).default(0), {
+ bindable: true,
+ dataTypes: ["Number", "Signal"],
+ label: "gap",
+ description: "Space between cells, as a fraction of a cell (0 = touching).",
+ })
+ .build();
+
+export const PixelateNodeConfigSchema = pixelateConfig.schema;
+export type PixelateNodeConfig = z.infer<typeof PixelateNodeConfigSchema>;
diff --git a/nodes/node-pixelate/src/shared/index.ts b/nodes/node-pixelate/src/shared/index.ts
new file mode 100644
index 00000000..d1bc97e8
--- /dev/null
+++ b/nodes/node-pixelate/src/shared/index.ts
@@ -0,0 +1 @@
+export * from "./config.js";
diff --git a/nodes/node-pixelate/tsconfig.json b/nodes/node-pixelate/tsconfig.json
new file mode 100644
index 00000000..5a0b963f
--- /dev/null
+++ b/nodes/node-pixelate/tsconfig.json
@@ -0,0 +1,12 @@
+{
+ "extends": "@framefields/tsconfig/node-library.json",
+ "compilerOptions": {
+ "baseUrl": ".",
+ "paths": {
+ "@/*": ["./src/*"]
+ },
+ "experimentalDecorators": true,
+ "emitDecoratorMetadata": true
+ },
+ "include": ["src"]
+}
diff --git a/nodes/node-pixelate/tsdown.config.ts b/nodes/node-pixelate/tsdown.config.ts
new file mode 100644
index 00000000..73f5c2fc
--- /dev/null
+++ b/nodes/node-pixelate/tsdown.config.ts
@@ -0,0 +1,13 @@
+import { defineConfig } from "tsdown";
+
+export default defineConfig({
+ entry: {
+ index: "src/index.ts",
+ renderer: "src/renderers/index.ts",
+ },
+ format: ["esm"],
+ dts: true,
+ clean: true,
+ sourcemap: true,
+ treeshake: true,
+});
diff --git a/nodes/node-posterize/package.json b/nodes/node-posterize/package.json
new file mode 100644
index 00000000..8eafc863
--- /dev/null
+++ b/nodes/node-posterize/package.json
@@ -0,0 +1,45 @@
+{
+ "name": "@framefields/node-posterize",
+ "version": "2.2.0",
+ "private": false,
+ "framefields": {
+ "type": "Posterize",
+ "kind": "effect",
+ "schema": "PosterizeNodeConfigSchema"
+ },
+ "type": "module",
+ "license": "Apache-2.0",
+ "exports": {
+ ".": {
+ "types": "./dist/index.d.mts",
+ "development": "./src/index.ts",
+ "import": "./dist/index.mjs",
+ "default": "./dist/index.mjs"
+ },
+ "./renderer": {
+ "types": "./dist/renderer.d.mts",
+ "development": "./src/renderers/index.ts",
+ "import": "./dist/renderer.mjs",
+ "default": "./dist/renderer.mjs"
+ }
+ },
+ "scripts": {
+ "build": "tsdown",
+ "dev": "tsdown --watch",
+ "clean": "rm -rf dist .turbo"
+ },
+ "dependencies": {
+ "@framefields/node-sdk": "workspace:*",
+ "zod": "^4.3.6"
+ },
+ "devDependencies": {
+ "@framefields/tsconfig": "workspace:*",
+ "@types/node": "^24.1.0",
+ "tsdown": "^0.19.0",
+ "typescript": "^5.8.3",
+ "webgpu": "^0.4.0"
+ },
+ "publishConfig": {
+ "access": "public"
+ }
+}
diff --git a/nodes/node-posterize/src/index.ts b/nodes/node-posterize/src/index.ts
new file mode 100644
index 00000000..944d702e
--- /dev/null
+++ b/nodes/node-posterize/src/index.ts
@@ -0,0 +1,2 @@
+export * from "./renderers/index.js";
+export * from "./shared/index.js";
diff --git a/nodes/node-posterize/src/renderers/index.ts b/nodes/node-posterize/src/renderers/index.ts
new file mode 100644
index 00000000..883d6528
--- /dev/null
+++ b/nodes/node-posterize/src/renderers/index.ts
@@ -0,0 +1,7 @@
+import { defineRenderer } from "@framefields/node-sdk/renderer";
+import { PosterizeWebGPURenderer } from "./webgpu-renderer.js";
+
+export default defineRenderer({
+ WebGPURenderer: PosterizeWebGPURenderer,
+});
+export { PosterizeWebGPURenderer };
diff --git a/nodes/node-posterize/src/renderers/webgpu-renderer.ts b/nodes/node-posterize/src/renderers/webgpu-renderer.ts
new file mode 100644
index 00000000..1ff49882
--- /dev/null
+++ b/nodes/node-posterize/src/renderers/webgpu-renderer.ts
@@ -0,0 +1,309 @@
+/// <reference types="webgpu" />
+/**
+ * Posterize: Fewer colors: each channel stepped to `levels`, or every pixel snapped to a palette (GameBoy, teletext, CGA, PICO-8, C64, grayscale, sepia, or your own colors), with optional ordered dithering and big pixels for pixel art.
+ */
+import type { WebGPUNodeRenderer } from "@framefields/node-sdk";
+import {
+ drawChildToTexture,
+ drawFullscreenPass,
+ drawTextureToTarget,
+ FULLSCREEN_QUAD_WGSL,
+ fragmentBindGroupLayout,
+ perDevice,
+} from "@framefields/node-sdk/gpu";
+
+const OP = "Posterize";
+const UNIFORM_FLOATS = 76;
+
+/** One fragment shader per pass; pass 0 reads the layer, later passes read the previous pass. */
+const PASSES = [
+ `struct U { v : array<vec4<f32>, 19> };
+@group(0) @binding(0) var<uniform> u : U;
+@group(0) @binding(1) var src : texture_2d<f32>;
+@group(0) @binding(2) var prev : texture_2d<f32>;
+@group(0) @binding(3) var samp : sampler;
+${FULLSCREEN_QUAD_WGSL}
+
+fn straight(c : vec4<f32>) -> vec4<f32> {
+ if (c.a <= 0.0001) { return vec4<f32>(0.0); }
+ return vec4<f32>(c.rgb / c.a, c.a);
+}
+fn premul(c : vec4<f32>) -> vec4<f32> { return vec4<f32>(c.rgb * c.a, c.a); }
+fn res() -> vec2<f32> { return vec2<f32>(textureDimensions(src)); }
+/** Straight-alpha color of the layer at a uv (filtered). */
+fn sampleS(uv : vec2<f32>) -> vec4<f32> { return straight(textureSampleLevel(src, samp, uv, 0.0)); }
+/** Premultiplied color of the layer at a uv (filtered). */
+fn sampleP(uv : vec2<f32>) -> vec4<f32> { return textureSampleLevel(src, samp, uv, 0.0); }
+/** Straight-alpha color of the layer's texel at a pixel position (nearest). */
+fn texelS(p : vec2<f32>) -> vec4<f32> {
+ let d = vec2<i32>(textureDimensions(src));
+ let q = clamp(vec2<i32>(floor(p)), vec2<i32>(0), d - vec2<i32>(1));
+ return straight(textureLoad(src, q, 0));
+}
+fn luma(c : vec3<f32>) -> f32 { return dot(c, vec3<f32>(0.2126, 0.7152, 0.0722)); }
+fn hash12(p : vec2<f32>) -> f32 {
+ var p3 = fract(vec3<f32>(p.xyx) * 0.1031);
+ p3 += dot(p3, p3.yzx + 33.33);
+ return fract((p3.x + p3.y) * p3.z);
+}
+fn vnoise(p : vec2<f32>) -> f32 {
+ let i = floor(p);
+ let f = fract(p);
+ let u = f * f * (3.0 - 2.0 * f);
+ return mix(mix(hash12(i), hash12(i + vec2<f32>(1.0, 0.0)), u.x),
+ mix(hash12(i + vec2<f32>(0.0, 1.0)), hash12(i + vec2<f32>(1.0, 1.0)), u.x), u.y);
+}
+/** 8x8 ordered-dither threshold, 0..1. */
+fn bayer8(p : vec2<f32>) -> f32 {
+ let x = u32(p.x) & 7u;
+ let y = u32(p.y) & 7u;
+ var v = 0u;
+ for (var k = 0u; k < 3u; k++) {
+ let bx = (x >> k) & 1u;
+ let by = (y >> k) & 1u;
+ let m = ((bx ^ by) << 1u) | by;
+ v += m * (1u << (2u * (2u - k)));
+ }
+ return (f32(v) + 0.5) / 64.0;
+}
+fn rot2(a : f32) -> mat2x2<f32> { let c = cos(a); let s = sin(a); return mat2x2<f32>(c, s, -s, c); }
+fn paletteColor(i : u32) -> vec3<f32> { return u.v[3u + i].rgb; }
+@fragment fn fs(in : VSOut) -> @location(0) vec4<f32> {
+ let time = u.v[0].x;
+ let frame = u.v[0].y;
+ let levels = u.v[1].x;
+ let palette = u32(u.v[1].y + 0.5);
+ let dither = u.v[1].z;
+ let pixelSize = u.v[1].w;
+ let paletteCount = u.v[2].x;
+
+ let R = res();
+ let ps = max(pixelSize, 1.0);
+ let cellp = floor(in.uv * R / ps);
+ let c = texelS(cellp * ps + ps * 0.5);
+ let t = bayer8(cellp) - 0.5;
+ var rgb = c.rgb;
+ if (paletteCount > 0.5) {
+ rgb = clamp(rgb + t * dither * 0.35, vec3<f32>(0.0), vec3<f32>(1.0));
+ var best = paletteColor(0u);
+ var bestD = 1e9;
+ for (var i = 0u; i < u32(paletteCount); i++) {
+ let pc = paletteColor(i);
+ let d = rgb - pc;
+ let dd = dot(d * d, vec3<f32>(0.3, 0.59, 0.11));
+ if (dd < bestD) { bestD = dd; best = pc; }
+ }
+ rgb = best;
+ } else {
+ let n = max(levels - 1.0, 1.0);
+ rgb = clamp(floor(rgb * n + 0.5 + t * dither) / n, vec3<f32>(0.0), vec3<f32>(1.0));
+ }
+ return premul(vec4<f32>(rgb, c.a));
+}
+`,
+];
+
+const PALETTES: Record<string, string[]> = {
+ gameboy: ["#0f380f", "#306230", "#8bac0f", "#9bbc0f"],
+ teletext: [
+ "#000000",
+ "#ff0000",
+ "#00ff00",
+ "#ffff00",
+ "#0000ff",
+ "#ff00ff",
+ "#00ffff",
+ "#ffffff",
+ ],
+ cga: ["#000000", "#55ffff", "#ff55ff", "#ffffff"],
+ pico8: [
+ "#000000",
+ "#1d2b53",
+ "#7e2553",
+ "#008751",
+ "#ab5236",
+ "#5f574f",
+ "#c2c3c7",
+ "#fff1e8",
+ "#ff004d",
+ "#ffa300",
+ "#ffec27",
+ "#00e436",
+ "#29adff",
+ "#83769c",
+ "#ff77a8",
+ "#ffccaa",
+ ],
+ c64: [
+ "#000000",
+ "#ffffff",
+ "#880000",
+ "#aaffee",
+ "#cc44cc",
+ "#00cc55",
+ "#0000aa",
+ "#eeee77",
+ "#dd8855",
+ "#664400",
+ "#ff7777",
+ "#333333",
+ "#777777",
+ "#aaff66",
+ "#0088ff",
+ "#bbbbbb",
+ ],
+ grayscale: ["#000000", "#555555", "#aaaaaa", "#ffffff"],
+ sepia: ["#2b1d0e", "#6b4a2b", "#b08a5a", "#efe0c0"],
+};
+
+const resources = perDevice((device: GPUDevice) => ({
+ layout: fragmentBindGroupLayout(
+ device,
+ ["uniform", "texture", "texture", "sampler"],
+ `${OP}_layout`,
+ ),
+ pipelines: new Map<GPUTextureFormat, GPURenderPipeline[]>(),
+ sampler: device.createSampler({
+ magFilter: "linear",
+ minFilter: "linear",
+ addressModeU: "clamp-to-edge",
+ addressModeV: "clamp-to-edge",
+ }),
+}));
+
+function pipelinesFor(
+ device: GPUDevice,
+ format: GPUTextureFormat,
+): GPURenderPipeline[] {
+ const r = resources(device);
+ let list = r.pipelines.get(format);
+ if (!list) {
+ list = PASSES.map((code, i) => {
+ const module = device.createShaderModule({
+ code,
+ label: `${OP}_${i}.wgsl`,
+ });
+ return device.createRenderPipeline({
+ label: `${OP}_${i}`,
+ layout: device.createPipelineLayout({ bindGroupLayouts: [r.layout] }),
+ vertex: { module, entryPoint: "vs" },
+ fragment: { module, entryPoint: "fs", targets: [{ format }] },
+ primitive: { topology: "triangle-strip" },
+ });
+ });
+ r.pipelines.set(format, list);
+ }
+ return list;
+}
+
+function num(v: unknown, fallback: number): number {
+ const n = typeof v === "number" ? v : Number(v);
+ return Number.isFinite(n) ? n : fallback;
+}
+
+function hexToRgba(hex: string): [number, number, number, number] {
+ let h = hex.trim().replace("#", "");
+ if (h.length === 3 || h.length === 4) {
+ h = [...h].map((c) => c + c).join("");
+ }
+ const n = (i: number) => Number.parseInt(h.slice(i, i + 2), 16) / 255;
+ return [n(0), n(2), n(4), h.length >= 8 ? n(6) : 1];
+}
+
+/** Packs the effect's resolved props into the uniform block the shaders read. */
+function pack(
+ raw: Record<string, unknown>,
+ data: Float32Array,
+ time: number,
+ frame: number,
+): void {
+ data.fill(0);
+ data[0] = time;
+ data[1] = frame;
+ data[4] = num(raw.levels, 6);
+ data[5] = Math.max(
+ 0,
+ [
+ "none",
+ "gameboy",
+ "teletext",
+ "cga",
+ "pico8",
+ "c64",
+ "grayscale",
+ "sepia",
+ "custom",
+ ].indexOf(String(raw.palette ?? "none")),
+ );
+ data[6] = num(raw.dither, 0);
+ data[7] = num(raw.pixelSize, 1);
+ const paletteName = String(raw.palette ?? "none");
+ const palette =
+ paletteName === "custom"
+ ? ((raw.colors as string[] | undefined) ?? [])
+ : (PALETTES[paletteName] ?? []);
+ data[8] = Math.min(palette.length, 16);
+ palette.slice(0, 16).forEach((c, i) => {
+ data.set(hexToRgba(c), 12 + i * 4);
+ });
+}
+
+export const PosterizeWebGPURenderer: WebGPUNodeRenderer = async (args) => {
+ const {
+ ctx,
+ encoder,
+ pass,
+ targetTexture,
+ targetWidth,
+ targetHeight,
+ props,
+ } = args;
+ const op = props.virtualMedia?.operation as
+ | ({
+ op?: string;
+ effect?: {
+ resolveUniforms?: (ctx: unknown) => Record<string, unknown>;
+ };
+ } & Record<string, unknown>)
+ | undefined;
+ if (op?.op !== OP) return;
+ const child = props.virtualMedia?.children?.[0];
+ if (!child) return;
+ pass.end();
+
+ const fps = props.fps || 30;
+ const frame = Math.round(props.compositionFrame ?? props.frame ?? 0);
+ const raw = op.effect?.resolveUniforms
+ ? op.effect.resolveUniforms({ frame, fps, time: frame / fps })
+ : op;
+ const data = new Float32Array(UNIFORM_FLOATS);
+ pack(raw, data, frame / fps, frame);
+
+ const { texture: childTex } = await drawChildToTexture(args, child);
+ const device = ctx.device;
+ const r = resources(device);
+ const pipelines = pipelinesFor(device, ctx.renderer.format);
+ const ubo = ctx.renderer.getTemporaryBuffer(data);
+ let prev = childTex;
+ for (const pipeline of pipelines) {
+ const out = ctx.renderer.getTemporaryTexture(targetWidth, targetHeight, [
+ childTex,
+ prev,
+ targetTexture,
+ ...(props.excludeTextures || []),
+ ]);
+ drawFullscreenPass(encoder, out.createView(), pipeline, [
+ device.createBindGroup({
+ layout: r.layout,
+ entries: [
+ { binding: 0, resource: { buffer: ubo } },
+ { binding: 1, resource: childTex.createView() },
+ { binding: 2, resource: prev.createView() },
+ { binding: 3, resource: r.sampler },
+ ],
+ }),
+ ]);
+ prev = out;
+ }
+ drawTextureToTarget(args, prev);
+};
diff --git a/nodes/node-posterize/src/shared/config.ts b/nodes/node-posterize/src/shared/config.ts
new file mode 100644
index 00000000..860d752b
--- /dev/null
+++ b/nodes/node-posterize/src/shared/config.ts
@@ -0,0 +1,53 @@
+import { configBuilder } from "@framefields/node-sdk";
+import { z } from "zod";
+
+export const posterizeConfig = configBuilder()
+ .field("levels", z.number().int().min(2).max(64).default(6), {
+ bindable: true,
+ dataTypes: ["Number", "Signal"],
+ label: "levels",
+ description: "Steps per channel when no palette is set.",
+ })
+ .field(
+ "palette",
+ z
+ .enum([
+ "none",
+ "gameboy",
+ "teletext",
+ "cga",
+ "pico8",
+ "c64",
+ "grayscale",
+ "sepia",
+ "custom",
+ ])
+ .default("none"),
+ {
+ bindable: false,
+ label: "palette",
+ description: "Snap to a retro palette, or `custom` to use `colors`.",
+ },
+ )
+ .field("colors", z.array(z.string()).max(16).default([]), {
+ bindable: false,
+ label: "colors",
+ description:
+ "Your palette (up to 16 hex colors), used when `palette` is `custom`.",
+ })
+ .field("dither", z.number().min(0).max(1).default(0), {
+ bindable: true,
+ dataTypes: ["Number", "Signal"],
+ label: "dither",
+ description: "Ordered (Bayer) dithering between steps, 0\u20131.",
+ })
+ .field("pixelSize", z.number().min(1).max(64).default(1), {
+ bindable: true,
+ dataTypes: ["Number", "Signal"],
+ label: "pixelSize",
+ description: "Pixel size, px: above 1 for pixel art.",
+ })
+ .build();
+
+export const PosterizeNodeConfigSchema = posterizeConfig.schema;
+export type PosterizeNodeConfig = z.infer<typeof PosterizeNodeConfigSchema>;
diff --git a/nodes/node-posterize/src/shared/index.ts b/nodes/node-posterize/src/shared/index.ts
new file mode 100644
index 00000000..d1bc97e8
--- /dev/null
+++ b/nodes/node-posterize/src/shared/index.ts
@@ -0,0 +1 @@
+export * from "./config.js";
diff --git a/nodes/node-posterize/tsconfig.json b/nodes/node-posterize/tsconfig.json
new file mode 100644
index 00000000..5a0b963f
--- /dev/null
+++ b/nodes/node-posterize/tsconfig.json
@@ -0,0 +1,12 @@
+{
+ "extends": "@framefields/tsconfig/node-library.json",
+ "compilerOptions": {
+ "baseUrl": ".",
+ "paths": {
+ "@/*": ["./src/*"]
+ },
+ "experimentalDecorators": true,
+ "emitDecoratorMetadata": true
+ },
+ "include": ["src"]
+}
diff --git a/nodes/node-posterize/tsdown.config.ts b/nodes/node-posterize/tsdown.config.ts
new file mode 100644
index 00000000..73f5c2fc
--- /dev/null
+++ b/nodes/node-posterize/tsdown.config.ts
@@ -0,0 +1,13 @@
+import { defineConfig } from "tsdown";
+
+export default defineConfig({
+ entry: {
+ index: "src/index.ts",
+ renderer: "src/renderers/index.ts",
+ },
+ format: ["esm"],
+ dts: true,
+ clean: true,
+ sourcemap: true,
+ treeshake: true,
+});
diff --git a/nodes/node-procedural-vfx/package.json b/nodes/node-procedural-vfx/package.json
index cc4a0e9e..78f48408 100644
--- a/nodes/node-procedural-vfx/package.json
+++ b/nodes/node-procedural-vfx/package.json
@@ -7,9 +7,6 @@
"kind": "effect",
"schema": "ProceduralVFXNodeConfigSchema"
},
- "gatewai": {
- "enabled": false
- },
"type": "module",
"license": "Apache-2.0",
"exports": {
diff --git a/nodes/node-procedural-vfx/src/renderers/webgpu-renderer.ts b/nodes/node-procedural-vfx/src/renderers/webgpu-renderer.ts
index ff627ade..ad661a82 100644
--- a/nodes/node-procedural-vfx/src/renderers/webgpu-renderer.ts
+++ b/nodes/node-procedural-vfx/src/renderers/webgpu-renderer.ts
@@ -329,6 +329,34 @@ fn fxEnergyBeam(p: vec2<f32>, time: f32, scl: f32, dens: f32, inten: f32, cA: ve
return vec4<f32>(col * (1.0 + glow * 2.0), a);
}
+fn fxAurora(p: vec2<f32>, seedOff: f32, time: f32, scl: f32, dens: f32, inten: f32, cA: vec3<f32>, cB: vec3<f32>) -> vec4<f32> {
+ // Northern lights: curtains hanging from a wavy band across the upper sky,
+ // rippling sideways, with fine vertical rays. cA at the base, cB at the top.
+ var acc = vec3<f32>(0.0);
+ var keep = 1.0;
+ for (var k = 0; k < 3; k++) {
+ let fk = f32(k);
+ let x = p.x * (1.0 + fk * 0.35) * scl * 1.5 + seedOff * 13.0 + fk * 3.1;
+ // Curtain base line, a slow wave across the frame.
+ let base = 0.42 + fk * 0.06 + 0.12 * (fbm(vec2<f32>(x * 1.3, time * 0.05 + fk), 3) - 0.5)
+ + 0.05 * sin(x * 4.0 + time * 0.3 + fk);
+ let h = 0.38 + 0.2 * fbm(vec2<f32>(x * 2.0 + 7.0, time * 0.04), 3);
+ let d = base - p.y; // 0 at the base, rising upward
+ let body = smoothstep(-0.06, 0.035, d) * pow(1.0 - smoothstep(0.0, h, d), 1.5);
+ // Vertical rays drifting sideways.
+ let rn = fbm(vec2<f32>(x * 40.0 + time * 0.3, d * 2.0 - time * 0.1), 3);
+ let rays = 0.25 + 1.2 * rn * rn;
+ let fold = 0.6 + 0.4 * sin(x * 9.0 + time * 0.5 + fbm(vec2<f32>(x * 3.0, time * 0.1), 2) * 6.0);
+ let a = body * rays * fold * (1.0 - fk * 0.25);
+ let col = mix(cA, cB, clamp(d / max(h, 1e-3), 0.0, 1.0));
+ acc += col * a;
+ keep *= 1.0 - clamp(a, 0.0, 1.0);
+ }
+ let alpha = 1.0 - keep;
+ let a = clamp(alpha * (0.35 + 0.65 * dens) * inten * 1.4, 0.0, 1.0);
+ return vec4<f32>(acc / max(alpha, 1e-3) * min(alpha * 2.0, 1.0), a);
+}
+
// ---- main dispatch ---------------------------------------------------------
@fragment fn fs(in : VSOut) -> @location(0) vec4<f32> {
let density = get_field(u.density, u.hasSigDensity, densityTex, signalSamp);
@@ -374,8 +402,10 @@ fn fxEnergyBeam(p: vec2<f32>, time: f32, scl: f32, dens: f32, inten: f32, cA: ve
eff = fxLensFlare(sp, time, factor, density, intensity, cA, cB);
} else if (u.effectType < 9.5) {
eff = fxEmbers(sp, time, factor, density, intensity, cA, cB);
- } else {
+ } else if (u.effectType < 10.5) {
eff = fxEnergyBeam(sp, time, factor, density, intensity, cA, cB);
+ } else {
+ eff = fxAurora(p, seedOff, time, factor, density, intensity, cA, cB);
}
// Straight alpha is fine for compositing onto a transparent canvas.
@@ -449,6 +479,7 @@ const VFX_EFFECT_INDEX: Record<string, number> = {
LensFlare: 8,
Embers: 9,
EnergyBeam: 10,
+ Aurora: 11,
};
export const ProceduralVFXWebGPURenderer: WebGPUNodeRenderer = async (args) => {
diff --git a/nodes/node-procedural-vfx/src/shared/config.ts b/nodes/node-procedural-vfx/src/shared/config.ts
index 44daec40..e628ede0 100644
--- a/nodes/node-procedural-vfx/src/shared/config.ts
+++ b/nodes/node-procedural-vfx/src/shared/config.ts
@@ -17,6 +17,7 @@ export const VFX_EFFECT_TYPES = [
"LensFlare",
"Embers",
"EnergyBeam",
+ "Aurora",
] as const;
export const proceduralVFXConfig = configBuilder()
diff --git a/nodes/node-rgb-split/package.json b/nodes/node-rgb-split/package.json
new file mode 100644
index 00000000..7a41b507
--- /dev/null
+++ b/nodes/node-rgb-split/package.json
@@ -0,0 +1,45 @@
+{
+ "name": "@framefields/node-rgb-split",
+ "version": "2.2.0",
+ "private": false,
+ "framefields": {
+ "type": "RGBSplit",
+ "kind": "effect",
+ "schema": "RGBSplitNodeConfigSchema"
+ },
+ "type": "module",
+ "license": "Apache-2.0",
+ "exports": {
+ ".": {
+ "types": "./dist/index.d.mts",
+ "development": "./src/index.ts",
+ "import": "./dist/index.mjs",
+ "default": "./dist/index.mjs"
+ },
+ "./renderer": {
+ "types": "./dist/renderer.d.mts",
+ "development": "./src/renderers/index.ts",
+ "import": "./dist/renderer.mjs",
+ "default": "./dist/renderer.mjs"
+ }
+ },
+ "scripts": {
+ "build": "tsdown",
+ "dev": "tsdown --watch",
+ "clean": "rm -rf dist .turbo"
+ },
+ "dependencies": {
+ "@framefields/node-sdk": "workspace:*",
+ "zod": "^4.3.6"
+ },
+ "devDependencies": {
+ "@framefields/tsconfig": "workspace:*",
+ "@types/node": "^24.1.0",
+ "tsdown": "^0.19.0",
+ "typescript": "^5.8.3",
+ "webgpu": "^0.4.0"
+ },
+ "publishConfig": {
+ "access": "public"
+ }
+}
diff --git a/nodes/node-rgb-split/src/index.ts b/nodes/node-rgb-split/src/index.ts
new file mode 100644
index 00000000..944d702e
--- /dev/null
+++ b/nodes/node-rgb-split/src/index.ts
@@ -0,0 +1,2 @@
+export * from "./renderers/index.js";
+export * from "./shared/index.js";
diff --git a/nodes/node-rgb-split/src/renderers/index.ts b/nodes/node-rgb-split/src/renderers/index.ts
new file mode 100644
index 00000000..dae7d7ed
--- /dev/null
+++ b/nodes/node-rgb-split/src/renderers/index.ts
@@ -0,0 +1,7 @@
+import { defineRenderer } from "@framefields/node-sdk/renderer";
+import { RGBSplitWebGPURenderer } from "./webgpu-renderer.js";
+
+export default defineRenderer({
+ WebGPURenderer: RGBSplitWebGPURenderer,
+});
+export { RGBSplitWebGPURenderer };
diff --git a/nodes/node-rgb-split/src/renderers/webgpu-renderer.ts b/nodes/node-rgb-split/src/renderers/webgpu-renderer.ts
new file mode 100644
index 00000000..3e016b71
--- /dev/null
+++ b/nodes/node-rgb-split/src/renderers/webgpu-renderer.ts
@@ -0,0 +1,207 @@
+/// <reference types="webgpu" />
+/**
+ * RGB split: Chromatic aberration: red and blue pulled apart from green, along an angle or radially from the center like a cheap lens.
+ */
+import type { WebGPUNodeRenderer } from "@framefields/node-sdk";
+import {
+ drawChildToTexture,
+ drawFullscreenPass,
+ drawTextureToTarget,
+ FULLSCREEN_QUAD_WGSL,
+ fragmentBindGroupLayout,
+ perDevice,
+} from "@framefields/node-sdk/gpu";
+
+const OP = "RGBSplit";
+const UNIFORM_FLOATS = 8;
+
+/** One fragment shader per pass; pass 0 reads the layer, later passes read the previous pass. */
+const PASSES = [
+ `struct U { v : array<vec4<f32>, 2> };
+@group(0) @binding(0) var<uniform> u : U;
+@group(0) @binding(1) var src : texture_2d<f32>;
+@group(0) @binding(2) var prev : texture_2d<f32>;
+@group(0) @binding(3) var samp : sampler;
+${FULLSCREEN_QUAD_WGSL}
+
+fn straight(c : vec4<f32>) -> vec4<f32> {
+ if (c.a <= 0.0001) { return vec4<f32>(0.0); }
+ return vec4<f32>(c.rgb / c.a, c.a);
+}
+fn premul(c : vec4<f32>) -> vec4<f32> { return vec4<f32>(c.rgb * c.a, c.a); }
+fn res() -> vec2<f32> { return vec2<f32>(textureDimensions(src)); }
+/** Straight-alpha color of the layer at a uv (filtered). */
+fn sampleS(uv : vec2<f32>) -> vec4<f32> { return straight(textureSampleLevel(src, samp, uv, 0.0)); }
+/** Premultiplied color of the layer at a uv (filtered). */
+fn sampleP(uv : vec2<f32>) -> vec4<f32> { return textureSampleLevel(src, samp, uv, 0.0); }
+/** Straight-alpha color of the layer's texel at a pixel position (nearest). */
+fn texelS(p : vec2<f32>) -> vec4<f32> {
+ let d = vec2<i32>(textureDimensions(src));
+ let q = clamp(vec2<i32>(floor(p)), vec2<i32>(0), d - vec2<i32>(1));
+ return straight(textureLoad(src, q, 0));
+}
+fn luma(c : vec3<f32>) -> f32 { return dot(c, vec3<f32>(0.2126, 0.7152, 0.0722)); }
+fn hash12(p : vec2<f32>) -> f32 {
+ var p3 = fract(vec3<f32>(p.xyx) * 0.1031);
+ p3 += dot(p3, p3.yzx + 33.33);
+ return fract((p3.x + p3.y) * p3.z);
+}
+fn vnoise(p : vec2<f32>) -> f32 {
+ let i = floor(p);
+ let f = fract(p);
+ let u = f * f * (3.0 - 2.0 * f);
+ return mix(mix(hash12(i), hash12(i + vec2<f32>(1.0, 0.0)), u.x),
+ mix(hash12(i + vec2<f32>(0.0, 1.0)), hash12(i + vec2<f32>(1.0, 1.0)), u.x), u.y);
+}
+/** 8x8 ordered-dither threshold, 0..1. */
+fn bayer8(p : vec2<f32>) -> f32 {
+ let x = u32(p.x) & 7u;
+ let y = u32(p.y) & 7u;
+ var v = 0u;
+ for (var k = 0u; k < 3u; k++) {
+ let bx = (x >> k) & 1u;
+ let by = (y >> k) & 1u;
+ let m = ((bx ^ by) << 1u) | by;
+ v += m * (1u << (2u * (2u - k)));
+ }
+ return (f32(v) + 0.5) / 64.0;
+}
+fn rot2(a : f32) -> mat2x2<f32> { let c = cos(a); let s = sin(a); return mat2x2<f32>(c, s, -s, c); }
+@fragment fn fs(in : VSOut) -> @location(0) vec4<f32> {
+ let time = u.v[0].x;
+ let frame = u.v[0].y;
+ let amount = u.v[1].x;
+ let angle = u.v[1].y;
+ let radial = u.v[1].z;
+
+ let R = res();
+ let a = radians(angle);
+ var d = vec2<f32>(cos(a), sin(a)) * amount / R;
+ if (radial > 0.5) { d = (in.uv - 0.5) * 2.0 * amount / R; }
+ let cr = sampleP(in.uv + d);
+ let cg = sampleP(in.uv);
+ let cb = sampleP(in.uv - d);
+ return vec4<f32>(cr.r, cg.g, cb.b, max(max(cr.a, cg.a), cb.a));
+}
+`,
+];
+
+const resources = perDevice((device: GPUDevice) => ({
+ layout: fragmentBindGroupLayout(
+ device,
+ ["uniform", "texture", "texture", "sampler"],
+ `${OP}_layout`,
+ ),
+ pipelines: new Map<GPUTextureFormat, GPURenderPipeline[]>(),
+ sampler: device.createSampler({
+ magFilter: "linear",
+ minFilter: "linear",
+ addressModeU: "clamp-to-edge",
+ addressModeV: "clamp-to-edge",
+ }),
+}));
+
+function pipelinesFor(
+ device: GPUDevice,
+ format: GPUTextureFormat,
+): GPURenderPipeline[] {
+ const r = resources(device);
+ let list = r.pipelines.get(format);
+ if (!list) {
+ list = PASSES.map((code, i) => {
+ const module = device.createShaderModule({
+ code,
+ label: `${OP}_${i}.wgsl`,
+ });
+ return device.createRenderPipeline({
+ label: `${OP}_${i}`,
+ layout: device.createPipelineLayout({ bindGroupLayouts: [r.layout] }),
+ vertex: { module, entryPoint: "vs" },
+ fragment: { module, entryPoint: "fs", targets: [{ format }] },
+ primitive: { topology: "triangle-strip" },
+ });
+ });
+ r.pipelines.set(format, list);
+ }
+ return list;
+}
+
+function num(v: unknown, fallback: number): number {
+ const n = typeof v === "number" ? v : Number(v);
+ return Number.isFinite(n) ? n : fallback;
+}
+
+/** Packs the effect's resolved props into the uniform block the shaders read. */
+function pack(
+ raw: Record<string, unknown>,
+ data: Float32Array,
+ time: number,
+ frame: number,
+): void {
+ data.fill(0);
+ data[0] = time;
+ data[1] = frame;
+ data[4] = num(raw.amount, 8);
+ data[5] = num(raw.angle, 0);
+ data[6] = raw.radial === undefined ? 0 : raw.radial ? 1 : 0;
+}
+
+export const RGBSplitWebGPURenderer: WebGPUNodeRenderer = async (args) => {
+ const {
+ ctx,
+ encoder,
+ pass,
+ targetTexture,
+ targetWidth,
+ targetHeight,
+ props,
+ } = args;
+ const op = props.virtualMedia?.operation as
+ | ({
+ op?: string;
+ effect?: {
+ resolveUniforms?: (ctx: unknown) => Record<string, unknown>;
+ };
+ } & Record<string, unknown>)
+ | undefined;
+ if (op?.op !== OP) return;
+ const child = props.virtualMedia?.children?.[0];
+ if (!child) return;
+ pass.end();
+
+ const fps = props.fps || 30;
+ const frame = Math.round(props.compositionFrame ?? props.frame ?? 0);
+ const raw = op.effect?.resolveUniforms
+ ? op.effect.resolveUniforms({ frame, fps, time: frame / fps })
+ : op;
+ const data = new Float32Array(UNIFORM_FLOATS);
+ pack(raw, data, frame / fps, frame);
+
+ const { texture: childTex } = await drawChildToTexture(args, child);
+ const device = ctx.device;
+ const r = resources(device);
+ const pipelines = pipelinesFor(device, ctx.renderer.format);
+ const ubo = ctx.renderer.getTemporaryBuffer(data);
+ let prev = childTex;
+ for (const pipeline of pipelines) {
+ const out = ctx.renderer.getTemporaryTexture(targetWidth, targetHeight, [
+ childTex,
+ prev,
+ targetTexture,
+ ...(props.excludeTextures || []),
+ ]);
+ drawFullscreenPass(encoder, out.createView(), pipeline, [
+ device.createBindGroup({
+ layout: r.layout,
+ entries: [
+ { binding: 0, resource: { buffer: ubo } },
+ { binding: 1, resource: childTex.createView() },
+ { binding: 2, resource: prev.createView() },
+ { binding: 3, resource: r.sampler },
+ ],
+ }),
+ ]);
+ prev = out;
+ }
+ drawTextureToTarget(args, prev);
+};
diff --git a/nodes/node-rgb-split/src/shared/config.ts b/nodes/node-rgb-split/src/shared/config.ts
new file mode 100644
index 00000000..df64b150
--- /dev/null
+++ b/nodes/node-rgb-split/src/shared/config.ts
@@ -0,0 +1,25 @@
+import { configBuilder } from "@framefields/node-sdk";
+import { z } from "zod";
+
+export const rGBSplitConfig = configBuilder()
+ .field("amount", z.number().min(0).max(200).default(8), {
+ bindable: true,
+ dataTypes: ["Number", "Signal"],
+ label: "amount",
+ description: "Split distance, px.",
+ })
+ .field("angle", z.number().min(-360).max(360).default(0), {
+ bindable: true,
+ dataTypes: ["Number", "Signal"],
+ label: "angle",
+ description: "Split direction, degrees (linear mode).",
+ })
+ .field("radial", z.boolean().default(false), {
+ bindable: false,
+ label: "radial",
+ description: "Split outward from the center instead of along `angle`.",
+ })
+ .build();
+
+export const RGBSplitNodeConfigSchema = rGBSplitConfig.schema;
+export type RGBSplitNodeConfig = z.infer<typeof RGBSplitNodeConfigSchema>;
diff --git a/nodes/node-rgb-split/src/shared/index.ts b/nodes/node-rgb-split/src/shared/index.ts
new file mode 100644
index 00000000..d1bc97e8
--- /dev/null
+++ b/nodes/node-rgb-split/src/shared/index.ts
@@ -0,0 +1 @@
+export * from "./config.js";
diff --git a/nodes/node-rgb-split/tsconfig.json b/nodes/node-rgb-split/tsconfig.json
new file mode 100644
index 00000000..5a0b963f
--- /dev/null
+++ b/nodes/node-rgb-split/tsconfig.json
@@ -0,0 +1,12 @@
+{
+ "extends": "@framefields/tsconfig/node-library.json",
+ "compilerOptions": {
+ "baseUrl": ".",
+ "paths": {
+ "@/*": ["./src/*"]
+ },
+ "experimentalDecorators": true,
+ "emitDecoratorMetadata": true
+ },
+ "include": ["src"]
+}
diff --git a/nodes/node-rgb-split/tsdown.config.ts b/nodes/node-rgb-split/tsdown.config.ts
new file mode 100644
index 00000000..73f5c2fc
--- /dev/null
+++ b/nodes/node-rgb-split/tsdown.config.ts
@@ -0,0 +1,13 @@
+import { defineConfig } from "tsdown";
+
+export default defineConfig({
+ entry: {
+ index: "src/index.ts",
+ renderer: "src/renderers/index.ts",
+ },
+ format: ["esm"],
+ dts: true,
+ clean: true,
+ sourcemap: true,
+ treeshake: true,
+});
diff --git a/nodes/node-toon/package.json b/nodes/node-toon/package.json
new file mode 100644
index 00000000..2a395a95
--- /dev/null
+++ b/nodes/node-toon/package.json
@@ -0,0 +1,45 @@
+{
+ "name": "@framefields/node-toon",
+ "version": "2.2.0",
+ "private": false,
+ "framefields": {
+ "type": "Toon",
+ "kind": "effect",
+ "schema": "ToonNodeConfigSchema"
+ },
+ "type": "module",
+ "license": "Apache-2.0",
+ "exports": {
+ ".": {
+ "types": "./dist/index.d.mts",
+ "development": "./src/index.ts",
+ "import": "./dist/index.mjs",
+ "default": "./dist/index.mjs"
+ },
+ "./renderer": {
+ "types": "./dist/renderer.d.mts",
+ "development": "./src/renderers/index.ts",
+ "import": "./dist/renderer.mjs",
+ "default": "./dist/renderer.mjs"
+ }
+ },
+ "scripts": {
+ "build": "tsdown",
+ "dev": "tsdown --watch",
+ "clean": "rm -rf dist .turbo"
+ },
+ "dependencies": {
+ "@framefields/node-sdk": "workspace:*",
+ "zod": "^4.3.6"
+ },
+ "devDependencies": {
+ "@framefields/tsconfig": "workspace:*",
+ "@types/node": "^24.1.0",
+ "tsdown": "^0.19.0",
+ "typescript": "^5.8.3",
+ "webgpu": "^0.4.0"
+ },
+ "publishConfig": {
+ "access": "public"
+ }
+}
diff --git a/nodes/node-toon/src/index.ts b/nodes/node-toon/src/index.ts
new file mode 100644
index 00000000..944d702e
--- /dev/null
+++ b/nodes/node-toon/src/index.ts
@@ -0,0 +1,2 @@
+export * from "./renderers/index.js";
+export * from "./shared/index.js";
diff --git a/nodes/node-toon/src/renderers/index.ts b/nodes/node-toon/src/renderers/index.ts
new file mode 100644
index 00000000..6cace3cc
--- /dev/null
+++ b/nodes/node-toon/src/renderers/index.ts
@@ -0,0 +1,7 @@
+import { defineRenderer } from "@framefields/node-sdk/renderer";
+import { ToonWebGPURenderer } from "./webgpu-renderer.js";
+
+export default defineRenderer({
+ WebGPURenderer: ToonWebGPURenderer,
+});
+export { ToonWebGPURenderer };
diff --git a/nodes/node-toon/src/renderers/webgpu-renderer.ts b/nodes/node-toon/src/renderers/webgpu-renderer.ts
new file mode 100644
index 00000000..b7df3c23
--- /dev/null
+++ b/nodes/node-toon/src/renderers/webgpu-renderer.ts
@@ -0,0 +1,233 @@
+/// <reference types="webgpu" />
+/**
+ * Toon: Cel shading with ink outlines: brightness stepped into flat bands (hue kept), Sobel edges drawn in `edgeColor`. With HalftoneScreen it reads as a comic panel.
+ */
+import type { WebGPUNodeRenderer } from "@framefields/node-sdk";
+import {
+ drawChildToTexture,
+ drawFullscreenPass,
+ drawTextureToTarget,
+ FULLSCREEN_QUAD_WGSL,
+ fragmentBindGroupLayout,
+ perDevice,
+} from "@framefields/node-sdk/gpu";
+
+const OP = "Toon";
+const UNIFORM_FLOATS = 12;
+
+/** One fragment shader per pass; pass 0 reads the layer, later passes read the previous pass. */
+const PASSES = [
+ `struct U { v : array<vec4<f32>, 3> };
+@group(0) @binding(0) var<uniform> u : U;
+@group(0) @binding(1) var src : texture_2d<f32>;
+@group(0) @binding(2) var prev : texture_2d<f32>;
+@group(0) @binding(3) var samp : sampler;
+${FULLSCREEN_QUAD_WGSL}
+
+fn straight(c : vec4<f32>) -> vec4<f32> {
+ if (c.a <= 0.0001) { return vec4<f32>(0.0); }
+ return vec4<f32>(c.rgb / c.a, c.a);
+}
+fn premul(c : vec4<f32>) -> vec4<f32> { return vec4<f32>(c.rgb * c.a, c.a); }
+fn res() -> vec2<f32> { return vec2<f32>(textureDimensions(src)); }
+/** Straight-alpha color of the layer at a uv (filtered). */
+fn sampleS(uv : vec2<f32>) -> vec4<f32> { return straight(textureSampleLevel(src, samp, uv, 0.0)); }
+/** Premultiplied color of the layer at a uv (filtered). */
+fn sampleP(uv : vec2<f32>) -> vec4<f32> { return textureSampleLevel(src, samp, uv, 0.0); }
+/** Straight-alpha color of the layer's texel at a pixel position (nearest). */
+fn texelS(p : vec2<f32>) -> vec4<f32> {
+ let d = vec2<i32>(textureDimensions(src));
+ let q = clamp(vec2<i32>(floor(p)), vec2<i32>(0), d - vec2<i32>(1));
+ return straight(textureLoad(src, q, 0));
+}
+fn luma(c : vec3<f32>) -> f32 { return dot(c, vec3<f32>(0.2126, 0.7152, 0.0722)); }
+fn hash12(p : vec2<f32>) -> f32 {
+ var p3 = fract(vec3<f32>(p.xyx) * 0.1031);
+ p3 += dot(p3, p3.yzx + 33.33);
+ return fract((p3.x + p3.y) * p3.z);
+}
+fn vnoise(p : vec2<f32>) -> f32 {
+ let i = floor(p);
+ let f = fract(p);
+ let u = f * f * (3.0 - 2.0 * f);
+ return mix(mix(hash12(i), hash12(i + vec2<f32>(1.0, 0.0)), u.x),
+ mix(hash12(i + vec2<f32>(0.0, 1.0)), hash12(i + vec2<f32>(1.0, 1.0)), u.x), u.y);
+}
+/** 8x8 ordered-dither threshold, 0..1. */
+fn bayer8(p : vec2<f32>) -> f32 {
+ let x = u32(p.x) & 7u;
+ let y = u32(p.y) & 7u;
+ var v = 0u;
+ for (var k = 0u; k < 3u; k++) {
+ let bx = (x >> k) & 1u;
+ let by = (y >> k) & 1u;
+ let m = ((bx ^ by) << 1u) | by;
+ v += m * (1u << (2u * (2u - k)));
+ }
+ return (f32(v) + 0.5) / 64.0;
+}
+fn rot2(a : f32) -> mat2x2<f32> { let c = cos(a); let s = sin(a); return mat2x2<f32>(c, s, -s, c); }
+@fragment fn fs(in : VSOut) -> @location(0) vec4<f32> {
+ let time = u.v[0].x;
+ let frame = u.v[0].y;
+ let levels = u.v[1].x;
+ let edgeThreshold = u.v[1].y;
+ let edgeWidth = u.v[1].z;
+ let edgeColor = u.v[2];
+ let saturation = u.v[1].w;
+
+ let R = res();
+ let o = edgeWidth / R;
+ let c = sampleS(in.uv);
+ let tl = luma(sampleS(in.uv + vec2<f32>(-o.x, -o.y)).rgb);
+ let t = luma(sampleS(in.uv + vec2<f32>(0.0, -o.y)).rgb);
+ let tr = luma(sampleS(in.uv + vec2<f32>(o.x, -o.y)).rgb);
+ let l = luma(sampleS(in.uv + vec2<f32>(-o.x, 0.0)).rgb);
+ let r = luma(sampleS(in.uv + vec2<f32>(o.x, 0.0)).rgb);
+ let bl = luma(sampleS(in.uv + vec2<f32>(-o.x, o.y)).rgb);
+ let b = luma(sampleS(in.uv + vec2<f32>(0.0, o.y)).rgb);
+ let br = luma(sampleS(in.uv + vec2<f32>(o.x, o.y)).rgb);
+ let gx = (tr + 2.0 * r + br) - (tl + 2.0 * l + bl);
+ let gy = (bl + 2.0 * b + br) - (tl + 2.0 * t + tr);
+ let edge = length(vec2<f32>(gx, gy));
+ let ink = smoothstep(edgeThreshold, edgeThreshold * 1.5 + 0.03, edge);
+ let lum = luma(c.rgb);
+ let band = (floor(lum * levels) + 0.5) / levels;
+ var rgb = c.rgb * (band / max(lum, 0.001));
+ rgb = clamp(mix(vec3<f32>(luma(rgb)), rgb, saturation), vec3<f32>(0.0), vec3<f32>(1.0));
+ rgb = mix(rgb, edgeColor.rgb, ink);
+ return premul(vec4<f32>(rgb, max(c.a, ink * c.a)));
+}
+`,
+];
+
+const resources = perDevice((device: GPUDevice) => ({
+ layout: fragmentBindGroupLayout(
+ device,
+ ["uniform", "texture", "texture", "sampler"],
+ `${OP}_layout`,
+ ),
+ pipelines: new Map<GPUTextureFormat, GPURenderPipeline[]>(),
+ sampler: device.createSampler({
+ magFilter: "linear",
+ minFilter: "linear",
+ addressModeU: "clamp-to-edge",
+ addressModeV: "clamp-to-edge",
+ }),
+}));
+
+function pipelinesFor(
+ device: GPUDevice,
+ format: GPUTextureFormat,
+): GPURenderPipeline[] {
+ const r = resources(device);
+ let list = r.pipelines.get(format);
+ if (!list) {
+ list = PASSES.map((code, i) => {
+ const module = device.createShaderModule({
+ code,
+ label: `${OP}_${i}.wgsl`,
+ });
+ return device.createRenderPipeline({
+ label: `${OP}_${i}`,
+ layout: device.createPipelineLayout({ bindGroupLayouts: [r.layout] }),
+ vertex: { module, entryPoint: "vs" },
+ fragment: { module, entryPoint: "fs", targets: [{ format }] },
+ primitive: { topology: "triangle-strip" },
+ });
+ });
+ r.pipelines.set(format, list);
+ }
+ return list;
+}
+
+function num(v: unknown, fallback: number): number {
+ const n = typeof v === "number" ? v : Number(v);
+ return Number.isFinite(n) ? n : fallback;
+}
+
+function hexToRgba(hex: string): [number, number, number, number] {
+ let h = hex.trim().replace("#", "");
+ if (h.length === 3 || h.length === 4) {
+ h = [...h].map((c) => c + c).join("");
+ }
+ const n = (i: number) => Number.parseInt(h.slice(i, i + 2), 16) / 255;
+ return [n(0), n(2), n(4), h.length >= 8 ? n(6) : 1];
+}
+
+/** Packs the effect's resolved props into the uniform block the shaders read. */
+function pack(
+ raw: Record<string, unknown>,
+ data: Float32Array,
+ time: number,
+ frame: number,
+): void {
+ data.fill(0);
+ data[0] = time;
+ data[1] = frame;
+ data[4] = num(raw.levels, 4);
+ data[5] = num(raw.edgeThreshold, 0.2);
+ data[6] = num(raw.edgeWidth, 1);
+ data.set(hexToRgba(String(raw.edgeColor ?? "#111111")), 8);
+ data[7] = num(raw.saturation, 1.15);
+}
+
+export const ToonWebGPURenderer: WebGPUNodeRenderer = async (args) => {
+ const {
+ ctx,
+ encoder,
+ pass,
+ targetTexture,
+ targetWidth,
+ targetHeight,
+ props,
+ } = args;
+ const op = props.virtualMedia?.operation as
+ | ({
+ op?: string;
+ effect?: {
+ resolveUniforms?: (ctx: unknown) => Record<string, unknown>;
+ };
+ } & Record<string, unknown>)
+ | undefined;
+ if (op?.op !== OP) return;
+ const child = props.virtualMedia?.children?.[0];
+ if (!child) return;
+ pass.end();
+
+ const fps = props.fps || 30;
+ const frame = Math.round(props.compositionFrame ?? props.frame ?? 0);
+ const raw = op.effect?.resolveUniforms
+ ? op.effect.resolveUniforms({ frame, fps, time: frame / fps })
+ : op;
+ const data = new Float32Array(UNIFORM_FLOATS);
+ pack(raw, data, frame / fps, frame);
+
+ const { texture: childTex } = await drawChildToTexture(args, child);
+ const device = ctx.device;
+ const r = resources(device);
+ const pipelines = pipelinesFor(device, ctx.renderer.format);
+ const ubo = ctx.renderer.getTemporaryBuffer(data);
+ let prev = childTex;
+ for (const pipeline of pipelines) {
+ const out = ctx.renderer.getTemporaryTexture(targetWidth, targetHeight, [
+ childTex,
+ prev,
+ targetTexture,
+ ...(props.excludeTextures || []),
+ ]);
+ drawFullscreenPass(encoder, out.createView(), pipeline, [
+ device.createBindGroup({
+ layout: r.layout,
+ entries: [
+ { binding: 0, resource: { buffer: ubo } },
+ { binding: 1, resource: childTex.createView() },
+ { binding: 2, resource: prev.createView() },
+ { binding: 3, resource: r.sampler },
+ ],
+ }),
+ ]);
+ prev = out;
+ }
+ drawTextureToTarget(args, prev);
+};
diff --git a/nodes/node-toon/src/shared/config.ts b/nodes/node-toon/src/shared/config.ts
new file mode 100644
index 00000000..efa95d83
--- /dev/null
+++ b/nodes/node-toon/src/shared/config.ts
@@ -0,0 +1,37 @@
+import { configBuilder } from "@framefields/node-sdk";
+import { z } from "zod";
+
+export const toonConfig = configBuilder()
+ .field("levels", z.number().int().min(2).max(12).default(4), {
+ bindable: true,
+ dataTypes: ["Number", "Signal"],
+ label: "levels",
+ description: "Brightness bands.",
+ })
+ .field("edgeThreshold", z.number().min(0).max(1).default(0.2), {
+ bindable: true,
+ dataTypes: ["Number", "Signal"],
+ label: "edgeThreshold",
+ description: "How strong an edge must be to get ink, 0\u20131.",
+ })
+ .field("edgeWidth", z.number().min(0.5).max(4).default(1), {
+ bindable: true,
+ dataTypes: ["Number", "Signal"],
+ label: "edgeWidth",
+ description: "Ink line width, px.",
+ })
+ .field("edgeColor", z.string().default("#111111"), {
+ bindable: false,
+ label: "edgeColor",
+ description: "Ink color.",
+ })
+ .field("saturation", z.number().min(0).max(2).default(1.15), {
+ bindable: true,
+ dataTypes: ["Number", "Signal"],
+ label: "saturation",
+ description: "Color saturation after banding.",
+ })
+ .build();
+
+export const ToonNodeConfigSchema = toonConfig.schema;
+export type ToonNodeConfig = z.infer<typeof ToonNodeConfigSchema>;
diff --git a/nodes/node-toon/src/shared/index.ts b/nodes/node-toon/src/shared/index.ts
new file mode 100644
index 00000000..d1bc97e8
--- /dev/null
+++ b/nodes/node-toon/src/shared/index.ts
@@ -0,0 +1 @@
+export * from "./config.js";
diff --git a/nodes/node-toon/tsconfig.json b/nodes/node-toon/tsconfig.json
new file mode 100644
index 00000000..5a0b963f
--- /dev/null
+++ b/nodes/node-toon/tsconfig.json
@@ -0,0 +1,12 @@
+{
+ "extends": "@framefields/tsconfig/node-library.json",
+ "compilerOptions": {
+ "baseUrl": ".",
+ "paths": {
+ "@/*": ["./src/*"]
+ },
+ "experimentalDecorators": true,
+ "emitDecoratorMetadata": true
+ },
+ "include": ["src"]
+}
diff --git a/nodes/node-toon/tsdown.config.ts b/nodes/node-toon/tsdown.config.ts
new file mode 100644
index 00000000..73f5c2fc
--- /dev/null
+++ b/nodes/node-toon/tsdown.config.ts
@@ -0,0 +1,13 @@
+import { defineConfig } from "tsdown";
+
+export default defineConfig({
+ entry: {
+ index: "src/index.ts",
+ renderer: "src/renderers/index.ts",
+ },
+ format: ["esm"],
+ dts: true,
+ clean: true,
+ sourcemap: true,
+ treeshake: true,
+});
diff --git a/packages/compositions/src/program/animation.ts b/packages/compositions/src/program/animation.ts
index 0f2bfac6..d1e6f728 100644
--- a/packages/compositions/src/program/animation.ts
+++ b/packages/compositions/src/program/animation.ts
@@ -276,6 +276,8 @@ function parseEase(ease?: string | EaseRef): EaseRef | undefined {
*/
export class LayerAnimation implements LayerAnimationSpec {
public tracks: AnimationTrack[] = [];
+ /** Hold each value for this many frames (see {@link LayerAnimation.stepped}). */
+ public frameStep?: number;
constructor(tracks: AnimationTrack[] = []) {
this.tracks = [...tracks];
@@ -285,6 +287,22 @@ export class LayerAnimation implements LayerAnimationSpec {
return new LayerAnimation();
}
+ /**
+ * Stepped timing for the whole layer: every animated value is held for
+ * `frames` frames ("on twos" = 2, "on threes" = 3), the choppy, hand-made
+ * look of stop motion and cel animation. Applies to all of the layer's
+ * tracks, including ones added by other `.animate()` calls.
+ */
+ public static stepped(frames = 2): LayerAnimation {
+ return new LayerAnimation().stepped(frames);
+ }
+
+ /** See {@link LayerAnimation.stepped}. */
+ public stepped(frames = 2): this {
+ this.frameStep = Math.max(1, Math.min(24, Math.round(frames)));
+ return this;
+ }
+
public static fromTo(
prop: AnimatableProp,
fromValue: number | string | boolean,
diff --git a/packages/compositions/src/program/evaluator.ts b/packages/compositions/src/program/evaluator.ts
index 22979b10..9f2ae339 100644
--- a/packages/compositions/src/program/evaluator.ts
+++ b/packages/compositions/src/program/evaluator.ts
@@ -1,7 +1,9 @@
import { mixColors } from "@framefields/core";
import { signalRegistry } from "@framefields/webgpu-renderers";
+import { morphPath } from "./path-morph.js";
import type {
AnimationTrack,
+ EaseRef,
LayerAnimationSpec as LayerAnimation,
TrackSource,
} from "./schema.js";
@@ -639,6 +641,11 @@ const COLOR_PROPS = new Set([
export function evaluateKeyframes(
track: AnimationTrack,
localFrame: number,
+ /**
+ * Shapes a segment's progress by its ease (`kf1.ease ?? kf0.ease`); the
+ * compositor passes GSAP's eases. Linear when omitted.
+ */
+ ease?: (ease: EaseRef | undefined, deltaFrames: number, t: number) => number,
): number | boolean | string {
const keyframes = track.keyframes ?? [];
if (keyframes.length === 0) return 0;
@@ -657,13 +664,15 @@ export function evaluateKeyframes(
if (localFrame >= kf0.frame && localFrame <= kf1.frame) {
const delta = kf1.frame - kf0.frame;
- const t = delta > 0 ? (localFrame - kf0.frame) / delta : 0;
+ const linear = delta > 0 ? (localFrame - kf0.frame) / delta : 0;
+ const t = ease ? ease(kf1.ease ?? kf0.ease, delta, linear) : linear;
if (typeof kf0.value === "boolean") {
- return t >= 1 ? kf1.value : kf0.value;
+ return linear >= 1 ? kf1.value : kf0.value;
}
if (typeof kf0.value === "string" && typeof kf1.value === "string") {
+ if (track.prop === "d") return morphPath(kf0.value, kf1.value, t);
return lerpColor(kf0.value, kf1.value, t);
}
diff --git a/packages/compositions/src/program/index.ts b/packages/compositions/src/program/index.ts
index 7fc1e151..46550fc0 100644
--- a/packages/compositions/src/program/index.ts
+++ b/packages/compositions/src/program/index.ts
@@ -11,6 +11,7 @@ export * from "./animation.js";
export * from "./evaluator.js";
export * from "./lint.js";
export * from "./mattes.js";
+export * from "./path-morph.js";
export * from "./schema.js";
export * from "./sequence.js";
export * from "./stagger.js";
diff --git a/packages/compositions/src/program/path-morph.test.ts b/packages/compositions/src/program/path-morph.test.ts
new file mode 100644
index 00000000..d327b018
--- /dev/null
+++ b/packages/compositions/src/program/path-morph.test.ts
@@ -0,0 +1,47 @@
+import { describe, expect, it } from "vitest";
+import { flattenPath, morphPath } from "./path-morph.js";
+
+const nums = (d: string) => (d.match(/-?\d+(\.\d+)?/g) ?? []).map(Number);
+
+describe("morphPath", () => {
+ it("returns the end paths at 0 and 1", () => {
+ expect(morphPath("M0 0L10 0L10 10Z", "M0 0L20 0L20 20Z", 0)).toBe(
+ "M0 0L10 0L10 10Z",
+ );
+ expect(morphPath("M0 0L10 0L10 10Z", "M0 0L20 0L20 20Z", 1)).toBe(
+ "M0 0L20 0L20 20Z",
+ );
+ });
+
+ it("halfway between a small and a big square is a medium square", () => {
+ const d = morphPath("M40 40 H60 V60 H40 Z", "M0 0 H100 V100 H0 Z", 0.5);
+ const v = nums(d);
+ const xs = v.filter((_, i) => i % 2 === 0);
+ const ys = v.filter((_, i) => i % 2 === 1);
+ expect(Math.min(...xs)).toBeCloseTo(20, 0);
+ expect(Math.max(...xs)).toBeCloseTo(80, 0);
+ expect(Math.min(...ys)).toBeCloseTo(20, 0);
+ expect(Math.max(...ys)).toBeCloseTo(80, 0);
+ expect(d.endsWith("Z")).toBe(true);
+ });
+
+ it("lines up paths that start at different corners or wind the other way", () => {
+ // Same square, started at the opposite corner and drawn counter-clockwise.
+ const a = "M0 0 H100 V100 H0 Z";
+ const b = "M100 100 V0 H0 V100 Z";
+ const v = nums(morphPath(a, b, 0.5));
+ // Matched point for point, the halfway shape is the square itself.
+ const xs = v.filter((_, i) => i % 2 === 0);
+ expect(Math.min(...xs)).toBeCloseTo(0, 0);
+ expect(Math.max(...xs)).toBeCloseTo(100, 0);
+ });
+
+ it("flattens curves and arcs", () => {
+ const [circle] = flattenPath(
+ "M50 0 A50 50 0 1 1 49.99 0 Z M0 0 C0 10 10 10 10 0",
+ );
+ for (const [x, y] of circle.pts) {
+ expect(Math.hypot(x - 50, y - 50)).toBeCloseTo(50, 0);
+ }
+ });
+});
diff --git a/packages/compositions/src/program/path-morph.ts b/packages/compositions/src/program/path-morph.ts
new file mode 100644
index 00000000..9cdaa02b
--- /dev/null
+++ b/packages/compositions/src/program/path-morph.ts
@@ -0,0 +1,402 @@
+/**
+ * Shape morphing: interpolates between two SVG path strings.
+ *
+ * Both paths are flattened to polylines, resampled to the same number of
+ * points by arc length, and the second is rotated (and reversed if it winds
+ * the other way) so its points line up with the first's. Subpaths pair up in
+ * order; a subpath with no partner grows from (or shrinks to) the center of
+ * the one it pairs with. The result is a polygon path string.
+ */
+
+type Pt = [number, number];
+interface Sub {
+ pts: Pt[];
+ closed: boolean;
+}
+
+const SAMPLES = 128;
+const CURVE_STEPS = 16;
+
+const NUM_RE = /-?(?:\d+\.?\d*|\.\d+)(?:e[-+]?\d+)?/gi;
+const CMD_RE = /([MmLlHhVvCcSsQqTtAaZz])([^MmLlHhVvCcSsQqTtAaZz]*)/g;
+
+/** Flattens an SVG path into polylines, one per subpath. */
+export function flattenPath(d: string): Sub[] {
+ const subs: Sub[] = [];
+ let cur: Pt[] = [];
+ let x = 0;
+ let y = 0;
+ let sx = 0;
+ let sy = 0;
+ // Last control point, for S/T reflection.
+ let cx = 0;
+ let cy = 0;
+ let prev = "";
+ const end = (closed: boolean) => {
+ if (cur.length > 1) subs.push({ pts: cur, closed });
+ cur = [];
+ };
+ for (const m of d.matchAll(CMD_RE)) {
+ const cmd = m[1];
+ const nums = (m[2].match(NUM_RE) ?? []).map(Number);
+ const rel = cmd === cmd.toLowerCase();
+ const C = cmd.toUpperCase();
+ let i = 0;
+ const take = (n: number) => {
+ const v = nums.slice(i, i + n);
+ i += n;
+ return v;
+ };
+ const has = (n: number) => i + n <= nums.length;
+ if (C === "Z") {
+ x = sx;
+ y = sy;
+ end(true);
+ cur = [[x, y]];
+ prev = C;
+ continue;
+ }
+ let first = true;
+ while (
+ has(
+ C === "H" || C === "V"
+ ? 1
+ : C === "A"
+ ? 7
+ : C === "C"
+ ? 6
+ : C === "S" || C === "Q"
+ ? 4
+ : 2,
+ )
+ ) {
+ if (C === "M") {
+ const [a, b] = take(2);
+ x = rel ? x + a : a;
+ y = rel ? y + b : b;
+ if (first) {
+ end(false);
+ sx = x;
+ sy = y;
+ cur = [[x, y]];
+ } else cur.push([x, y]);
+ } else if (C === "L" || C === "T") {
+ const [a, b] = take(2);
+ const nx = rel ? x + a : a;
+ const ny = rel ? y + b : b;
+ if (C === "T") {
+ const qx = prev === "Q" || prev === "T" ? 2 * x - cx : x;
+ const qy = prev === "Q" || prev === "T" ? 2 * y - cy : y;
+ quad(cur, x, y, qx, qy, nx, ny);
+ cx = qx;
+ cy = qy;
+ } else cur.push([nx, ny]);
+ x = nx;
+ y = ny;
+ } else if (C === "H") {
+ const [a] = take(1);
+ x = rel ? x + a : a;
+ cur.push([x, y]);
+ } else if (C === "V") {
+ const [a] = take(1);
+ y = rel ? y + a : a;
+ cur.push([x, y]);
+ } else if (C === "C" || C === "S") {
+ let x1: number;
+ let y1: number;
+ if (C === "C") {
+ const [a, b] = take(2);
+ x1 = rel ? x + a : a;
+ y1 = rel ? y + b : b;
+ } else {
+ x1 = prev === "C" || prev === "S" ? 2 * x - cx : x;
+ y1 = prev === "C" || prev === "S" ? 2 * y - cy : y;
+ }
+ const [c, e, f, g] = take(4);
+ const x2 = rel ? x + c : c;
+ const y2 = rel ? y + e : e;
+ const nx = rel ? x + f : f;
+ const ny = rel ? y + g : g;
+ for (let k = 1; k <= CURVE_STEPS; k++) {
+ const t = k / CURVE_STEPS;
+ const u = 1 - t;
+ cur.push([
+ u * u * u * x +
+ 3 * u * u * t * x1 +
+ 3 * u * t * t * x2 +
+ t * t * t * nx,
+ u * u * u * y +
+ 3 * u * u * t * y1 +
+ 3 * u * t * t * y2 +
+ t * t * t * ny,
+ ]);
+ }
+ cx = x2;
+ cy = y2;
+ x = nx;
+ y = ny;
+ } else if (C === "Q") {
+ const [a, b, c, e] = take(4);
+ const qx = rel ? x + a : a;
+ const qy = rel ? y + b : b;
+ const nx = rel ? x + c : c;
+ const ny = rel ? y + e : e;
+ quad(cur, x, y, qx, qy, nx, ny);
+ cx = qx;
+ cy = qy;
+ x = nx;
+ y = ny;
+ } else if (C === "A") {
+ const [rx, ry, rot, large, sweep, a, b] = take(7);
+ const nx = rel ? x + a : a;
+ const ny = rel ? y + b : b;
+ arc(cur, x, y, rx, ry, rot, large !== 0, sweep !== 0, nx, ny);
+ x = nx;
+ y = ny;
+ }
+ first = false;
+ prev = C;
+ if (C === "M") prev = "L";
+ }
+ prev = C;
+ }
+ end(false);
+ return subs;
+}
+
+function quad(
+ out: Pt[],
+ x0: number,
+ y0: number,
+ qx: number,
+ qy: number,
+ x1: number,
+ y1: number,
+) {
+ for (let k = 1; k <= CURVE_STEPS; k++) {
+ const t = k / CURVE_STEPS;
+ const u = 1 - t;
+ out.push([
+ u * u * x0 + 2 * u * t * qx + t * t * x1,
+ u * u * y0 + 2 * u * t * qy + t * t * y1,
+ ]);
+ }
+}
+
+/** SVG endpoint arc → points (spec F.6.5). */
+function arc(
+ out: Pt[],
+ x1: number,
+ y1: number,
+ rxIn: number,
+ ryIn: number,
+ rotDeg: number,
+ large: boolean,
+ sweep: boolean,
+ x2: number,
+ y2: number,
+) {
+ let rx = Math.abs(rxIn);
+ let ry = Math.abs(ryIn);
+ if (rx === 0 || ry === 0) {
+ out.push([x2, y2]);
+ return;
+ }
+ const phi = (rotDeg * Math.PI) / 180;
+ const cos = Math.cos(phi);
+ const sin = Math.sin(phi);
+ const dx = (x1 - x2) / 2;
+ const dy = (y1 - y2) / 2;
+ const xp = cos * dx + sin * dy;
+ const yp = -sin * dx + cos * dy;
+ const lam = (xp * xp) / (rx * rx) + (yp * yp) / (ry * ry);
+ if (lam > 1) {
+ rx *= Math.sqrt(lam);
+ ry *= Math.sqrt(lam);
+ }
+ const num = rx * rx * ry * ry - rx * rx * yp * yp - ry * ry * xp * xp;
+ const den = rx * rx * yp * yp + ry * ry * xp * xp;
+ let co = Math.sqrt(Math.max(0, num / den));
+ if (large === sweep) co = -co;
+ const cxp = (co * rx * yp) / ry;
+ const cyp = (-co * ry * xp) / rx;
+ const ccx = cos * cxp - sin * cyp + (x1 + x2) / 2;
+ const ccy = sin * cxp + cos * cyp + (y1 + y2) / 2;
+ const ang = (ux: number, uy: number, vx: number, vy: number) =>
+ Math.atan2(ux * vy - uy * vx, ux * vx + uy * vy);
+ const t1 = ang(1, 0, (xp - cxp) / rx, (yp - cyp) / ry);
+ let dt = ang(
+ (xp - cxp) / rx,
+ (yp - cyp) / ry,
+ (-xp - cxp) / rx,
+ (-yp - cyp) / ry,
+ );
+ if (!sweep && dt > 0) dt -= 2 * Math.PI;
+ if (sweep && dt < 0) dt += 2 * Math.PI;
+ const steps = Math.max(
+ 4,
+ Math.ceil((Math.abs(dt) / (Math.PI / 2)) * CURVE_STEPS),
+ );
+ for (let k = 1; k <= steps; k++) {
+ const t = t1 + (dt * k) / steps;
+ const ex = rx * Math.cos(t);
+ const ey = ry * Math.sin(t);
+ out.push([cos * ex - sin * ey + ccx, sin * ex + cos * ey + ccy]);
+ }
+}
+
+/** `n` points evenly spaced along a polyline (closed: around the loop). */
+function resample(sub: Sub, n: number): Pt[] {
+ const pts = sub.closed ? [...sub.pts, sub.pts[0]] : sub.pts;
+ const cum = [0];
+ for (let i = 1; i < pts.length; i++) {
+ cum.push(
+ cum[i - 1] +
+ Math.hypot(pts[i][0] - pts[i - 1][0], pts[i][1] - pts[i - 1][1]),
+ );
+ }
+ const total = cum[cum.length - 1];
+ const out: Pt[] = [];
+ if (total <= 0) {
+ for (let i = 0; i < n; i++) out.push([pts[0][0], pts[0][1]]);
+ return out;
+ }
+ const count = sub.closed ? n : n - 1;
+ let j = 0;
+ for (let i = 0; i < n; i++) {
+ const s = (total * i) / count;
+ while (j < cum.length - 2 && cum[j + 1] < s) j++;
+ const seg = cum[j + 1] - cum[j];
+ const t = seg > 0 ? (s - cum[j]) / seg : 0;
+ out.push([
+ pts[j][0] + (pts[j + 1][0] - pts[j][0]) * t,
+ pts[j][1] + (pts[j + 1][1] - pts[j][1]) * t,
+ ]);
+ }
+ return out;
+}
+
+function area(p: Pt[]): number {
+ let a = 0;
+ for (let i = 0; i < p.length; i++) {
+ const q = p[(i + 1) % p.length];
+ a += p[i][0] * q[1] - q[0] * p[i][1];
+ }
+ return a / 2;
+}
+
+function centroid(p: Pt[]): Pt {
+ let x = 0;
+ let y = 0;
+ for (const q of p) {
+ x += q[0];
+ y += q[1];
+ }
+ return [x / p.length, y / p.length];
+}
+
+/** Rotates (and maybe reverses) `b` so its points line up with `a`'s. */
+function align(a: Pt[], b: Pt[], closed: boolean): Pt[] {
+ if (!closed) {
+ const d0 = Math.hypot(a[0][0] - b[0][0], a[0][1] - b[0][1]);
+ const d1 = Math.hypot(
+ a[0][0] - b[b.length - 1][0],
+ a[0][1] - b[b.length - 1][1],
+ );
+ return d1 < d0 ? [...b].reverse() : b;
+ }
+ const bb = Math.sign(area(a)) !== Math.sign(area(b)) ? [...b].reverse() : b;
+ const n = a.length;
+ let best = 0;
+ let bestD = Number.POSITIVE_INFINITY;
+ // Coarse search on every 4th offset, then refine around the best.
+ const score = (k: number) => {
+ let s = 0;
+ for (let i = 0; i < n; i += 2) {
+ const q = bb[(i + k) % n];
+ s += (a[i][0] - q[0]) ** 2 + (a[i][1] - q[1]) ** 2;
+ }
+ return s;
+ };
+ for (let k = 0; k < n; k += 4) {
+ const s = score(k);
+ if (s < bestD) {
+ bestD = s;
+ best = k;
+ }
+ }
+ for (let k = best - 3; k <= best + 3; k++) {
+ const kk = (k + n) % n;
+ const s = score(kk);
+ if (s < bestD) {
+ bestD = s;
+ best = kk;
+ }
+ }
+ return a.map((_, i) => bb[(i + best) % n]);
+}
+
+interface Prepared {
+ a: Pt[][];
+ b: Pt[][];
+ closed: boolean[];
+}
+
+const memo = new Map<string, Prepared>();
+
+function prepare(from: string, to: string): Prepared {
+ const key = `${from}\u0000${to}`;
+ const hit = memo.get(key);
+ if (hit) return hit;
+ const sa = flattenPath(from);
+ const sb = flattenPath(to);
+ const n = Math.max(sa.length, sb.length);
+ const out: Prepared = { a: [], b: [], closed: [] };
+ for (let i = 0; i < n; i++) {
+ const A = sa[i];
+ const B = sb[i];
+ const closed = (A?.closed ?? true) && (B?.closed ?? true);
+ let pa = A ? resample(A, SAMPLES) : undefined;
+ let pb = B ? resample(B, SAMPLES) : undefined;
+ if (!pa && pb) {
+ const c = centroid(pb);
+ pa = pb.map(() => [c[0], c[1]] as Pt);
+ }
+ if (!pb && pa) {
+ const c = centroid(pa);
+ pb = pa.map(() => [c[0], c[1]] as Pt);
+ }
+ if (!pa || !pb) continue;
+ out.a.push(pa);
+ out.b.push(align(pa, pb, closed));
+ out.closed.push(closed);
+ }
+ if (memo.size > 256) memo.clear();
+ memo.set(key, out);
+ return out;
+}
+
+const fmt = (v: number) => (Math.round(v * 100) / 100).toString();
+
+/**
+ * The path `t` of the way from `from` to `to` (0 = `from`, 1 = `to`; `t`
+ * may overshoot for back / elastic eases).
+ */
+export function morphPath(from: string, to: string, t: number): string {
+ if (t <= 0) return from;
+ if (t === 1) return to;
+ const p = prepare(from, to);
+ const parts: string[] = [];
+ for (let s = 0; s < p.a.length; s++) {
+ const A = p.a[s];
+ const B = p.b[s];
+ let d = "";
+ for (let i = 0; i < A.length; i++) {
+ const x = A[i][0] + (B[i][0] - A[i][0]) * t;
+ const y = A[i][1] + (B[i][1] - A[i][1]) * t;
+ d += `${i === 0 ? "M" : "L"}${fmt(x)} ${fmt(y)}`;
+ }
+ parts.push(p.closed[s] ? `${d}Z` : d);
+ }
+ return parts.join("");
+}
diff --git a/packages/compositions/src/program/schema.ts b/packages/compositions/src/program/schema.ts
index bef27547..5b9d1d53 100644
--- a/packages/compositions/src/program/schema.ts
+++ b/packages/compositions/src/program/schema.ts
@@ -79,6 +79,8 @@ export const AnimatablePropSchema = z.enum([
"color",
"letterSpacing",
// Vector Shape & Stroke properties
+ /** A shape's SVG path: keyframed paths morph into each other. */
+ "d",
"trimStart",
"trimEnd",
"trimOffset",
@@ -482,6 +484,11 @@ export type AnimationTrack = z.infer<typeof AnimationTrackSchema>;
export const LayerAnimationSchema = z
.object({
tracks: z.array(AnimationTrackSchema).max(24),
+ /**
+ * Stepped timing: hold each value for this many frames ("on twos" = 2),
+ * so motion reads hand-animated / stop-motion instead of smooth.
+ */
+ frameStep: z.number().int().min(1).max(24).optional(),
})
.strict()
.superRefine(animationInvariants);
diff --git a/packages/framefields/src/effects/generated/catalog.json b/packages/framefields/src/effects/generated/catalog.json
index 71cbad13..fb3df5f1 100644
--- a/packages/framefields/src/effects/generated/catalog.json
+++ b/packages/framefields/src/effects/generated/catalog.json
@@ -1,6 +1,64 @@
{
"$comment": "Generated by scripts/generate-effects.mts. Machine-readable description of every generated effect class.",
"effects": [
+ {
+ "name": "Ascii",
+ "op": "Ascii",
+ "kind": "effect",
+ "factory": "ascii",
+ "node": "node-ascii",
+ "aliases": [],
+ "custom": null,
+ "props": [
+ {
+ "name": "cellSize",
+ "type": "EffectProp<number>",
+ "signal": true,
+ "default": 10,
+ "min": 4,
+ "max": 64,
+ "description": "Character cell size, px."
+ },
+ {
+ "name": "colorMode",
+ "type": "\"mono\" | \"source\" | \"green\"",
+ "signal": false,
+ "default": "mono",
+ "enum": ["mono", "source", "green"],
+ "description": "Glyph color: `fg`, the layer's own colors, or green phosphor."
+ },
+ {
+ "name": "fg",
+ "type": "string",
+ "signal": false,
+ "default": "#e8e8e8",
+ "description": "Glyph color (mono)."
+ },
+ {
+ "name": "bg",
+ "type": "string",
+ "signal": false,
+ "default": "#0b0b0b",
+ "description": "Background color."
+ },
+ {
+ "name": "contrast",
+ "type": "EffectProp<number>",
+ "signal": true,
+ "default": 1.2,
+ "min": 0.5,
+ "max": 3,
+ "description": "Brightness contrast before picking glyphs."
+ },
+ {
+ "name": "invert",
+ "type": "boolean",
+ "signal": false,
+ "default": false,
+ "description": "Dark areas get dense glyphs."
+ }
+ ]
+ },
{
"name": "AudioCompressor",
"op": "AudioCompressor",
@@ -696,6 +754,66 @@
}
]
},
+ {
+ "name": "Contour",
+ "op": "Contour",
+ "kind": "effect",
+ "factory": "contour",
+ "node": "node-contour",
+ "aliases": [],
+ "custom": null,
+ "props": [
+ {
+ "name": "levels",
+ "type": "EffectProp<number>",
+ "signal": true,
+ "default": 14,
+ "min": 2,
+ "max": 64,
+ "description": "Contour lines from dark to light."
+ },
+ {
+ "name": "lineWidth",
+ "type": "EffectProp<number>",
+ "signal": true,
+ "default": 1.2,
+ "min": 0.5,
+ "max": 8,
+ "description": "Line width, px."
+ },
+ {
+ "name": "lineColor",
+ "type": "string",
+ "signal": false,
+ "default": "#2b1d0e",
+ "description": "Line color."
+ },
+ {
+ "name": "fill",
+ "type": "\"source\" | \"flat\" | \"none\"",
+ "signal": false,
+ "default": "source",
+ "enum": ["source", "flat", "none"],
+ "description": "Under the lines: the layer, `fillColor`, or transparent."
+ },
+ {
+ "name": "fillColor",
+ "type": "string",
+ "signal": false,
+ "default": "#f3ead8",
+ "description": "Paper color (flat fill)."
+ },
+ {
+ "name": "smoothing",
+ "type": "EffectProp<number>",
+ "signal": true,
+ "default": 2,
+ "min": 0,
+ "max": 8,
+ "description": "Blur before tracing, px (smoother lines)."
+ }
+ ]
+ },
{
"name": "CornerPin",
"op": "CornerPin",
@@ -712,6 +830,98 @@
}
]
},
+ {
+ "name": "CRT",
+ "op": "CRT",
+ "kind": "effect",
+ "factory": "cRT",
+ "node": "node-crt",
+ "aliases": [],
+ "custom": null,
+ "props": [
+ {
+ "name": "scanlines",
+ "type": "EffectProp<number>",
+ "signal": true,
+ "default": 0.45,
+ "min": 0,
+ "max": 1,
+ "description": "Scanline darkness."
+ },
+ {
+ "name": "lineCount",
+ "type": "EffectProp<number>",
+ "signal": true,
+ "default": 540,
+ "min": 100,
+ "max": 2160,
+ "description": "Scanlines over the height."
+ },
+ {
+ "name": "curvature",
+ "type": "EffectProp<number>",
+ "signal": true,
+ "default": 0.12,
+ "min": 0,
+ "max": 1,
+ "description": "Barrel distortion of the tube."
+ },
+ {
+ "name": "mask",
+ "type": "EffectProp<number>",
+ "signal": true,
+ "default": 0.25,
+ "min": 0,
+ "max": 1,
+ "description": "RGB aperture-grille strength."
+ },
+ {
+ "name": "vignette",
+ "type": "EffectProp<number>",
+ "signal": true,
+ "default": 0.35,
+ "min": 0,
+ "max": 1,
+ "description": "Darkening toward the edges."
+ },
+ {
+ "name": "noise",
+ "type": "EffectProp<number>",
+ "signal": true,
+ "default": 0.08,
+ "min": 0,
+ "max": 1,
+ "description": "Animated static."
+ },
+ {
+ "name": "flicker",
+ "type": "EffectProp<number>",
+ "signal": true,
+ "default": 0.03,
+ "min": 0,
+ "max": 1,
+ "description": "Brightness flicker."
+ },
+ {
+ "name": "tracking",
+ "type": "EffectProp<number>",
+ "signal": true,
+ "default": 0,
+ "min": 0,
+ "max": 1,
+ "description": "VHS tracking error: line jitter and a rolling band."
+ },
+ {
+ "name": "chroma",
+ "type": "EffectProp<number>",
+ "signal": true,
+ "default": 0,
+ "min": 0,
+ "max": 20,
+ "description": "VHS color bleed, px."
+ }
+ ]
+ },
{
"name": "Datamosh",
"op": "Datamosh",
@@ -810,6 +1020,64 @@
}
]
},
+ {
+ "name": "Dither",
+ "op": "Dither",
+ "kind": "effect",
+ "factory": "dither",
+ "node": "node-dither",
+ "aliases": [],
+ "custom": null,
+ "props": [
+ {
+ "name": "mode",
+ "type": "\"bayer\" | \"noise\" | \"halftone\"",
+ "signal": false,
+ "default": "bayer",
+ "enum": ["bayer", "noise", "halftone"],
+ "description": "Pattern: Bayer matrix, blue-ish noise or round halftone dots."
+ },
+ {
+ "name": "levels",
+ "type": "EffectProp<number>",
+ "signal": true,
+ "default": 2,
+ "min": 2,
+ "max": 16,
+ "description": "Levels per channel (2 = 1-bit)."
+ },
+ {
+ "name": "scale",
+ "type": "EffectProp<number>",
+ "signal": true,
+ "default": 2,
+ "min": 1,
+ "max": 16,
+ "description": "Dither pixel size, px."
+ },
+ {
+ "name": "monochrome",
+ "type": "boolean",
+ "signal": false,
+ "default": true,
+ "description": "Map brightness to the dark → light colors instead of dithering each channel."
+ },
+ {
+ "name": "dark",
+ "type": "string",
+ "signal": false,
+ "default": "#111111",
+ "description": "Dark color (monochrome)."
+ },
+ {
+ "name": "light",
+ "type": "string",
+ "signal": false,
+ "default": "#f2efe6",
+ "description": "Light color (monochrome)."
+ }
+ ]
+ },
{
"name": "ExtractLUT",
"op": "ExtractLUT",
@@ -900,6 +1168,146 @@
}
]
},
+ {
+ "name": "Gooey",
+ "op": "Gooey",
+ "kind": "effect",
+ "factory": "gooey",
+ "node": "node-gooey",
+ "aliases": [],
+ "custom": null,
+ "props": [
+ {
+ "name": "radius",
+ "type": "EffectProp<number>",
+ "signal": true,
+ "default": 12,
+ "min": 1,
+ "max": 60,
+ "description": "Melt distance, px."
+ },
+ {
+ "name": "threshold",
+ "type": "EffectProp<number>",
+ "signal": true,
+ "default": 0.5,
+ "min": 0,
+ "max": 1,
+ "description": "Alpha cut, 0–1 (higher = thinner blobs)."
+ },
+ {
+ "name": "softness",
+ "type": "EffectProp<number>",
+ "signal": true,
+ "default": 0.04,
+ "min": 0.001,
+ "max": 0.5,
+ "description": "Edge softness."
+ }
+ ]
+ },
+ {
+ "name": "Iridescence",
+ "op": "Iridescence",
+ "kind": "effect",
+ "factory": "iridescence",
+ "node": "node-iridescence",
+ "aliases": [],
+ "custom": null,
+ "props": [
+ {
+ "name": "strength",
+ "type": "EffectProp<number>",
+ "signal": true,
+ "default": 0.6,
+ "min": 0,
+ "max": 1,
+ "description": "How much rainbow, 0–1."
+ },
+ {
+ "name": "scale",
+ "type": "EffectProp<number>",
+ "signal": true,
+ "default": 2,
+ "min": 0.1,
+ "max": 10,
+ "description": "Rainbow bands over the range."
+ },
+ {
+ "name": "shift",
+ "type": "EffectProp<number>",
+ "signal": true,
+ "default": 0,
+ "min": -3600,
+ "max": 3600,
+ "description": "Hue shift, degrees (animate it)."
+ },
+ {
+ "name": "mode",
+ "type": "\"luminance\" | \"relief\"",
+ "signal": false,
+ "default": "relief",
+ "enum": ["luminance", "relief"],
+ "description": "Bands from brightness, or from the slope of the image (foil)."
+ }
+ ]
+ },
+ {
+ "name": "Kaleidoscope",
+ "op": "Kaleidoscope",
+ "kind": "effect",
+ "factory": "kaleidoscope",
+ "node": "node-kaleidoscope",
+ "aliases": [],
+ "custom": null,
+ "props": [
+ {
+ "name": "segments",
+ "type": "EffectProp<number>",
+ "signal": true,
+ "default": 6,
+ "min": 2,
+ "max": 32,
+ "description": "Mirror segments."
+ },
+ {
+ "name": "rotation",
+ "type": "EffectProp<number>",
+ "signal": true,
+ "default": 0,
+ "min": -3600,
+ "max": 3600,
+ "description": "Pattern rotation, degrees."
+ },
+ {
+ "name": "centerX",
+ "type": "EffectProp<number>",
+ "signal": true,
+ "default": 0.5,
+ "min": 0,
+ "max": 1,
+ "description": "Center, 0–1 across."
+ },
+ {
+ "name": "centerY",
+ "type": "EffectProp<number>",
+ "signal": true,
+ "default": 0.5,
+ "min": 0,
+ "max": 1,
+ "description": "Center, 0–1 down."
+ },
+ {
+ "name": "zoom",
+ "type": "EffectProp<number>",
+ "signal": true,
+ "default": 1,
+ "min": 0.2,
+ "max": 4,
+ "description": "Scale of the folded image."
+ }
+ ]
+ },
{
"name": "KenBurns",
"op": "KenBurns",
@@ -1472,6 +1880,75 @@
}
]
},
+ {
+ "name": "OpArt",
+ "op": "OpArt",
+ "kind": "effect",
+ "factory": "opArt",
+ "node": "node-op-art",
+ "aliases": [],
+ "custom": null,
+ "props": [
+ {
+ "name": "pattern",
+ "type": "\"stripes\" | \"rings\" | \"checker\" | \"waves\"",
+ "signal": false,
+ "default": "stripes",
+ "enum": ["stripes", "rings", "checker", "waves"],
+ "description": "Line pattern."
+ },
+ {
+ "name": "frequency",
+ "type": "EffectProp<number>",
+ "signal": true,
+ "default": 48,
+ "min": 2,
+ "max": 300,
+ "description": "Lines across the height."
+ },
+ {
+ "name": "angle",
+ "type": "EffectProp<number>",
+ "signal": true,
+ "default": 0,
+ "min": -360,
+ "max": 360,
+ "description": "Pattern angle, degrees."
+ },
+ {
+ "name": "warp",
+ "type": "EffectProp<number>",
+ "signal": true,
+ "default": 0.6,
+ "min": 0,
+ "max": 3,
+ "description": "How far brightness bends the lines."
+ },
+ {
+ "name": "source",
+ "type": "EffectProp<number>",
+ "signal": true,
+ "default": 1,
+ "min": 0,
+ "max": 1,
+ "description": "How much darks thicken the lines (0 = even lines)."
+ },
+ {
+ "name": "colorA",
+ "type": "string",
+ "signal": false,
+ "default": "#0a0a0a",
+ "description": "Line color."
+ },
+ {
+ "name": "colorB",
+ "type": "string",
+ "signal": false,
+ "default": "#f5f5f5",
+ "description": "Gap color."
+ }
+ ]
+ },
{
"name": "Paint",
"op": "Paint",
@@ -1521,6 +1998,61 @@
}
]
},
+ {
+ "name": "Painterly",
+ "op": "Painterly",
+ "kind": "effect",
+ "factory": "painterly",
+ "node": "node-painterly",
+ "aliases": [],
+ "custom": null,
+ "props": [
+ {
+ "name": "style",
+ "type": "\"oil\" | \"watercolor\"",
+ "signal": false,
+ "default": "oil",
+ "enum": ["oil", "watercolor"],
+ "description": "Oil (dense strokes) or watercolor (wet edges, paper)."
+ },
+ {
+ "name": "radius",
+ "type": "EffectProp<number>",
+ "signal": true,
+ "default": 5,
+ "min": 2,
+ "max": 12,
+ "description": "Brush size, px."
+ },
+ {
+ "name": "edgeDarkening",
+ "type": "EffectProp<number>",
+ "signal": true,
+ "default": 0.5,
+ "min": 0,
+ "max": 1,
+ "description": "Watercolor: pigment pooling at patch edges."
+ },
+ {
+ "name": "paper",
+ "type": "EffectProp<number>",
+ "signal": true,
+ "default": 0.3,
+ "min": 0,
+ "max": 1,
+ "description": "Paper / canvas grain."
+ },
+ {
+ "name": "saturation",
+ "type": "EffectProp<number>",
+ "signal": true,
+ "default": 1.05,
+ "min": 0,
+ "max": 2,
+ "description": "Color saturation."
+ }
+ ]
+ },
{
"name": "PatchHeal",
"op": "PatchHeal",
@@ -1618,6 +2150,106 @@
}
]
},
+ {
+ "name": "Pixelate",
+ "op": "Pixelate",
+ "kind": "effect",
+ "factory": "pixelate",
+ "node": "node-pixelate",
+ "aliases": [],
+ "custom": null,
+ "props": [
+ {
+ "name": "size",
+ "type": "EffectProp<number>",
+ "signal": true,
+ "default": 12,
+ "min": 1,
+ "max": 256,
+ "description": "Cell size, px."
+ },
+ {
+ "name": "shape",
+ "type": "\"square\" | \"circle\" | \"diamond\"",
+ "signal": false,
+ "default": "square",
+ "enum": ["square", "circle", "diamond"],
+ "description": "Cell shape: square pixels, round LEDs or diamonds."
+ },
+ {
+ "name": "gap",
+ "type": "EffectProp<number>",
+ "signal": true,
+ "default": 0,
+ "min": 0,
+ "max": 0.9,
+ "description": "Space between cells, as a fraction of a cell (0 = touching)."
+ }
+ ]
+ },
+ {
+ "name": "Posterize",
+ "op": "Posterize",
+ "kind": "effect",
+ "factory": "posterize",
+ "node": "node-posterize",
+ "aliases": [],
+ "custom": null,
+ "props": [
+ {
+ "name": "levels",
+ "type": "EffectProp<number>",
+ "signal": true,
+ "default": 6,
+ "min": 2,
+ "max": 64,
+ "description": "Steps per channel when no palette is set."
+ },
+ {
+ "name": "palette",
+ "type": "\"none\" | \"gameboy\" | \"teletext\" | \"cga\" | \"pico8\" | \"c64\" | \"grayscale\" | \"sepia\" | \"custom\"",
+ "signal": false,
+ "default": "none",
+ "enum": [
+ "none",
+ "gameboy",
+ "teletext",
+ "cga",
+ "pico8",
+ "c64",
+ "grayscale",
+ "sepia",
+ "custom"
+ ],
+ "description": "Snap to a retro palette, or `custom` to use `colors`."
+ },
+ {
+ "name": "colors",
+ "type": "string[]",
+ "signal": false,
+ "default": [],
+ "description": "Your palette (up to 16 hex colors), used when `palette` is `custom`."
+ },
+ {
+ "name": "dither",
+ "type": "EffectProp<number>",
+ "signal": true,
+ "default": 0,
+ "min": 0,
+ "max": 1,
+ "description": "Ordered (Bayer) dithering between steps, 0–1."
+ },
+ {
+ "name": "pixelSize",
+ "type": "EffectProp<number>",
+ "signal": true,
+ "default": 1,
+ "min": 1,
+ "max": 64,
+ "description": "Pixel size, px: above 1 for pixel art."
+ }
+ ]
+ },
{
"name": "ProceduralVFX",
"op": "ProceduralVFX",
@@ -1629,7 +2261,7 @@
"props": [
{
"name": "effectType",
- "type": "\"Smoke\" | \"Fire\" | \"Rain\" | \"Sparks\" | \"Snow\" | \"Dust\" | \"Lightning\" | \"Magic\" | \"LensFlare\" | \"Embers\" | \"EnergyBeam\"",
+ "type": "\"Smoke\" | \"Fire\" | \"Rain\" | \"Sparks\" | \"Snow\" | \"Dust\" | \"Lightning\" | \"Magic\" | \"LensFlare\" | \"Embers\" | \"EnergyBeam\" | \"Aurora\"",
"signal": false,
"default": "Smoke",
"enum": [
@@ -1643,7 +2275,8 @@
"Magic",
"LensFlare",
"Embers",
- "EnergyBeam"
+ "EnergyBeam",
+ "Aurora"
],
"description": "Which procedural particle / light effect to synthesize."
},
@@ -2087,6 +2720,42 @@
}
]
},
+ {
+ "name": "RGBSplit",
+ "op": "RGBSplit",
+ "kind": "effect",
+ "factory": "rGBSplit",
+ "node": "node-rgb-split",
+ "aliases": [],
+ "custom": null,
+ "props": [
+ {
+ "name": "amount",
+ "type": "EffectProp<number>",
+ "signal": true,
+ "default": 8,
+ "min": 0,
+ "max": 200,
+ "description": "Split distance, px."
+ },
+ {
+ "name": "angle",
+ "type": "EffectProp<number>",
+ "signal": true,
+ "default": 0,
+ "min": -360,
+ "max": 360,
+ "description": "Split direction, degrees (linear mode)."
+ },
+ {
+ "name": "radial",
+ "type": "boolean",
+ "signal": false,
+ "default": false,
+ "description": "Split outward from the center instead of along `angle`."
+ }
+ ]
+ },
{
"name": "Rotate",
"op": "Rotate",
@@ -2142,6 +2811,60 @@
}
]
},
+ {
+ "name": "Toon",
+ "op": "Toon",
+ "kind": "effect",
+ "factory": "toon",
+ "node": "node-toon",
+ "aliases": [],
+ "custom": null,
+ "props": [
+ {
+ "name": "levels",
+ "type": "EffectProp<number>",
+ "signal": true,
+ "default": 4,
+ "min": 2,
+ "max": 12,
+ "description": "Brightness bands."
+ },
+ {
+ "name": "edgeThreshold",
+ "type": "EffectProp<number>",
+ "signal": true,
+ "default": 0.2,
+ "min": 0,
+ "max": 1,
+ "description": "How strong an edge must be to get ink, 0–1."
+ },
+ {
+ "name": "edgeWidth",
+ "type": "EffectProp<number>",
+ "signal": true,
+ "default": 1,
+ "min": 0.5,
+ "max": 4,
+ "description": "Ink line width, px."
+ },
+ {
+ "name": "edgeColor",
+ "type": "string",
+ "signal": false,
+ "default": "#111111",
+ "description": "Ink color."
+ },
+ {
+ "name": "saturation",
+ "type": "EffectProp<number>",
+ "signal": true,
+ "default": 1.15,
+ "min": 0,
+ "max": 2,
+ "description": "Color saturation after banding."
+ }
+ ]
+ },
{
"name": "Trails",
"op": "Trails",
diff --git a/packages/framefields/src/effects/generated/classes.ts b/packages/framefields/src/effects/generated/classes.ts
index 2043c83f..38ea6695 100644
--- a/packages/framefields/src/effects/generated/classes.ts
+++ b/packages/framefields/src/effects/generated/classes.ts
@@ -432,6 +432,65 @@ export interface TonalShift {
yellowBlue: number;
}
+export interface AsciiProps {
+ /**
+ * Character cell size, px.
+ * Range 4 to 64. Accepts a signal.
+ * @default 10
+ */
+ cellSize?: EffectProp<number>;
+ /**
+ * Glyph color: `fg`, the layer's own colors, or green phosphor.
+ * @default "mono"
+ */
+ colorMode?: "mono" | "source" | "green";
+ /**
+ * Glyph color (mono).
+ * @default "#e8e8e8"
+ */
+ fg?: string;
+ /**
+ * Background color.
+ * @default "#0b0b0b"
+ */
+ bg?: string;
+ /**
+ * Brightness contrast before picking glyphs.
+ * Range 0.5 to 3. Accepts a signal.
+ * @default 1.2
+ */
+ contrast?: EffectProp<number>;
+ /**
+ * Dark areas get dense glyphs.
+ * @default false
+ */
+ invert?: boolean;
+}
+
+const asciiDefaults: AsciiProps = {
+ cellSize: 10,
+ colorMode: "mono",
+ fg: "#e8e8e8",
+ bg: "#0b0b0b",
+ contrast: 1.2,
+ invert: false,
+};
+
+export class Ascii extends Effect<AsciiProps> {
+ public readonly op = "Ascii";
+
+ public declare cellSize: number;
+ public declare colorMode: "mono" | "source" | "green";
+ public declare fg: string;
+ public declare bg: string;
+ public declare contrast: number;
+ public declare invert: boolean;
+
+ constructor(config: AsciiProps = {}) {
+ super(withDefaults("Ascii", asciiDefaults, config, effectMeta.Ascii));
+ }
+}
+
export interface AudioCompressorProps {
/**
* Level (dBFS) above which gain reduction begins (-60 to 0 dB). Can be modulated by a static number or dynamic signal.
@@ -1194,6 +1253,66 @@ export class ColorKey extends Effect<ColorKeyProps> {
}
}
+export interface ContourProps {
+ /**
+ * Contour lines from dark to light.
+ * Range 2 to 64. Accepts a signal.
+ * @default 14
+ */
+ levels?: EffectProp<number>;
+ /**
+ * Line width, px.
+ * Range 0.5 to 8. Accepts a signal.
+ * @default 1.2
+ */
+ lineWidth?: EffectProp<number>;
+ /**
+ * Line color.
+ * @default "#2b1d0e"
+ */
+ lineColor?: string;
+ /**
+ * Under the lines: the layer, `fillColor`, or transparent.
+ * @default "source"
+ */
+ fill?: "source" | "flat" | "none";
+ /**
+ * Paper color (flat fill).
+ * @default "#f3ead8"
+ */
+ fillColor?: string;
+ /**
+ * Blur before tracing, px (smoother lines).
+ * Range 0 to 8. Accepts a signal.
+ * @default 2
+ */
+ smoothing?: EffectProp<number>;
+}
+
+const contourDefaults: ContourProps = {
+ levels: 14,
+ lineWidth: 1.2,
+ lineColor: "#2b1d0e",
+ fill: "source",
+ fillColor: "#f3ead8",
+ smoothing: 2,
+};
+
+export class Contour extends Effect<ContourProps> {
+ public readonly op = "Contour";
+
+ public declare levels: number;
+ public declare lineWidth: number;
+ public declare lineColor: string;
+ public declare fill: "source" | "flat" | "none";
+ public declare fillColor: string;
+ public declare smoothing: number;
+
+ constructor(config: ContourProps = {}) {
+ super(withDefaults("Contour", contourDefaults, config, effectMeta.Contour));
+ }
+}
+
export interface CornerPinProps {
points?: CornerPinPointsItem[];
}
@@ -1217,6 +1336,93 @@ export class CornerPin extends Effect<CornerPinProps> {
}
}
+export interface CRTProps {
+ /**
+ * Scanline darkness.
+ * Range 0 to 1. Accepts a signal.
+ * @default 0.45
+ */
+ scanlines?: EffectProp<number>;
+ /**
+ * Scanlines over the height.
+ * Range 100 to 2160. Accepts a signal.
+ * @default 540
+ */
+ lineCount?: EffectProp<number>;
+ /**
+ * Barrel distortion of the tube.
+ * Range 0 to 1. Accepts a signal.
+ * @default 0.12
+ */
+ curvature?: EffectProp<number>;
+ /**
+ * RGB aperture-grille strength.
+ * Range 0 to 1. Accepts a signal.
+ * @default 0.25
+ */
+ mask?: EffectProp<number>;
+ /**
+ * Darkening toward the edges.
+ * Range 0 to 1. Accepts a signal.
+ * @default 0.35
+ */
+ vignette?: EffectProp<number>;
+ /**
+ * Animated static.
+ * Range 0 to 1. Accepts a signal.
+ * @default 0.08
+ */
+ noise?: EffectProp<number>;
+ /**
+ * Brightness flicker.
+ * Range 0 to 1. Accepts a signal.
+ * @default 0.03
+ */
+ flicker?: EffectProp<number>;
+ /**
+ * VHS tracking error: line jitter and a rolling band.
+ * Range 0 to 1. Accepts a signal.
+ * @default 0
+ */
+ tracking?: EffectProp<number>;
+ /**
+ * VHS color bleed, px.
+ * Range 0 to 20. Accepts a signal.
+ * @default 0
+ */
+ chroma?: EffectProp<number>;
+}
+
+const cRTDefaults: CRTProps = {
+ scanlines: 0.45,
+ lineCount: 540,
+ curvature: 0.12,
+ mask: 0.25,
+ vignette: 0.35,
+ noise: 0.08,
+ flicker: 0.03,
+ tracking: 0,
+ chroma: 0,
+};
+
+export class CRT extends Effect<CRTProps> {
+ public readonly op = "CRT";
+
+ public declare scanlines: number;
+ public declare lineCount: number;
+ public declare curvature: number;
+ public declare mask: number;
+ public declare vignette: number;
+ public declare noise: number;
+ public declare flicker: number;
+ public declare tracking: number;
+ public declare chroma: number;
+
+ constructor(config: CRTProps = {}) {
+ super(withDefaults("CRT", cRTDefaults, config, effectMeta.CRT));
+ }
+}
+
export interface DatamoshProps {
/**
* Layer frames that show the clean picture again (I-frames). The first frame always does.
@@ -1324,6 +1530,65 @@ export class DisplacementMap extends Effect<DisplacementMapProps> {
}
}
+export interface DitherProps {
+ /**
+ * Pattern: Bayer matrix, blue-ish noise or round halftone dots.
+ * @default "bayer"
+ */
+ mode?: "bayer" | "noise" | "halftone";
+ /**
+ * Levels per channel (2 = 1-bit).
+ * Range 2 to 16. Accepts a signal.
+ * @default 2
+ */
+ levels?: EffectProp<number>;
+ /**
+ * Dither pixel size, px.
+ * Range 1 to 16. Accepts a signal.
+ * @default 2
+ */
+ scale?: EffectProp<number>;
+ /**
+ * Map brightness to the dark → light colors instead of dithering each channel.
+ * @default true
+ */
+ monochrome?: boolean;
+ /**
+ * Dark color (monochrome).
+ * @default "#111111"
+ */
+ dark?: string;
+ /**
+ * Light color (monochrome).
+ * @default "#f2efe6"
+ */
+ light?: string;
+}
+
+const ditherDefaults: DitherProps = {
+ mode: "bayer",
+ levels: 2,
+ scale: 2,
+ monochrome: true,
+ dark: "#111111",
+ light: "#f2efe6",
+};
+
+export class Dither extends Effect<DitherProps> {
+ public readonly op = "Dither";
+
+ public declare mode: "bayer" | "noise" | "halftone";
+ public declare levels: number;
+ public declare scale: number;
+ public declare monochrome: boolean;
+ public declare dark: string;
+ public declare light: string;
+
+ constructor(config: DitherProps = {}) {
+ super(withDefaults("Dither", ditherDefaults, config, effectMeta.Dither));
+ }
+}
+
export interface ExtractLUTProps {
/**
* Extraction Strategy
@@ -1435,6 +1700,160 @@ export class Flip extends Effect<FlipProps> {
}
}
+export interface GooeyProps {
+ /**
+ * Melt distance, px.
+ * Range 1 to 60. Accepts a signal.
+ * @default 12
+ */
+ radius?: EffectProp<number>;
+ /**
+ * Alpha cut, 0–1 (higher = thinner blobs).
+ * Range 0 to 1. Accepts a signal.
+ * @default 0.5
+ */
+ threshold?: EffectProp<number>;
+ /**
+ * Edge softness.
+ * Range 0.001 to 0.5. Accepts a signal.
+ * @default 0.04
+ */
+ softness?: EffectProp<number>;
+}
+
+const gooeyDefaults: GooeyProps = {
+ radius: 12,
+ threshold: 0.5,
+ softness: 0.04,
+};
+
+export class Gooey extends Effect<GooeyProps> {
+ public readonly op = "Gooey";
+
+ public declare radius: number;
+ public declare threshold: number;
+ public declare softness: number;
+
+ constructor(config: GooeyProps = {}) {
+ super(withDefaults("Gooey", gooeyDefaults, config, effectMeta.Gooey));
+ }
+}
+
+export interface IridescenceProps {
+ /**
+ * How much rainbow, 0–1.
+ * Range 0 to 1. Accepts a signal.
+ * @default 0.6
+ */
+ strength?: EffectProp<number>;
+ /**
+ * Rainbow bands over the range.
+ * Range 0.1 to 10. Accepts a signal.
+ * @default 2
+ */
+ scale?: EffectProp<number>;
+ /**
+ * Hue shift, degrees (animate it).
+ * Range -3600 to 3600. Accepts a signal.
+ * @default 0
+ */
+ shift?: EffectProp<number>;
+ /**
+ * Bands from brightness, or from the slope of the image (foil).
+ * @default "relief"
+ */
+ mode?: "luminance" | "relief";
+}
+
+const iridescenceDefaults: IridescenceProps = {
+ strength: 0.6,
+ scale: 2,
+ shift: 0,
+ mode: "relief",
+};
+
+export class Iridescence extends Effect<IridescenceProps> {
+ public readonly op = "Iridescence";
+
+ public declare strength: number;
+ public declare scale: number;
+ public declare shift: number;
+ public declare mode: "luminance" | "relief";
+
+ constructor(config: IridescenceProps = {}) {
+ super(
+ withDefaults(
+ "Iridescence",
+ iridescenceDefaults,
+ config,
+ effectMeta.Iridescence,
+ ),
+ );
+ }
+}
+
+export interface KaleidoscopeProps {
+ /**
+ * Mirror segments.
+ * Range 2 to 32. Accepts a signal.
+ * @default 6
+ */
+ segments?: EffectProp<number>;
+ /**
+ * Pattern rotation, degrees.
+ * Range -3600 to 3600. Accepts a signal.
+ * @default 0
+ */
+ rotation?: EffectProp<number>;
+ /**
+ * Center, 0–1 across.
+ * Range 0 to 1. Accepts a signal.
+ * @default 0.5
+ */
+ centerX?: EffectProp<number>;
+ /**
+ * Center, 0–1 down.
+ * Range 0 to 1. Accepts a signal.
+ * @default 0.5
+ */
+ centerY?: EffectProp<number>;
+ /**
+ * Scale of the folded image.
+ * Range 0.2 to 4. Accepts a signal.
+ * @default 1
+ */
+ zoom?: EffectProp<number>;
+}
+
+const kaleidoscopeDefaults: KaleidoscopeProps = {
+ segments: 6,
+ rotation: 0,
+ centerX: 0.5,
+ centerY: 0.5,
+ zoom: 1,
+};
+
+export class Kaleidoscope extends Effect<KaleidoscopeProps> {
+ public readonly op = "Kaleidoscope";
+
+ public declare segments: number;
+ public declare rotation: number;
+ public declare centerX: number;
+ public declare centerY: number;
+ public declare zoom: number;
+
+ constructor(config: KaleidoscopeProps = {}) {
+ super(
+ withDefaults(
+ "Kaleidoscope",
+ kaleidoscopeDefaults,
+ config,
+ effectMeta.Kaleidoscope,
+ ),
+ );
+ }
+}
+
export interface KenBurnsProps {
/**
* @default []
@@ -1967,6 +2386,74 @@ export class NoiseGenerator extends Effect<NoiseGeneratorProps> {
}
}
+export interface OpArtProps {
+ /**
+ * Line pattern.
+ * @default "stripes"
+ */
+ pattern?: "stripes" | "rings" | "checker" | "waves";
+ /**
+ * Lines across the height.
+ * Range 2 to 300. Accepts a signal.
+ * @default 48
+ */
+ frequency?: EffectProp<number>;
+ /**
+ * Pattern angle, degrees.
+ * Range -360 to 360. Accepts a signal.
+ * @default 0
+ */
+ angle?: EffectProp<number>;
+ /**
+ * How far brightness bends the lines.
+ * Range 0 to 3. Accepts a signal.
+ * @default 0.6
+ */
+ warp?: EffectProp<number>;
+ /**
+ * How much darks thicken the lines (0 = even lines).
+ * Range 0 to 1. Accepts a signal.
+ * @default 1
+ */
+ source?: EffectProp<number>;
+ /**
+ * Line color.
+ * @default "#0a0a0a"
+ */
+ colorA?: string;
+ /**
+ * Gap color.
+ * @default "#f5f5f5"
+ */
+ colorB?: string;
+}
+
+const opArtDefaults: OpArtProps = {
+ pattern: "stripes",
+ frequency: 48,
+ angle: 0,
+ warp: 0.6,
+ source: 1,
+ colorA: "#0a0a0a",
+ colorB: "#f5f5f5",
+};
+
+export class OpArt extends Effect<OpArtProps> {
+ public readonly op = "OpArt";
+
+ public declare pattern: "stripes" | "rings" | "checker" | "waves";
+ public declare frequency: number;
+ public declare angle: number;
+ public declare warp: number;
+ public declare source: number;
+ public declare colorA: string;
+ public declare colorB: string;
+
+ constructor(config: OpArtProps = {}) {
+ super(withDefaults("OpArt", opArtDefaults, config, effectMeta.OpArt));
+ }
+}
+
export interface PaintProps {
/**
* Range 1 to 16384.
@@ -2022,6 +2509,67 @@ export class Paint extends Effect<PaintProps> {
}
}
+export interface PainterlyProps {
+ /**
+ * Oil (dense strokes) or watercolor (wet edges, paper).
+ * @default "oil"
+ */
+ style?: "oil" | "watercolor";
+ /**
+ * Brush size, px.
+ * Range 2 to 12. Accepts a signal.
+ * @default 5
+ */
+ radius?: EffectProp<number>;
+ /**
+ * Watercolor: pigment pooling at patch edges.
+ * Range 0 to 1. Accepts a signal.
+ * @default 0.5
+ */
+ edgeDarkening?: EffectProp<number>;
+ /**
+ * Paper / canvas grain.
+ * Range 0 to 1. Accepts a signal.
+ * @default 0.3
+ */
+ paper?: EffectProp<number>;
+ /**
+ * Color saturation.
+ * Range 0 to 2. Accepts a signal.
+ * @default 1.05
+ */
+ saturation?: EffectProp<number>;
+}
+
+const painterlyDefaults: PainterlyProps = {
+ style: "oil",
+ radius: 5,
+ edgeDarkening: 0.5,
+ paper: 0.3,
+ saturation: 1.05,
+};
+
+export class Painterly extends Effect<PainterlyProps> {
+ public readonly op = "Painterly";
+
+ public declare style: "oil" | "watercolor";
+ public declare radius: number;
+ public declare edgeDarkening: number;
+ public declare paper: number;
+ public declare saturation: number;
+
+ constructor(config: PainterlyProps = {}) {
+ super(
+ withDefaults(
+ "Painterly",
+ painterlyDefaults,
+ config,
+ effectMeta.Painterly,
+ ),
+ );
+ }
+}
+
export interface PatchHealProps {
/** List of patch healing operations applied sequentially. */
patches?: PatchHealPatchesItem[];
@@ -2118,6 +2666,124 @@ export class PatchHeal extends Effect<PatchHealProps> {
}
}
+export interface PixelateProps {
+ /**
+ * Cell size, px.
+ * Range 1 to 256. Accepts a signal.
+ * @default 12
+ */
+ size?: EffectProp<number>;
+ /**
+ * Cell shape: square pixels, round LEDs or diamonds.
+ * @default "square"
+ */
+ shape?: "square" | "circle" | "diamond";
+ /**
+ * Space between cells, as a fraction of a cell (0 = touching).
+ * Range 0 to 0.9. Accepts a signal.
+ * @default 0
+ */
+ gap?: EffectProp<number>;
+}
+
+const pixelateDefaults: PixelateProps = {
+ size: 12,
+ shape: "square",
+ gap: 0,
+};
+
+export class Pixelate extends Effect<PixelateProps> {
+ public readonly op = "Pixelate";
+
+ public declare size: number;
+ public declare shape: "square" | "circle" | "diamond";
+ public declare gap: number;
+
+ constructor(config: PixelateProps = {}) {
+ super(
+ withDefaults("Pixelate", pixelateDefaults, config, effectMeta.Pixelate),
+ );
+ }
+}
+
+export interface PosterizeProps {
+ /**
+ * Steps per channel when no palette is set.
+ * Range 2 to 64. Accepts a signal.
+ * @default 6
+ */
+ levels?: EffectProp<number>;
+ /**
+ * Snap to a retro palette, or `custom` to use `colors`.
+ * @default "none"
+ */
+ palette?:
+ | "none"
+ | "gameboy"
+ | "teletext"
+ | "cga"
+ | "pico8"
+ | "c64"
+ | "grayscale"
+ | "sepia"
+ | "custom";
+ /**
+ * Your palette (up to 16 hex colors), used when `palette` is `custom`.
+ * @default []
+ */
+ colors?: string[];
+ /**
+ * Ordered (Bayer) dithering between steps, 0–1.
+ * Range 0 to 1. Accepts a signal.
+ * @default 0
+ */
+ dither?: EffectProp<number>;
+ /**
+ * Pixel size, px: above 1 for pixel art.
+ * Range 1 to 64. Accepts a signal.
+ * @default 1
+ */
+ pixelSize?: EffectProp<number>;
+}
+
+const posterizeDefaults: PosterizeProps = {
+ levels: 6,
+ palette: "none",
+ colors: [],
+ dither: 0,
+ pixelSize: 1,
+};
+
+export class Posterize extends Effect<PosterizeProps> {
+ public readonly op = "Posterize";
+
+ public declare levels: number;
+ public declare palette:
+ | "none"
+ | "gameboy"
+ | "teletext"
+ | "cga"
+ | "pico8"
+ | "c64"
+ | "grayscale"
+ | "sepia"
+ | "custom";
+ public declare colors: string[];
+ public declare dither: number;
+ public declare pixelSize: number;
+
+ constructor(config: PosterizeProps = {}) {
+ super(
+ withDefaults(
+ "Posterize",
+ posterizeDefaults,
+ config,
+ effectMeta.Posterize,
+ ),
+ );
+ }
+}
+
export interface ProceduralVFXProps {
/**
* Which procedural particle / light effect to synthesize.
@@ -2134,7 +2800,8 @@ export interface ProceduralVFXProps {
| "Magic"
| "LensFlare"
| "Embers"
- | "EnergyBeam";
+ | "EnergyBeam"
+ | "Aurora";
/**
* Image renders a static frame; Video animates over time.
* @default "Video"
@@ -2236,7 +2903,8 @@ export class ProceduralVFX extends Effect<ProceduralVFXProps> {
| "Magic"
| "LensFlare"
| "Embers"
- | "EnergyBeam";
+ | "EnergyBeam"
+ | "Aurora";
public declare outputType: "Image" | "Video";
public declare width: number;
public declare height: number;
@@ -2607,6 +3275,46 @@ export class ResizerScaler extends Effect<ResizerScalerProps> {
}
}
+export interface RGBSplitProps {
+ /**
+ * Split distance, px.
+ * Range 0 to 200. Accepts a signal.
+ * @default 8
+ */
+ amount?: EffectProp<number>;
+ /**
+ * Split direction, degrees (linear mode).
+ * Range -360 to 360. Accepts a signal.
+ * @default 0
+ */
+ angle?: EffectProp<number>;
+ /**
+ * Split outward from the center instead of along `angle`.
+ * @default false
+ */
+ radial?: boolean;
+}
+
+const rGBSplitDefaults: RGBSplitProps = {
+ amount: 8,
+ angle: 0,
+ radial: false,
+};
+
+export class RGBSplit extends Effect<RGBSplitProps> {
+ public readonly op = "RGBSplit";
+
+ public declare amount: number;
+ public declare angle: number;
+ public declare radial: boolean;
+
+ constructor(config: RGBSplitProps = {}) {
+ super(
+ withDefaults("RGBSplit", rGBSplitDefaults, config, effectMeta.RGBSplit),
+ );
+ }
+}
+
export interface RotateProps {
/**
* Rotation in degrees about the frame center, clockwise. Any value; 90 / 180 / 270 fix footage shot sideways or upside down.
@@ -2675,6 +3383,60 @@ export class StereoPanning extends Effect<StereoPanningProps> {
}
}
+export interface ToonProps {
+ /**
+ * Brightness bands.
+ * Range 2 to 12. Accepts a signal.
+ * @default 4
+ */
+ levels?: EffectProp<number>;
+ /**
+ * How strong an edge must be to get ink, 0–1.
+ * Range 0 to 1. Accepts a signal.
+ * @default 0.2
+ */
+ edgeThreshold?: EffectProp<number>;
+ /**
+ * Ink line width, px.
+ * Range 0.5 to 4. Accepts a signal.
+ * @default 1
+ */
+ edgeWidth?: EffectProp<number>;
+ /**
+ * Ink color.
+ * @default "#111111"
+ */
+ edgeColor?: string;
+ /**
+ * Color saturation after banding.
+ * Range 0 to 2. Accepts a signal.
+ * @default 1.15
+ */
+ saturation?: EffectProp<number>;
+}
+
+const toonDefaults: ToonProps = {
+ levels: 4,
+ edgeThreshold: 0.2,
+ edgeWidth: 1,
+ edgeColor: "#111111",
+ saturation: 1.15,
+};
+
+export class Toon extends Effect<ToonProps> {
+ public readonly op = "Toon";
+
+ public declare levels: number;
+ public declare edgeThreshold: number;
+ public declare edgeWidth: number;
+ public declare edgeColor: string;
+ public declare saturation: number;
+
+ constructor(config: ToonProps = {}) {
+ super(withDefaults("Toon", toonDefaults, config, effectMeta.Toon));
+ }
+}
+
export interface TrailsProps {
/**
* History kept per frame, 0–1: 0.8 short echoes, 0.97 long light trails.
diff --git a/packages/framefields/src/effects/generated/index.ts b/packages/framefields/src/effects/generated/index.ts
index fb2cadae..93db17a6 100644
--- a/packages/framefields/src/effects/generated/index.ts
+++ b/packages/framefields/src/effects/generated/index.ts
@@ -4,6 +4,8 @@
export { Blur, type BlurProps } from "../custom/blur.js";
export {
+ Ascii,
+ type AsciiProps,
AudioCompressor,
type AudioCompressorProps,
AudioDelay,
@@ -26,17 +28,29 @@ export {
type ColorBalanceProps,
ColorKey,
type ColorKeyProps,
+ Contour,
+ type ContourProps,
CornerPin,
type CornerPinPointsItem,
type CornerPinProps,
+ CRT,
+ type CRTProps,
Datamosh,
type DatamoshProps,
DisplacementMap,
type DisplacementMapProps,
+ Dither,
+ type DitherProps,
ExtractLUT,
type ExtractLUTProps,
Flip,
type FlipProps,
+ Gooey,
+ type GooeyProps,
+ Iridescence,
+ type IridescenceProps,
+ Kaleidoscope,
+ type KaleidoscopeProps,
KenBurns,
type KenBurnsKeyframesItem,
type KenBurnsProps,
@@ -59,7 +73,11 @@ export {
type MeshWarpProps,
NoiseGenerator,
type NoiseGeneratorProps,
+ OpArt,
+ type OpArtProps,
Paint,
+ Painterly,
+ type PainterlyProps,
type PaintProps,
type PaintStrokesItemOption1,
type PaintStrokesItemOption2,
@@ -67,6 +85,10 @@ export {
PatchHeal,
type PatchHealPatchesItem,
type PatchHealProps,
+ Pixelate,
+ type PixelateProps,
+ Posterize,
+ type PosterizeProps,
ProceduralVFX,
type ProceduralVFXProps,
RefineEdge,
@@ -75,11 +97,15 @@ export {
type RefractionCaustics3DProps,
ResizerScaler,
type ResizerScalerProps,
+ RGBSplit,
+ type RGBSplitProps,
Rotate,
type RotateProps,
StereoPanning,
type StereoPanningProps,
type TonalShift,
+ Toon,
+ type ToonProps,
Trails,
type TrailsProps,
Vignette,
diff --git a/packages/framefields/src/effects/generated/meta.ts b/packages/framefields/src/effects/generated/meta.ts
index f0c87007..42f814db 100644
--- a/packages/framefields/src/effects/generated/meta.ts
+++ b/packages/framefields/src/effects/generated/meta.ts
@@ -6,6 +6,22 @@ import type { EffectMeta } from "../with-defaults.js";
/** Ranges and allowed values per effect prop, used by `withDefaults()` checks. */
export const effectMeta = {
+ Ascii: {
+ cellSize: {
+ min: 4,
+ max: 64,
+ },
+ colorMode: {
+ enum: ["mono", "source", "green"],
+ },
+ fg: {},
+ bg: {},
+ contrast: {
+ min: 0.5,
+ max: 3,
+ },
+ invert: {},
+ },
AudioCompressor: {
threshold: {
min: -60,
@@ -305,9 +321,66 @@ export const effectMeta = {
enum: ["Desaturate", "Neutralize", "None"],
},
},
+ Contour: {
+ levels: {
+ min: 2,
+ max: 64,
+ },
+ lineWidth: {
+ min: 0.5,
+ max: 8,
+ },
+ lineColor: {},
+ fill: {
+ enum: ["source", "flat", "none"],
+ },
+ fillColor: {},
+ smoothing: {
+ min: 0,
+ max: 8,
+ },
+ },
CornerPin: {
points: {},
},
+ CRT: {
+ scanlines: {
+ min: 0,
+ max: 1,
+ },
+ lineCount: {
+ min: 100,
+ max: 2160,
+ },
+ curvature: {
+ min: 0,
+ max: 1,
+ },
+ mask: {
+ min: 0,
+ max: 1,
+ },
+ vignette: {
+ min: 0,
+ max: 1,
+ },
+ noise: {
+ min: 0,
+ max: 1,
+ },
+ flicker: {
+ min: 0,
+ max: 1,
+ },
+ tracking: {
+ min: 0,
+ max: 1,
+ },
+ chroma: {
+ min: 0,
+ max: 20,
+ },
+ },
Datamosh: {
keyframes: {},
strength: {
@@ -342,6 +415,22 @@ export const effectMeta = {
enum: ["Clamp", "Repeat", "Mirror"],
},
},
+ Dither: {
+ mode: {
+ enum: ["bayer", "noise", "halftone"],
+ },
+ levels: {
+ min: 2,
+ max: 16,
+ },
+ scale: {
+ min: 1,
+ max: 16,
+ },
+ monochrome: {},
+ dark: {},
+ light: {},
+ },
ExtractLUT: {
strategy: {
enum: ["deterministic", "statistical"],
@@ -376,6 +465,59 @@ export const effectMeta = {
],
},
},
+ Gooey: {
+ radius: {
+ min: 1,
+ max: 60,
+ },
+ threshold: {
+ min: 0,
+ max: 1,
+ },
+ softness: {
+ min: 0.001,
+ max: 0.5,
+ },
+ },
+ Iridescence: {
+ strength: {
+ min: 0,
+ max: 1,
+ },
+ scale: {
+ min: 0.1,
+ max: 10,
+ },
+ shift: {
+ min: -3600,
+ max: 3600,
+ },
+ mode: {
+ enum: ["luminance", "relief"],
+ },
+ },
+ Kaleidoscope: {
+ segments: {
+ min: 2,
+ max: 32,
+ },
+ rotation: {
+ min: -3600,
+ max: 3600,
+ },
+ centerX: {
+ min: 0,
+ max: 1,
+ },
+ centerY: {
+ min: 0,
+ max: 1,
+ },
+ zoom: {
+ min: 0.2,
+ max: 4,
+ },
+ },
KenBurns: {
keyframes: {},
motionBlurSize: {
@@ -696,6 +838,29 @@ export const effectMeta = {
max: 120,
},
},
+ OpArt: {
+ pattern: {
+ enum: ["stripes", "rings", "checker", "waves"],
+ },
+ frequency: {
+ min: 2,
+ max: 300,
+ },
+ angle: {
+ min: -360,
+ max: 360,
+ },
+ warp: {
+ min: 0,
+ max: 3,
+ },
+ source: {
+ min: 0,
+ max: 1,
+ },
+ colorA: {},
+ colorB: {},
+ },
Paint: {
width: {
min: 1,
@@ -710,6 +875,27 @@ export const effectMeta = {
backgroundColor: {},
strokes: {},
},
+ Painterly: {
+ style: {
+ enum: ["oil", "watercolor"],
+ },
+ radius: {
+ min: 2,
+ max: 12,
+ },
+ edgeDarkening: {
+ min: 0,
+ max: 1,
+ },
+ paper: {
+ min: 0,
+ max: 1,
+ },
+ saturation: {
+ min: 0,
+ max: 2,
+ },
+ },
PatchHeal: {
patches: {},
centerX: {
@@ -748,6 +934,47 @@ export const effectMeta = {
enum: ["Clone", "SeamlessHeal", "TextureTransfer"],
},
},
+ Pixelate: {
+ size: {
+ min: 1,
+ max: 256,
+ },
+ shape: {
+ enum: ["square", "circle", "diamond"],
+ },
+ gap: {
+ min: 0,
+ max: 0.9,
+ },
+ },
+ Posterize: {
+ levels: {
+ min: 2,
+ max: 64,
+ },
+ palette: {
+ enum: [
+ "none",
+ "gameboy",
+ "teletext",
+ "cga",
+ "pico8",
+ "c64",
+ "grayscale",
+ "sepia",
+ "custom",
+ ],
+ },
+ colors: {},
+ dither: {
+ min: 0,
+ max: 1,
+ },
+ pixelSize: {
+ min: 1,
+ max: 64,
+ },
+ },
ProceduralVFX: {
effectType: {
enum: [
@@ -762,6 +989,7 @@ export const effectMeta = {
"LensFlare",
"Embers",
"EnergyBeam",
+ "Aurora",
],
},
outputType: {
@@ -940,6 +1168,17 @@ export const effectMeta = {
enum: ["top", "center", "bottom"],
},
},
+ RGBSplit: {
+ amount: {
+ min: 0,
+ max: 200,
+ },
+ angle: {
+ min: -360,
+ max: 360,
+ },
+ radial: {},
+ },
Rotate: {
angle: {},
fit: {
@@ -956,6 +1195,25 @@ export const effectMeta = {
max: 1,
},
},
+ Toon: {
+ levels: {
+ min: 2,
+ max: 12,
+ },
+ edgeThreshold: {
+ min: 0,
+ max: 1,
+ },
+ edgeWidth: {
+ min: 0.5,
+ max: 4,
+ },
+ edgeColor: {},
+ saturation: {
+ min: 0,
+ max: 2,
+ },
+ },
Trails: {
decay: {
min: 0,
diff --git a/packages/framefields/src/effects/generated/registry.ts b/packages/framefields/src/effects/generated/registry.ts
index 78037ed2..35e15c09 100644
--- a/packages/framefields/src/effects/generated/registry.ts
+++ b/packages/framefields/src/effects/generated/registry.ts
@@ -4,6 +4,8 @@
import { Blur, type BlurProps } from "../custom/blur.js";
import {
+ Ascii,
+ type AsciiProps,
AudioCompressor,
type AudioCompressorProps,
AudioDelay,
@@ -26,16 +28,28 @@ import {
type ColorBalanceProps,
ColorKey,
type ColorKeyProps,
+ Contour,
+ type ContourProps,
CornerPin,
type CornerPinProps,
+ CRT,
+ type CRTProps,
Datamosh,
type DatamoshProps,
DisplacementMap,
type DisplacementMapProps,
+ Dither,
+ type DitherProps,
ExtractLUT,
type ExtractLUTProps,
Flip,
type FlipProps,
+ Gooey,
+ type GooeyProps,
+ Iridescence,
+ type IridescenceProps,
+ Kaleidoscope,
+ type KaleidoscopeProps,
KenBurns,
type KenBurnsProps,
LayerStyle,
@@ -48,10 +62,18 @@ import {
type MeshWarpProps,
NoiseGenerator,
type NoiseGeneratorProps,
+ OpArt,
+ type OpArtProps,
Paint,
+ Painterly,
+ type PainterlyProps,
type PaintProps,
PatchHeal,
type PatchHealProps,
+ Pixelate,
+ type PixelateProps,
+ Posterize,
+ type PosterizeProps,
ProceduralVFX,
type ProceduralVFXProps,
RefineEdge,
@@ -60,10 +82,14 @@ import {
type RefractionCaustics3DProps,
ResizerScaler,
type ResizerScalerProps,
+ RGBSplit,
+ type RGBSplitProps,
Rotate,
type RotateProps,
StereoPanning,
type StereoPanningProps,
+ Toon,
+ type ToonProps,
Trails,
type TrailsProps,
Vignette,
@@ -72,6 +98,7 @@ import {
/** `Effect.<factory>(config)` helpers, one per generated effect class. */
export const effectFactories = {
+ ascii: (config?: AsciiProps) => new Ascii(config),
audioCompressor: (config?: AudioCompressorProps) =>
new AudioCompressor(config),
audioDelay: (config?: AudioDelayProps) => new AudioDelay(config),
@@ -88,27 +115,39 @@ export const effectFactories = {
new ChannelSplitter(config),
colorBalance: (config?: ColorBalanceProps) => new ColorBalance(config),
colorKey: (config?: ColorKeyProps) => new ColorKey(config),
+ contour: (config?: ContourProps) => new Contour(config),
cornerPin: (config?: CornerPinProps) => new CornerPin(config),
+ cRT: (config?: CRTProps) => new CRT(config),
datamosh: (config?: DatamoshProps) => new Datamosh(config),
displacementMap: (config?: DisplacementMapProps) =>
new DisplacementMap(config),
+ dither: (config?: DitherProps) => new Dither(config),
extractLUT: (config?: ExtractLUTProps) => new ExtractLUT(config),
flip: (config?: FlipProps) => new Flip(config),
+ gooey: (config?: GooeyProps) => new Gooey(config),
+ iridescence: (config?: IridescenceProps) => new Iridescence(config),
+ kaleidoscope: (config?: KaleidoscopeProps) => new Kaleidoscope(config),
kenBurns: (config?: KenBurnsProps) => new KenBurns(config),
layerStyle: (config?: LayerStyleProps) => new LayerStyle(config),
liquify: (config?: LiquifyProps) => new Liquify(config),
maskMath: (config?: MaskMathProps) => new MaskMath(config),
meshWarp: (config?: MeshWarpProps) => new MeshWarp(config),
noiseGenerator: (config?: NoiseGeneratorProps) => new NoiseGenerator(config),
+ opArt: (config?: OpArtProps) => new OpArt(config),
paint: (config?: PaintProps) => new Paint(config),
+ painterly: (config?: PainterlyProps) => new Painterly(config),
patchHeal: (config?: PatchHealProps) => new PatchHeal(config),
+ pixelate: (config?: PixelateProps) => new Pixelate(config),
+ posterize: (config?: PosterizeProps) => new Posterize(config),
proceduralVFX: (config?: ProceduralVFXProps) => new ProceduralVFX(config),
refineEdge: (config?: RefineEdgeProps) => new RefineEdge(config),
refractionCaustics3D: (config?: RefractionCaustics3DProps) =>
new RefractionCaustics3D(config),
resizerScaler: (config?: ResizerScalerProps) => new ResizerScaler(config),
+ rGBSplit: (config?: RGBSplitProps) => new RGBSplit(config),
rotate: (config?: RotateProps) => new Rotate(config),
stereoPanning: (config?: StereoPanningProps) => new StereoPanning(config),
+ toon: (config?: ToonProps) => new Toon(config),
trails: (config?: TrailsProps) => new Trails(config),
vignette: (config?: VignetteProps) => new Vignette(config),
} as const;
diff --git a/packages/framefields/src/index.ts b/packages/framefields/src/index.ts
index 9239e8b0..9f3c8ff3 100644
--- a/packages/framefields/src/index.ts
+++ b/packages/framefields/src/index.ts
@@ -223,6 +223,8 @@ import {
type MotionBlurProps,
PBRGlass,
type PBRGlassProps,
+ ProceduralVFX,
+ type ProceduralVFXProps,
Relight3D,
type Relight3DProps,
SelectiveColor,
@@ -676,6 +678,8 @@ export {
export {
ApplyLUT,
type ApplyLUTProps,
+ Ascii,
+ type AsciiProps,
AudioCompressor,
type AudioCompressorProps,
AudioDelay,
@@ -702,8 +706,12 @@ export {
type ColorBalanceProps,
ColorKey,
type ColorKeyProps,
+ Contour,
+ type ContourProps,
CornerPin,
type CornerPinProps,
+ CRT,
+ type CRTProps,
Crop,
type CropProps,
Curves,
@@ -717,6 +725,8 @@ export {
type DepthOfFieldProps,
DisplacementMap,
type DisplacementMapProps,
+ Dither,
+ type DitherProps,
ExtractLUT,
type ExtractLUTProps,
effectFactories,
@@ -725,6 +735,8 @@ export {
type FilmGrainProps,
Flip,
type FlipProps,
+ Gooey,
+ type GooeyProps,
GradientMap,
type GradientMapProps,
type GradientMapStop,
@@ -734,6 +746,10 @@ export {
type HalftoneScreenProps,
HighPass,
type HighPassProps,
+ Iridescence,
+ type IridescenceProps,
+ Kaleidoscope,
+ type KaleidoscopeProps,
KenBurns,
type KenBurnsProps,
LayerStyle,
@@ -753,12 +769,20 @@ export {
type MotionBlurProps,
NoiseGenerator,
type NoiseGeneratorProps,
+ OpArt,
+ type OpArtProps,
Paint,
+ Painterly,
+ type PainterlyProps,
type PaintProps,
PatchHeal,
type PatchHealProps,
PBRGlass,
type PBRGlassProps,
+ Pixelate,
+ type PixelateProps,
+ Posterize,
+ type PosterizeProps,
ProceduralVFX,
type ProceduralVFXProps,
RefineEdge,
@@ -769,6 +793,8 @@ export {
type Relight3DProps,
ResizerScaler,
type ResizerScalerProps,
+ RGBSplit,
+ type RGBSplitProps,
Rotate,
type RotateProps,
SelectiveColor,
@@ -784,6 +810,8 @@ export {
TileOffset,
type TileOffsetEdgeMode,
type TileOffsetProps,
+ Toon,
+ type ToonProps,
Trails,
type TrailsProps,
UnsharpMask,
@@ -850,6 +878,7 @@ export {
type Surface3DOptions,
type Text3DOptions,
} from "./shapes3d.js";
+export { type StyleName, Styles } from "./styles.js";
export {
type SceneSequenceOptions,
type SequenceEntry,
@@ -2078,11 +2107,20 @@ function withAnimation<T extends LayoutNode>(node: T): AnimatableNode<T> {
? a.tracks
: ((a as { tracks?: AnimationTrack[] }).tracks ?? []),
);
- const existing =
- (target.animation as { tracks?: AnimationTrack[] } | undefined)
- ?.tracks ?? [];
+ const current = target.animation as
+ | { tracks?: AnimationTrack[]; frameStep?: number }
+ | undefined;
+ const existing = current?.tracks ?? [];
+ // The last `.stepped()` wins; stepping applies to the whole layer.
+ const frameStep =
+ anims
+ .flat()
+ .map((a) => (a as { frameStep?: number }).frameStep)
+ .filter((n): n is number => n !== undefined)
+ .at(-1) ?? current?.frameStep;
target.animation = {
tracks: mergeAnimationTracks([...existing, ...incoming]),
+ ...(frameStep !== undefined && frameStep > 1 && { frameStep }),
};
return target;
},
@@ -2557,6 +2595,48 @@ export const Layer = {
...(options.zIndex !== undefined && { zIndex: options.zIndex }),
} as unknown as MediaNode);
},
+ /**
+ * A procedural VFX layer (smoke, fire, rain, snow, aurora, …) drawn by
+ * the GPU, transparent where there is no effect. Put it above or below
+ * other layers like any clip.
+ */
+ vfx: (
+ options: Partial<ProceduralVFXProps> & {
+ x?: number;
+ y?: number;
+ width: number;
+ height: number;
+ id?: string;
+ startFrame?: number;
+ durationFrames?: number;
+ zIndex?: number;
+ },
+ ): AnimatableNode<MediaNode> => {
+ const { x, y, id, startFrame, durationFrames, zIndex, ...props } = options;
+ const vfx = new ProceduralVFX({
+ outputType: "Video",
+ ...props,
+ } as ProceduralVFXProps);
+ const source = {
+ metadata: { width: options.width, height: options.height },
+ operation: { ...vfx.toOperation(), effect: vfx, dataType: "Video" },
+ children: [],
+ };
+ return withAnimation({
+ id: id ?? autoId("vfx"),
+ kind: "media",
+ dataType: "Video",
+ src: source,
+ position: "absolute",
+ x: x ?? 0,
+ y: y ?? 0,
+ width: options.width,
+ height: options.height,
+ ...(startFrame !== undefined && { startFrame }),
+ ...(durationFrames !== undefined && { durationFrames }),
+ ...(zIndex !== undefined && { zIndex }),
+ } as unknown as MediaNode);
+ },
section: (
source: string | MediaNode | Composition,
targetOrOptions: ObjectTrackSignals | SectionOptions = {},
diff --git a/packages/framefields/src/motion-render.test.ts b/packages/framefields/src/motion-render.test.ts
new file mode 100644
index 00000000..489cf245
--- /dev/null
+++ b/packages/framefields/src/motion-render.test.ts
@@ -0,0 +1,100 @@
+/**
+ * Shape morphing and stepped timing through the real renderer.
+ */
+import { describe, expect, it } from "vitest";
+import {
+ Composition,
+ HeadlessMediaRenderer,
+ Layer,
+ LayerAnimation,
+} from "./index.js";
+import { decodePngPixels, getPixel } from "./test-utils/pixels.js";
+
+function stage(frames = 31) {
+ return new Composition({
+ width: 200,
+ height: 200,
+ fps: 30,
+ durationFrames: frames,
+ backgroundColor: "#000000",
+ });
+}
+
+const lit = (
+ img: Awaited<ReturnType<typeof decodePngPixels>>,
+ x: number,
+ y: number,
+) => getPixel(img, x, y).r > 128;
+
+describe("shape morphing", () => {
+ it("morphs a keyframed path between two shapes", async () => {
+ const c = stage();
+ c.add(
+ Layer.shape("path", {
+ position: "absolute",
+ x: 0,
+ y: 0,
+ width: 200,
+ height: 200,
+ d: "M90 90 H110 V110 H90 Z",
+ fillColor: "#ffffff",
+ }).animate(
+ LayerAnimation.keys("d", [
+ [0, "M90 90 H110 V110 H90 Z"],
+ [30, "M10 10 H190 V190 H10 Z"],
+ ]),
+ ),
+ );
+ const renderer = new HeadlessMediaRenderer();
+ const at = async (f: number) =>
+ decodePngPixels(await c.renderFrame({ frame: f, renderer }));
+ const start = await at(0);
+ const mid = await at(15);
+ const end = await at(30);
+ expect(lit(start, 100, 100)).toBe(true);
+ expect(lit(start, 60, 60)).toBe(false);
+ // Halfway: the square spans 50–150.
+ expect(lit(mid, 60, 60)).toBe(true);
+ expect(lit(mid, 40, 40)).toBe(false);
+ expect(lit(end, 20, 20)).toBe(true);
+ });
+});
+
+describe("stepped timing", () => {
+ it("holds each pose for frameStep frames", async () => {
+ const box = (stepped: boolean) => {
+ const c = stage();
+ const anim = LayerAnimation.keys("x", [
+ [0, 0],
+ [30, 150],
+ ]);
+ c.add(
+ Layer.box({
+ position: "absolute",
+ x: 0,
+ y: 80,
+ width: 40,
+ height: 40,
+ background: "#ffffff",
+ }).animate(stepped ? [anim, LayerAnimation.stepped(2)] : [anim]),
+ );
+ return c;
+ };
+ const renderer = new HeadlessMediaRenderer();
+ const leftEdge = async (c: Composition, f: number) => {
+ const img = decodePngPixels(await c.renderFrame({ frame: f, renderer }));
+ for (let x = 0; x < 200; x++) if (lit(await img, x, 100)) return x;
+ return -1;
+ };
+ const stepped = box(true);
+ const smooth = box(false);
+ // On twos: frames 10 and 11 show the same pose; smooth moves 5 px.
+ expect(await leftEdge(stepped, 11)).toBe(await leftEdge(stepped, 10));
+ expect(await leftEdge(stepped, 12)).toBeGreaterThan(
+ await leftEdge(stepped, 11),
+ );
+ expect(await leftEdge(smooth, 11)).toBeGreaterThan(
+ await leftEdge(smooth, 10),
+ );
+ });
+});
diff --git a/packages/framefields/src/styles.ts b/packages/framefields/src/styles.ts
new file mode 100644
index 00000000..40670284
--- /dev/null
+++ b/packages/framefields/src/styles.ts
@@ -0,0 +1,237 @@
+/**
+ * Ready-made looks: each preset is a short stack of effects, applied with
+ * `layer.withEffects(Styles.vhs())`. Presets take a few options for the
+ * knobs that matter most; for anything finer, build the stack from the
+ * effect classes directly.
+ */
+import type { Effect } from "@framefields/core";
+import {
+ Ascii,
+ Contour,
+ CRT,
+ Dither,
+ FilmGrain,
+ GradientMap,
+ HalftoneScreen,
+ Iridescence,
+ Kaleidoscope,
+ OpArt,
+ Painterly,
+ Pixelate,
+ Posterize,
+ RGBSplit,
+ Toon,
+ Vignette,
+} from "./effects/index.js";
+
+type Look = Effect<object>[];
+const look = (...effects: unknown[]): Look => effects as Look;
+
+export const Styles = {
+ /** 8-bit game: PICO-8 palette, chunky pixels, light dithering. */
+ pixelArt: (
+ o: { pixelSize?: number; palette?: "pico8" | "c64" | "cga" } = {},
+ ) =>
+ look(
+ new Posterize({
+ palette: o.palette ?? "pico8",
+ pixelSize: o.pixelSize ?? 6,
+ dither: 0.4,
+ }),
+ ),
+
+ /** Original Game Boy: four greens, dithered, big pixels. */
+ gameBoy: (o: { pixelSize?: number } = {}) =>
+ look(
+ new Posterize({
+ palette: "gameboy",
+ pixelSize: o.pixelSize ?? 4,
+ dither: 0.6,
+ }),
+ ),
+
+ /** Teletext / Ceefax: eight flat colors in big blocks. */
+ teletext: (o: { pixelSize?: number } = {}) =>
+ look(new Posterize({ palette: "teletext", pixelSize: o.pixelSize ?? 10 })),
+
+ /** LED wall: round lit pixels with gaps. */
+ ledWall: (o: { size?: number } = {}) =>
+ look(new Pixelate({ size: o.size ?? 14, shape: "circle", gap: 0.18 })),
+
+ /** Text-mode art: the clip drawn in characters. `matrix` makes it green phosphor. */
+ ascii: (o: { cellSize?: number; matrix?: boolean } = {}) =>
+ look(
+ new Ascii({
+ cellSize: o.cellSize ?? 10,
+ colorMode: o.matrix ? "green" : "source",
+ bg: o.matrix ? "#020a04" : "#0b0b0b",
+ }),
+ ),
+
+ /** 1-bit print: ordered dither in two inks. */
+ oneBit: (o: { dark?: string; light?: string; scale?: number } = {}) =>
+ look(
+ new Dither({
+ mode: "bayer",
+ scale: o.scale ?? 2,
+ dark: o.dark ?? "#111111",
+ light: o.light ?? "#f2efe6",
+ }),
+ ),
+
+ /** Riso print: two inks on paper, ordered dither, grain. */
+ risograph: (o: { inkA?: string; inkB?: string; paper?: string } = {}) => {
+ const a = o.inkA ?? "#1d3fbb";
+ const b = o.inkB ?? "#ff5fa2";
+ const paper = o.paper ?? "#f4efe4";
+ return look(
+ new GradientMap({
+ stops: [
+ { position: 0, color: a },
+ { position: 0.55, color: b },
+ { position: 1, color: paper },
+ ],
+ }),
+ new Posterize({
+ palette: "custom",
+ colors: [a, b, paper],
+ dither: 0.8,
+ pixelSize: 2,
+ }),
+ new FilmGrain({ strength: 0.2 }),
+ );
+ },
+
+ /** Cartoon / cel shading with ink outlines. */
+ cartoon: (o: { levels?: number; ink?: string } = {}) =>
+ look(
+ new Toon({
+ levels: o.levels ?? 4,
+ edgeColor: o.ink ?? "#111111",
+ saturation: 1.3,
+ }),
+ ),
+
+ /** Comic book: cel shading, ink lines and a halftone dot screen. */
+ comic: (o: { dotFrequency?: number } = {}) =>
+ look(
+ new Toon({ levels: 4, edgeWidth: 1.5, saturation: 1.4 }),
+ new HalftoneScreen({ frequency: o.dotFrequency ?? 70, opacity: 0.35 }),
+ ),
+
+ /** Thermal camera: brightness mapped to the ironbow palette. */
+ thermal: () =>
+ look(
+ new GradientMap({
+ stops: [
+ { position: 0, color: "#000010" },
+ { position: 0.25, color: "#3b0a7a" },
+ { position: 0.5, color: "#c4205f" },
+ { position: 0.75, color: "#ff9a1f" },
+ { position: 1, color: "#fffbe0" },
+ ],
+ }),
+ ),
+
+ /** VHS tape: wobble, colour bleed, soft scanlines, grain. */
+ vhs: (o: { tracking?: number } = {}) =>
+ look(
+ new CRT({
+ tracking: o.tracking ?? 0.5,
+ chroma: 4,
+ curvature: 0.04,
+ scanlines: 0.25,
+ mask: 0.05,
+ noise: 0.15,
+ }),
+ new RGBSplit({ amount: 3 }),
+ ),
+
+ /** An old CRT monitor: curved glass, scanlines, RGB mask. */
+ crt: (o: { curvature?: number } = {}) =>
+ look(
+ new CRT({ curvature: o.curvature ?? 0.15, scanlines: 0.5, mask: 0.35 }),
+ ),
+
+ /** Glitch: hard RGB split plus tracking errors. Animate `amount` for hits. */
+ glitch: (o: { amount?: number } = {}) =>
+ look(
+ new RGBSplit({ amount: o.amount ?? 18 }),
+ new CRT({
+ tracking: 1,
+ chroma: 6,
+ curvature: 0,
+ scanlines: 0.1,
+ mask: 0,
+ vignette: 0,
+ }),
+ ),
+
+ /** Oil painting. */
+ oilPainting: (o: { brush?: number } = {}) =>
+ look(new Painterly({ style: "oil", radius: o.brush ?? 5 })),
+
+ /** Watercolour: soft patches, pigment edges, paper. */
+ watercolor: (o: { brush?: number } = {}) =>
+ look(
+ new Painterly({ style: "watercolor", radius: o.brush ?? 6, paper: 0.5 }),
+ ),
+
+ /** Topographic map lines on paper. */
+ topographic: (o: { levels?: number; ink?: string; paper?: string } = {}) =>
+ look(
+ new Contour({
+ levels: o.levels ?? 16,
+ fill: "flat",
+ lineColor: o.ink ?? "#5a3a1a",
+ fillColor: o.paper ?? "#f3ead8",
+ }),
+ ),
+
+ /** Kaleidoscope. Animate `rotation` on the returned effect, or pass a fixed angle. */
+ kaleidoscope: (o: { segments?: number; rotation?: number } = {}) =>
+ look(
+ new Kaleidoscope({
+ segments: o.segments ?? 8,
+ rotation: o.rotation ?? 0,
+ }),
+ ),
+
+ /** Op art / line portrait: stripes bent by the image. */
+ opArt: (
+ o: {
+ pattern?: "stripes" | "rings" | "checker" | "waves";
+ frequency?: number;
+ } = {},
+ ) =>
+ look(
+ new OpArt({
+ pattern: o.pattern ?? "stripes",
+ frequency: o.frequency ?? 60,
+ }),
+ ),
+
+ /** Holographic foil sheen. Animate `shift` to make it move. */
+ holographic: (o: { strength?: number; shift?: number } = {}) =>
+ look(new Iridescence({ strength: o.strength ?? 0.7, shift: o.shift ?? 0 })),
+
+ /** Black-and-white film noir: crushed tones, grain, vignette. */
+ noir: () =>
+ look(
+ new GradientMap({
+ stops: [
+ { position: 0, color: "#000000" },
+ { position: 0.55, color: "#8a8a8a" },
+ { position: 1, color: "#ffffff" },
+ ],
+ }),
+ new FilmGrain({ strength: 0.35 }),
+ new Vignette({ strength: 0.6 }),
+ ),
+
+ /** Analog film: grain and a soft vignette. */
+ film: () =>
+ look(new FilmGrain({ strength: 0.25 }), new Vignette({ strength: 0.35 })),
+};
+
+export type StyleName = keyof typeof Styles;
diff --git a/packages/framefields/src/stylize-render.test.ts b/packages/framefields/src/stylize-render.test.ts
new file mode 100644
index 00000000..a5d8d792
--- /dev/null
+++ b/packages/framefields/src/stylize-render.test.ts
@@ -0,0 +1,178 @@
+/**
+ * Stylize effects through the real renderer, on a synthetic clip: each look
+ * changes the picture the way it says it does.
+ */
+import fs from "node:fs/promises";
+import os from "node:os";
+import path from "node:path";
+import { beforeAll, describe, expect, it } from "vitest";
+import {
+ Ascii,
+ Composition,
+ Gooey,
+ HeadlessMediaRenderer,
+ Kaleidoscope,
+ Layer,
+ Pixelate,
+ Posterize,
+ RGBSplit,
+} from "./index.js";
+import { decodePngPixels, getPixel } from "./test-utils/pixels.js";
+
+const S = 200;
+
+function stage() {
+ return new Composition({
+ width: S,
+ height: S,
+ fps: 30,
+ durationFrames: 2,
+ backgroundColor: "#000000",
+ });
+}
+
+/** A still: horizontal gray ramp with a white square in the left half. */
+let clip = "";
+beforeAll(async () => {
+ const dir = await fs.mkdtemp(path.join(os.tmpdir(), "ff-stylize-"));
+ clip = path.join(dir, "still.mp4");
+ const c = stage();
+ c.add([
+ Layer.box({
+ position: "absolute",
+ x: 0,
+ y: 0,
+ width: S,
+ height: S,
+ background: "linear-gradient(90deg, #000000, #ffffff)",
+ }),
+ Layer.box({
+ position: "absolute",
+ x: 40,
+ y: 80,
+ width: 40,
+ height: 40,
+ background: "#ffffff",
+ }),
+ ]);
+ const r = await c.renderVideo({ outputPath: clip, quality: "lossless" });
+ await r.cleanup?.();
+}, 60_000);
+
+// biome-ignore lint/suspicious/noExplicitAny: any generated effect class
+async function look(effect: any) {
+ const c = stage();
+ c.add(
+ Layer.video(clip, {
+ position: "absolute",
+ x: 0,
+ y: 0,
+ width: S,
+ height: S,
+ fit: "cover",
+ muted: true,
+ }).withEffect(effect),
+ );
+ return decodePngPixels(
+ await c.renderFrame({ frame: 0, renderer: new HeadlessMediaRenderer() }),
+ );
+}
+
+describe("stylize effects", () => {
+ it("Pixelate makes flat cells", async () => {
+ const img = await look(new Pixelate({ size: 20 }));
+ // Inside one 20 px cell of the ramp, every pixel is the same.
+ const a = getPixel(img, 141, 5).r;
+ expect(Math.abs(getPixel(img, 158, 18).r - a)).toBeLessThan(3);
+ // The next cell is brighter.
+ expect(getPixel(img, 165, 5).r).toBeGreaterThan(a + 10);
+ });
+
+ it("Posterize snaps to a palette", async () => {
+ const img = await look(new Posterize({ palette: "gameboy" }));
+ const allowed = [
+ [0x0f, 0x38, 0x0f],
+ [0x30, 0x62, 0x30],
+ [0x8b, 0xac, 0x0f],
+ [0x9b, 0xbc, 0x0f],
+ ];
+ for (let x = 5; x < S; x += 23) {
+ const p = getPixel(img, x, 30);
+ const d = Math.min(
+ ...allowed.map(
+ ([r, g, b]) =>
+ Math.abs(p.r - r) + Math.abs(p.g - g) + Math.abs(p.b - b),
+ ),
+ );
+ expect(d).toBeLessThan(12);
+ }
+ });
+
+ it("RGBSplit pulls red and blue apart", async () => {
+ const img = await look(new RGBSplit({ amount: 10 }));
+ // Left of the white square (x 40): red reads from +10 px, so it is lit; blue is not.
+ const p = getPixel(img, 35, 100);
+ expect(p.r).toBeGreaterThan(p.b + 80);
+ const q = getPixel(img, 85, 100);
+ expect(q.b).toBeGreaterThan(q.r + 30);
+ });
+
+ it("Kaleidoscope mirrors around the center", async () => {
+ const img = await look(new Kaleidoscope({ segments: 4 }));
+ const a = getPixel(img, 60, 100);
+ const b = getPixel(img, 140, 100);
+ expect(Math.abs(a.r - b.r)).toBeLessThan(12);
+ });
+
+ it("Ascii draws glyphs on the background color", async () => {
+ const img = await look(
+ new Ascii({ cellSize: 10, fg: "#ffffff", bg: "#0000ff" }),
+ );
+ let bg = 0;
+ let fg = 0;
+ for (let y = 80; y < 120; y++) {
+ for (let x = 40; x < 80; x++) {
+ const p = getPixel(img, x, y);
+ if (p.b > 200 && p.r < 40) bg++;
+ if (p.r > 200) fg++;
+ }
+ }
+ // The white square is dense glyphs: both colors present.
+ expect(fg).toBeGreaterThan(200);
+ expect(bg).toBeGreaterThan(100);
+ });
+
+ it("Gooey melts nearby shapes together", async () => {
+ const dir = await fs.mkdtemp(path.join(os.tmpdir(), "ff-gooey-"));
+ const svg = path.join(dir, "dots.svg");
+ await fs.writeFile(
+ svg,
+ `<svg xmlns="http://www.w3.org/2000/svg" width="${S}" height="${S}">` +
+ `<circle cx="72" cy="100" r="20" fill="#fff"/><circle cx="128" cy="100" r="20" fill="#fff"/></svg>`,
+ );
+ const render = async (gooey: boolean) => {
+ const c = stage();
+ const dots = Layer.svg(svg, {
+ position: "absolute",
+ x: 0,
+ y: 0,
+ width: S,
+ height: S,
+ });
+ c.add(
+ gooey
+ ? dots.withEffect(new Gooey({ radius: 24, threshold: 0.3 }))
+ : dots,
+ );
+ return decodePngPixels(
+ await c.renderFrame({
+ frame: 0,
+ renderer: new HeadlessMediaRenderer(),
+ }),
+ );
+ };
+ // The gap between the dots (x 92–108) is empty without it, bridged with it.
+ expect(getPixel(await render(false), 100, 100).r).toBeLessThan(10);
+ expect(getPixel(await render(true), 100, 100).r).toBeGreaterThan(150);
+ });
+});
diff --git a/packages/renderer/package.json b/packages/renderer/package.json
index 1e67c339..3fd63367 100644
--- a/packages/renderer/package.json
+++ b/packages/renderer/package.json
@@ -44,6 +44,7 @@
"@framefields/client-utils": "workspace:*",
"@framefields/compositions": "workspace:*",
"@framefields/core": "workspace:*",
+ "@framefields/node-ascii": "workspace:*",
"@framefields/node-audio-compressor": "workspace:*",
"@framefields/node-audio-delay": "workspace:*",
"@framefields/node-audio-fade": "workspace:*",
@@ -59,19 +60,25 @@
"@framefields/node-color-balance": "workspace:*",
"@framefields/node-colorkey": "workspace:*",
"@framefields/node-compositor": "workspace:*",
+ "@framefields/node-contour": "workspace:*",
"@framefields/node-corner-pin": "workspace:*",
"@framefields/node-crop": "workspace:*",
+ "@framefields/node-crt": "workspace:*",
"@framefields/node-curves": "workspace:*",
"@framefields/node-datamosh": "workspace:*",
"@framefields/node-deflicker": "workspace:*",
"@framefields/node-displacement-map": "workspace:*",
+ "@framefields/node-dither": "workspace:*",
"@framefields/node-extract-frame": "workspace:*",
"@framefields/node-extract-lut": "workspace:*",
"@framefields/node-film-grain": "workspace:*",
"@framefields/node-flip": "workspace:*",
+ "@framefields/node-gooey": "workspace:*",
"@framefields/node-gradient-map": "workspace:*",
"@framefields/node-halftone-screen": "workspace:*",
"@framefields/node-high-pass": "workspace:*",
+ "@framefields/node-iridescence": "workspace:*",
+ "@framefields/node-kaleidoscope": "workspace:*",
"@framefields/node-kenburns": "workspace:*",
"@framefields/node-layer-style": "workspace:*",
"@framefields/node-levels": "workspace:*",
@@ -81,13 +88,19 @@
"@framefields/node-mesh-warp": "workspace:*",
"@framefields/node-modulate": "workspace:*",
"@framefields/node-noise-generator": "workspace:*",
+ "@framefields/node-op-art": "workspace:*",
"@framefields/node-paint": "workspace:*",
+ "@framefields/node-painterly": "workspace:*",
"@framefields/node-particles": "workspace:*",
"@framefields/node-patch-heal": "workspace:*",
+ "@framefields/node-pixelate": "workspace:*",
+ "@framefields/node-posterize": "workspace:*",
+ "@framefields/node-procedural-vfx": "workspace:*",
"@framefields/node-refine-edge": "workspace:*",
"@framefields/node-refraction-caustics": "workspace:*",
"@framefields/node-relight-3d": "workspace:*",
"@framefields/node-resizer-scaler": "workspace:*",
+ "@framefields/node-rgb-split": "workspace:*",
"@framefields/node-rotate": "workspace:*",
"@framefields/node-sdk": "workspace:*",
"@framefields/node-selective-color": "workspace:*",
@@ -96,6 +109,7 @@
"@framefields/node-signal-gate": "workspace:*",
"@framefields/node-stereo-panning": "workspace:*",
"@framefields/node-tile-offset": "workspace:*",
+ "@framefields/node-toon": "workspace:*",
"@framefields/node-trails": "workspace:*",
"@framefields/node-unsharp-mask": "workspace:*",
"@framefields/node-vignette": "workspace:*",
diff --git a/packages/renderer/src/generated/node-renderers.ts b/packages/renderer/src/generated/node-renderers.ts
index 1948f127..7cad4f66 100644
--- a/packages/renderer/src/generated/node-renderers.ts
+++ b/packages/renderer/src/generated/node-renderers.ts
@@ -16,6 +16,11 @@ export const BUILTIN_NODE_RENDERERS: readonly BuiltinNodeRenderer[] = [
ops: ["ApplyLUT"],
load: () => import("@framefields/node-lut/renderer"),
},
+ {
+ packageName: "@framefields/node-ascii",
+ ops: ["Ascii"],
+ load: () => import("@framefields/node-ascii/renderer"),
+ },
{
packageName: "@framefields/node-audio-compressor",
ops: ["AudioCompressor"],
@@ -91,6 +96,11 @@ export const BUILTIN_NODE_RENDERERS: readonly BuiltinNodeRenderer[] = [
ops: ["Compositor"],
load: () => import("@framefields/node-compositor/renderer"),
},
+ {
+ packageName: "@framefields/node-contour",
+ ops: ["Contour"],
+ load: () => import("@framefields/node-contour/renderer"),
+ },
{
packageName: "@framefields/node-corner-pin",
ops: ["CornerPin"],
@@ -101,6 +111,11 @@ export const BUILTIN_NODE_RENDERERS: readonly BuiltinNodeRenderer[] = [
ops: ["Crop"],
load: () => import("@framefields/node-crop/renderer"),
},
+ {
+ packageName: "@framefields/node-crt",
+ ops: ["CRT"],
+ load: () => import("@framefields/node-crt/renderer"),
+ },
{
packageName: "@framefields/node-curves",
ops: ["Curves"],
@@ -121,6 +136,11 @@ export const BUILTIN_NODE_RENDERERS: readonly BuiltinNodeRenderer[] = [
ops: ["DisplacementMap"],
load: () => import("@framefields/node-displacement-map/renderer"),
},
+ {
+ packageName: "@framefields/node-dither",
+ ops: ["Dither"],
+ load: () => import("@framefields/node-dither/renderer"),
+ },
{
packageName: "@framefields/node-extract-frame",
ops: ["ExtractFrame"],
@@ -141,6 +161,11 @@ export const BUILTIN_NODE_RENDERERS: readonly BuiltinNodeRenderer[] = [
ops: ["Flip"],
load: () => import("@framefields/node-flip/renderer"),
},
+ {
+ packageName: "@framefields/node-gooey",
+ ops: ["Gooey"],
+ load: () => import("@framefields/node-gooey/renderer"),
+ },
{
packageName: "@framefields/node-gradient-map",
ops: ["GradientMap"],
@@ -156,6 +181,16 @@ export const BUILTIN_NODE_RENDERERS: readonly BuiltinNodeRenderer[] = [
ops: ["HighPass"],
load: () => import("@framefields/node-high-pass/renderer"),
},
+ {
+ packageName: "@framefields/node-iridescence",
+ ops: ["Iridescence"],
+ load: () => import("@framefields/node-iridescence/renderer"),
+ },
+ {
+ packageName: "@framefields/node-kaleidoscope",
+ ops: ["Kaleidoscope"],
+ load: () => import("@framefields/node-kaleidoscope/renderer"),
+ },
{
packageName: "@framefields/node-kenburns",
ops: ["KenBurns"],
@@ -196,11 +231,21 @@ export const BUILTIN_NODE_RENDERERS: readonly BuiltinNodeRenderer[] = [
ops: ["NoiseGenerator"],
load: () => import("@framefields/node-noise-generator/renderer"),
},
+ {
+ packageName: "@framefields/node-op-art",
+ ops: ["OpArt"],
+ load: () => import("@framefields/node-op-art/renderer"),
+ },
{
packageName: "@framefields/node-paint",
ops: ["Paint"],
load: () => import("@framefields/node-paint/renderer"),
},
+ {
+ packageName: "@framefields/node-painterly",
+ ops: ["Painterly"],
+ load: () => import("@framefields/node-painterly/renderer"),
+ },
{
packageName: "@framefields/node-particles",
ops: ["Particles"],
@@ -211,6 +256,21 @@ export const BUILTIN_NODE_RENDERERS: readonly BuiltinNodeRenderer[] = [
ops: ["PatchHeal"],
load: () => import("@framefields/node-patch-heal/renderer"),
},
+ {
+ packageName: "@framefields/node-pixelate",
+ ops: ["Pixelate"],
+ load: () => import("@framefields/node-pixelate/renderer"),
+ },
+ {
+ packageName: "@framefields/node-posterize",
+ ops: ["Posterize"],
+ load: () => import("@framefields/node-posterize/renderer"),
+ },
+ {
+ packageName: "@framefields/node-procedural-vfx",
+ ops: ["ProceduralVFX"],
+ load: () => import("@framefields/node-procedural-vfx/renderer"),
+ },
{
packageName: "@framefields/node-refine-edge",
ops: ["RefineEdge"],
@@ -231,6 +291,11 @@ export const BUILTIN_NODE_RENDERERS: readonly BuiltinNodeRenderer[] = [
ops: ["ResizerScaler"],
load: () => import("@framefields/node-resizer-scaler/renderer"),
},
+ {
+ packageName: "@framefields/node-rgb-split",
+ ops: ["RGBSplit"],
+ load: () => import("@framefields/node-rgb-split/renderer"),
+ },
{
packageName: "@framefields/node-rotate",
ops: ["Rotate"],
@@ -266,6 +331,11 @@ export const BUILTIN_NODE_RENDERERS: readonly BuiltinNodeRenderer[] = [
ops: ["TileOffset"],
load: () => import("@framefields/node-tile-offset/renderer"),
},
+ {
+ packageName: "@framefields/node-toon",
+ ops: ["Toon"],
+ load: () => import("@framefields/node-toon/renderer"),
+ },
{
packageName: "@framefields/node-trails",
ops: ["Trails"],
diff --git a/plugins/framefields/skills/framefields-compose/SKILL.md b/plugins/framefields/skills/framefields-compose/SKILL.md
index 16898c2a..5959c3c7 100644
--- a/plugins/framefields/skills/framefields-compose/SKILL.md
+++ b/plugins/framefields/skills/framefields-compose/SKILL.md
@@ -92,7 +92,9 @@ All `Layer.*` builders return `AnimatableNode<T>` instances with chainable `.ani
| `Layer.svg(src, options)` | `"media"` | Vector SVG asset. Options: `fit: "contain"`. |
| `Layer.lottie(src, options)` | `"media"` | Lottie vector animation file (`.json`, `.lottie`). Decoded and rendered via ThorVG. Options: `fit: "contain" \| "cover" \| "fill"`, `width`, `height`. |
| `Layer.audio(src, options)` | `"media"` | Audio track layer. Options: `volume`, `startFrame`, `durationFrames`. |
-| `Layer.shape(type, options)` | `"shape"` | Parametric vector graphics (`"rect"`, `"circle"`, `"ellipse"`, `"polygon"`, `"star"`, `"arrow"`, `"path"`). Options: `fill` (a color or CSS gradient), `d` (SVG path data with arcs), `strokeWidth`, `strokeColor`, `trimStart`, `trimEnd`. |
+| `Layer.shape(type, options)` | `"shape"` | Parametric vector graphics (`"rect"`, `"circle"`, `"ellipse"`, `"polygon"`, `"star"`, `"arrow"`, `"path"`). Options: `fill` (a color or CSS gradient), `d` (SVG path data with arcs; keyframe it to morph shapes), `strokeWidth`, `strokeColor`, `trimStart`, `trimEnd`. |
+| `Layer.particles(options)` | `"media"` | GPU particle system (see *GPU Particles*). |
+| `Layer.vfx(options)` | `"media"` | Procedural full-frame VFX: smoke, fire, rain, snow, aurora… (see *Procedural VFX*). |
| `Layer.caption(src, options)` | `"media"` | SRT-driven synchronized subtitle engine. Bottom-anchored auto-wrapping cues. |
| `Layer.chart(options, props)` | `"box"` | Charts built from native nodes (d3 scales and geometry). `type`: `"line" \| "area" \| "bar" \| "scatter" \| "candlestick" \| "pie" \| "donut"`. Options: `width`, `height`, `series: [{ name, data, color, type, curve, pointRadius }]` or `data`, `categories`, `stacked`, `xAxis`/`yAxis` (`min`, `max`, `ticks`, `grid`, `format`: a d3-format string like `"$,.0f"`), `legend`, `valueLabels`, `fontFamily`, `fontSize`, `colors`, `animate: { start, duration, stagger, ease } \| false`. `props` positions the chart box. Children get ids `<id>-bar-<series>-<i>`, `<id>-line-<series>`, `<id>-slice-<i>`. Keep scatter charts to a few hundred points: each point is a node. |
| `Layer.camera(options)` | `"camera"` | 3D scene camera with FOV, lens rack focus, and orbital coordinates. |
@@ -276,6 +278,46 @@ const glow = LayerAnimation.keys("color", [[42, GLOW], [60, REST, "sine.inOut"
key.animate(rainIn).animate(press, glow); // or LayerAnimation.merge(rainIn, press, glow)
```
+### Stepped timing ("on twos")
+
+`LayerAnimation.stepped(n)` holds every animated value of the layer for `n` frames: `2` is "on twos", the choppy, hand-made feel of cel animation, stop motion and paper cut-outs. It applies to all of the layer's tracks (keyframes keep their eases; signals and wiggles step too). Mix stepped characters over a smooth camera or background for the classic look.
+
+```typescript
+puppet.animate(walkCycle, bob, LayerAnimation.stepped(2));
+```
+
+### Shape morphing
+
+A path shape's `d` is animatable: keyframe two or more SVG paths and they morph. Any paths work (different point counts, curves, arcs, several subpaths); they are resampled and lined up so the morph does not twist. Eases apply as usual.
+
+```typescript
+Layer.shape("path", { position: "absolute", x: 0, y: 0, width: 400, height: 400, d: BLOB_A, fillColor: "#3B82F6" })
+ .animate(LayerAnimation.keys("d", [[0, BLOB_A], [24, STAR, "back.out(1.4)"], [48, HEART, "expo.inOut"]]));
+```
+
+For liquid merges between separate shapes, draw them into one SVG or particle layer and add `Gooey` (blur + alpha threshold = metaballs).
+
+---
+
+## Blend Modes
+
+Any layer takes `blendMode`, which sets how it mixes with what is drawn beneath it. Use it on glows, textures, light leaks, grain, color washes and type over footage.
+
+| Mode | Use it for |
+|---|---|
+| `"normal"` (default) | Plain over. |
+| `"screen"`, `"lighter"` (add), `"color-dodge"`, `"lighten"` | Light: glows, flares, light leaks, fire/sparks footage shot on black. |
+| `"multiply"`, `"color-burn"`, `"darken"` | Shade: paper and grunge textures, shadows, ink on paper. |
+| `"overlay"`, `"soft-light"`, `"hard-light"` | Contrast textures, film grain, color washes that keep the image's shading. |
+| `"difference"`, `"exclusion"` | Inverting type over video, glitchy flashes. |
+| `"hue"`, `"saturation"`, `"color"`, `"luminosity"` | Recolour footage with a flat color layer (`"color"` = tint, keeps the light). |
+| `"mask-in"` / `"mask-out"`, `"luma-in"` / `"luma-out"`, `"source-*"`, `"destination-*"`, `"xor"` | Compositing operators: keep the base where this layer is opaque / transparent / bright / dark. Prefer `withMatte` for reveals. |
+
+```typescript
+Layer.video("assets/light-leak.mp4", { position: "absolute", x: 0, y: 0, width: W, height: H, fit: "cover", blendMode: "screen", opacity: 0.8 })
+Layer.box({ position: "absolute", x: 0, y: 0, width: W, height: H, background: "#ff3d7f", blendMode: "color", opacity: 0.6 }) // duotone-ish tint
+```
+
---
## Track Mattes (masks, wipes, reveals)
@@ -444,6 +486,18 @@ comp.add(Layer.particles({
---
+## Procedural VFX (`Layer.vfx`)
+
+Full-frame procedural looks drawn by one shader, transparent where there is no effect. Stack them above or below footage, and set a `blendMode` (usually `"screen"`) for light effects.
+
+```typescript
+Layer.vfx({ effectType: "Aurora", width: W, height: H, colorStart: "#2bff88", colorEnd: "#7a3cff", density: 0.7, speed: 1 })
+```
+
+`effectType`: `Smoke`, `Fire`, `Rain`, `Sparks`, `Snow`, `Dust`, `Lightning`, `Magic`, `LensFlare`, `Embers`, `EnergyBeam`, `Aurora`. Shared knobs: `density`, `scale`, `speed`, `intensity` and `seed` (numbers or signals), plus `colorStart` / `colorEnd`. For particles that react to physics, a performer or attractors, use `Layer.particles` instead.
+
+---
+
## Critical Authoring Rules & Gotchas
1. **Local Keyframe Coordinates:** Keyframes are strictly relative to the node's own timeline window (`0` = node appearance). Never offset keyframe frames by the parent's `startFrame`.
diff --git a/plugins/framefields/skills/framefields-effects/SKILL.md b/plugins/framefields/skills/framefields-effects/SKILL.md
index 13ff997e..0c9828a9 100644
--- a/plugins/framefields/skills/framefields-effects/SKILL.md
+++ b/plugins/framefields/skills/framefields-effects/SKILL.md
@@ -1,6 +1,6 @@
---
name: framefields-effects
-description: Apply, configure, and modulate WebGPU post-processing shaders, cinematic color grading, tone mapping, procedural VFX, and on-device vision (object tracking, instance segmentation, pose, person mattes) in framefields. Use when adding blur, grain, LUTs, relighting, curves, greenscreen color keying, subject cutouts, or tracking-driven effects in framefields compositions.
+description: Apply, configure, and modulate WebGPU post-processing shaders, stylized looks (pixel art, ASCII, VHS, comic, watercolor, risograph, holographic — and which look fits which request), cinematic color grading, tone mapping, procedural VFX, and on-device vision (object tracking, instance segmentation, pose, person mattes) in framefields. Use when adding blur, grain, LUTs, relighting, curves, greenscreen color keying, subject cutouts, or tracking-driven effects in framefields compositions.
---
# framefields-effects
@@ -126,6 +126,27 @@ const pngBuffer = await clip.renderFrame({ atMs: 1500 });
- **`ColorKey`**: Studio greenscreen/bluescreen keyer with spill suppression and smoothness controls.
- **`Crop`**: Rectangular, circular, or arbitrary polygon path cropping with corner rounding.
+### 5. Stylize Looks (`Styles.*`)
+
+**Which look for which request:** see [references/style-guide.md](references/style-guide.md). It maps phrases like "VHS", "8-bit", "comic" or "liquid logo" to presets, effects and techniques. Read it whenever someone names a style.
+
+`Styles.<name>(options?)` returns an effect stack: `layer.withEffects(Styles.vhs())`. Presets: `pixelArt`, `gameBoy`, `teletext`, `ledWall`, `ascii`, `oneBit`, `risograph`, `comic`, `cartoon`, `thermal`, `vhs`, `crt`, `glitch`, `oilPainting`, `watercolor`, `topographic`, `kaleidoscope`, `opArt`, `holographic`, `noir`, `film`.
+
+The effects behind them, for finer control:
+- **`Pixelate`**: big pixels; `shape: "square" | "circle" | "diamond"` (LED wall), `gap`.
+- **`Posterize`**: fewer colors, or snap to a `palette` (`gameboy`, `teletext`, `cga`, `pico8`, `c64`, `grayscale`, `sepia`, `custom` + `colors`) with Bayer `dither` and `pixelSize`.
+- **`Dither`**: `bayer` / `noise` / `halftone`; 1-bit duotone (`dark` / `light`) or per-channel `levels`.
+- **`Ascii`**: glyphs by brightness; `colorMode: "mono" | "source" | "green"`, `cellSize`, `fg` / `bg`, `invert`.
+- **`Toon`**: brightness bands plus Sobel ink lines (`edgeColor`, `edgeWidth`, `edgeThreshold`).
+- **`RGBSplit`**: chromatic aberration along `angle` or `radial`.
+- **`CRT`**: curvature, scanlines, aperture mask, noise, flicker, vignette; `tracking` and `chroma` give VHS wobble and colour bleed.
+- **`Painterly`**: Kuwahara `oil` / `watercolor` (pigment edges, paper grain).
+- **`Contour`**: topographic isolines over the `source`, a `flat` paper colour, or nothing.
+- **`Kaleidoscope`**: mirror `segments` around a center; animate `rotation` / `zoom`.
+- **`OpArt`**: stripes / rings / checker / waves bent and thickened by the image.
+- **`Iridescence`**: thin-film rainbow from brightness or relief; animate `shift`.
+- **`Gooey`**: blur + alpha threshold (metaballs). Use it on layers with transparency (SVG, particles), not on opaque footage.
+
---
## On-Device Vision
diff --git a/plugins/framefields/skills/framefields-effects/references/effects-catalog.md b/plugins/framefields/skills/framefields-effects/references/effects-catalog.md
index 20a05cd8..00030fff 100644
--- a/plugins/framefields/skills/framefields-effects/references/effects-catalog.md
+++ b/plugins/framefields/skills/framefields-effects/references/effects-catalog.md
@@ -3,7 +3,7 @@
> Generated by `pnpm run sync:effects-catalog` from the node schemas (via `pnpm run generate:effects`) and `packages/framefields/src/effects/classes.ts`.
> Do not edit by hand — a stale catalog fails `pnpm run check:plugins`.
-54 effect classes are available from the package root and the `/effects` subpath:
+67 effect classes are available from the package root and the `/effects` subpath:
```ts
import { Blur, Curves, FilmGrain } from "framefields";
@@ -21,6 +21,7 @@ Set `FRAMEFIELDS_STRICT_PROPS=1` to make an unknown prop or an out-of-range valu
| Effect | `op` | Props |
| --- | --- | --- |
+| `Ascii` | `Ascii` | `cellSize`, `colorMode`, `fg`, `bg`, `contrast`, `invert` |
| `AudioCompressor` | `AudioCompressor` | `threshold`, `ratio`, `attack`, `release`, `knee`, `makeupGain` |
| `AudioDelay` | `AudioDelay` | `delayTime`, `feedback`, `wet`, `dry`, `pingPong` |
| `AudioFade` | `AudioFade` | `fadeInDuration`, `fadeOutDuration`, `fadeInCurve`, `fadeOutCurve` |
@@ -33,25 +34,37 @@ Set `FRAMEFIELDS_STRICT_PROPS=1` to make an unknown prop or an out-of-range valu
| `ChannelSplitter` | `ChannelSplitter` | `colorSpace` |
| `ColorBalance` | `ColorBalance` | `shadows`, `midtones`, `highlights`, `preserveLuminosity` |
| `ColorKey` | `ColorKey` | `keyColor`, `similarity`, `smoothness`, `spillSuppression`, `colorSpace`, `spillSuppressionType` |
+| `Contour` | `Contour` | `levels`, `lineWidth`, `lineColor`, `fill`, `fillColor`, `smoothing` |
| `CornerPin` | `CornerPin` | `points` |
+| `CRT` | `CRT` | `scanlines`, `lineCount`, `curvature`, `mask`, `vignette`, `noise`, `flicker`, `tracking`, `chroma` |
| `Datamosh` | `Datamosh` | `keyframes`, `strength`, `bleed`, `warmup` |
| `DisplacementMap` | `DisplacementMap` | `strengthX`, `strengthY`, `xChannel`, `yChannel`, `wrapMode` |
+| `Dither` | `Dither` | `mode`, `levels`, `scale`, `monochrome`, `dark`, `light` |
| `ExtractLUT` | `ExtractLUT` | `strategy`, `samplePoints` |
| `Flip` | `Flip` | `horizontal`, `vertical`, `diagonal`, `mode`, `symmetry` |
+| `Gooey` | `Gooey` | `radius`, `threshold`, `softness` |
+| `Iridescence` | `Iridescence` | `strength`, `scale`, `shift`, `mode` |
+| `Kaleidoscope` | `Kaleidoscope` | `segments`, `rotation`, `centerX`, `centerY`, `zoom` |
| `KenBurns` | `KenBurns` | `keyframes`, `motionBlurSize`, `movementStyle`, `aspectRatio` |
| `LayerStyle` | `LayerStyle` | `dropShadow`, `innerShadow`, `outerGlow`, `innerGlow`, `stroke`, `bevelEmboss`, `colorOverlay`, `dropShadowAngleHandleId`, `dropShadowDistanceHandleId`, `dropShadowSpreadHandleId`, `dropShadowSizeHandleId`, `dropShadowOpacityHandleId`, `innerShadowAngleHandleId`, `innerShadowDistanceHandleId`, `innerShadowChokeHandleId`, `innerShadowSizeHandleId`, `innerShadowOpacityHandleId`, `outerGlowSizeHandleId`, `outerGlowSpreadHandleId`, `outerGlowOpacityHandleId`, `innerGlowSizeHandleId`, `innerGlowSpreadHandleId`, `innerGlowOpacityHandleId`, `strokeSizeHandleId`, `strokeOpacityHandleId`, `bevelEmbossDepthHandleId`, `bevelEmbossSizeHandleId`, `bevelEmbossSoftenHandleId`, `bevelEmbossAngleHandleId`, `bevelEmbossAltitudeHandleId`, `bevelEmbossHighlightOpacityHandleId`, `bevelEmbossShadowOpacityHandleId`, `colorOverlayOpacityHandleId` |
| `Liquify` | `Liquify` | `operations` |
| `MaskMath` | `MaskMath` | `operation`, `radius`, `threshold`, `clampMin`, `clampMax`, `channelA`, `channelB`, `binarize`, `invertResult`, `outputFormat` |
| `MeshWarp` | `MeshWarp` | `cols`, `rows`, `points` |
| `NoiseGenerator` | `NoiseGenerator` | `noiseType`, `outputType`, `width`, `height`, `scale`, `octaves`, `persistence`, `lacunarity`, `speed`, `colorStart`, `colorEnd`, `durationMs`, `fps` |
+| `OpArt` | `OpArt` | `pattern`, `frequency`, `angle`, `warp`, `source`, `colorA`, `colorB` |
| `Paint` | `Paint` | `width`, `height`, `maintainAspect`, `aspectRatio`, `backgroundColor`, `strokes` |
+| `Painterly` | `Painterly` | `style`, `radius`, `edgeDarkening`, `paper`, `saturation` |
| `PatchHeal` | `PatchHeal` | `patches`, `centerX`, `centerY`, `offsetX`, `offsetY`, `radius`, `sourceRadius`, `feather`, `opacity`, `mode` |
+| `Pixelate` | `Pixelate` | `size`, `shape`, `gap` |
+| `Posterize` | `Posterize` | `levels`, `palette`, `colors`, `dither`, `pixelSize` |
| `ProceduralVFX` | `ProceduralVFX` | `effectType`, `outputType`, `width`, `height`, `density`, `scale`, `speed`, `intensity`, `seed`, `colorStart`, `colorEnd`, `durationMs`, `fps` |
| `RefineEdge` | `RefineEdge` | `decontaminateAmount`, `radius`, `smooth`, `feather`, `shiftEdge`, `matteChannel`, `outputMode` |
| `RefractionCaustics3D` | `RefractionCaustics3D` | `ior`, `dispersion`, `refractionScale`, `causticBrightness`, `causticScale`, `fluidRipples`, `rippleSpeed`, `roughness`, `specularIntensity`, `lightPosX`, `lightPosY`, `tintColor`, `tintStrength`, `depthInvert`, `depthScale` |
| `ResizerScaler` | `ResizerScaler` | `aspectRatioPreset`, `resolutionPreset`, `targetWidth`, `targetHeight`, `fitMode`, `zoom`, `offsetX`, `offsetY`, `backgroundMode`, `backgroundColor`, `backgroundColor2`, `blurRadius`, `backgroundBrightness`, `anchorX`, `anchorY` |
+| `RGBSplit` | `RGBSplit` | `amount`, `angle`, `radial` |
| `Rotate` | `Rotate` | `angle`, `fit`, `scale` |
| `StereoPanning` | `StereoPanning` | `pan` |
+| `Toon` | `Toon` | `levels`, `edgeThreshold`, `edgeWidth`, `edgeColor`, `saturation` |
| `Trails` | `Trails` | `decay`, `mode`, `zoom`, `rotation`, `offsetX`, `offsetY`, `hueShift`, `warmup` |
| `Vignette` | `Vignette` | `strength`, `radius`, `softness`, `roundness`, `centerX`, `centerY` |
| `Levels` | `Levels` | `master`, `red`, `green`, `blue` |
@@ -78,6 +91,23 @@ Set `FRAMEFIELDS_STRICT_PROPS=1` to make an unknown prop or an out-of-range valu
## Prop defaults
+### Ascii
+
+```ts
+import { Ascii } from "framefields/effects";
+
+new Ascii({ cellSize: 10, colorMode: "mono", fg: "#e8e8e8" });
+```
+
+| Prop | Type | Default | Notes |
+| --- | --- | --- | --- |
+| `cellSize` | `EffectProp<number>` | `10` | Range 4 to 64. Character cell size, px. |
+| `colorMode` | `"mono" \| "source" \| "green"` | `"mono"` | Glyph color: `fg`, the layer's own colors, or green phosphor. |
+| `fg` | `string` | `"#e8e8e8"` | Glyph color (mono). |
+| `bg` | `string` | `"#0b0b0b"` | Background color. |
+| `contrast` | `EffectProp<number>` | `1.2` | Range 0.5 to 3. Brightness contrast before picking glyphs. |
+| `invert` | `boolean` | `false` | Dark areas get dense glyphs. |
+
### AudioCompressor
```ts
@@ -273,6 +303,23 @@ new ColorKey({ keyColor: "#00ff00", similarity: 0.4, smoothness: 0.1 });
| `colorSpace` | `"YUV" \| "RGB"` | `"YUV"` | Color space used to calculate similarity distance. |
| `spillSuppressionType` | `"Desaturate" \| "Neutralize" \| "None"` | `"Desaturate"` | How key color spill is suppressed on foreground edges. |
+### Contour
+
+```ts
+import { Contour } from "framefields/effects";
+
+new Contour({ levels: 14, lineWidth: 1.2, lineColor: "#2b1d0e" });
+```
+
+| Prop | Type | Default | Notes |
+| --- | --- | --- | --- |
+| `levels` | `EffectProp<number>` | `14` | Range 2 to 64. Contour lines from dark to light. |
+| `lineWidth` | `EffectProp<number>` | `1.2` | Range 0.5 to 8. Line width, px. |
+| `lineColor` | `string` | `"#2b1d0e"` | Line color. |
+| `fill` | `"source" \| "flat" \| "none"` | `"source"` | Under the lines: the layer, `fillColor`, or transparent. |
+| `fillColor` | `string` | `"#f3ead8"` | Paper color (flat fill). |
+| `smoothing` | `EffectProp<number>` | `2` | Range 0 to 8. Blur before tracing, px (smoother lines). |
+
### CornerPin
```ts
@@ -285,6 +332,26 @@ new CornerPin({ /* props */ });
| --- | --- | --- |
| `points` | `CornerPinPointsItem[]` | — |
+### CRT
+
+```ts
+import { CRT } from "framefields/effects";
+
+new CRT({ scanlines: 0.45, lineCount: 540, curvature: 0.12 });
+```
+
+| Prop | Type | Default | Notes |
+| --- | --- | --- | --- |
+| `scanlines` | `EffectProp<number>` | `0.45` | Range 0 to 1. Scanline darkness. |
+| `lineCount` | `EffectProp<number>` | `540` | Range 100 to 2160. Scanlines over the height. |
+| `curvature` | `EffectProp<number>` | `0.12` | Range 0 to 1. Barrel distortion of the tube. |
+| `mask` | `EffectProp<number>` | `0.25` | Range 0 to 1. RGB aperture-grille strength. |
+| `vignette` | `EffectProp<number>` | `0.35` | Range 0 to 1. Darkening toward the edges. |
+| `noise` | `EffectProp<number>` | `0.08` | Range 0 to 1. Animated static. |
+| `flicker` | `EffectProp<number>` | `0.03` | Range 0 to 1. Brightness flicker. |
+| `tracking` | `EffectProp<number>` | `0` | Range 0 to 1. VHS tracking error: line jitter and a rolling band. |
+| `chroma` | `EffectProp<number>` | `0` | Range 0 to 20. VHS color bleed, px. |
+
### Datamosh
```ts
@@ -316,6 +383,23 @@ new DisplacementMap({ strengthX: 50, strengthY: 50, xChannel: "Red" });
| `yChannel` | `"Red" \| "Green" \| "Blue" \| "Alpha" \| "Luminance"` | `"Green"` | Y Channel |
| `wrapMode` | `"Clamp" \| "Repeat" \| "Mirror"` | `"Clamp"` | Wrap Mode |
+### Dither
+
+```ts
+import { Dither } from "framefields/effects";
+
+new Dither({ mode: "bayer", levels: 2, scale: 2 });
+```
+
+| Prop | Type | Default | Notes |
+| --- | --- | --- | --- |
+| `mode` | `"bayer" \| "noise" \| "halftone"` | `"bayer"` | Pattern: Bayer matrix, blue-ish noise or round halftone dots. |
+| `levels` | `EffectProp<number>` | `2` | Range 2 to 16. Levels per channel (2 = 1-bit). |
+| `scale` | `EffectProp<number>` | `2` | Range 1 to 16. Dither pixel size, px. |
+| `monochrome` | `boolean` | `true` | Map brightness to the dark → light colors instead of dithering each channel. |
+| `dark` | `string` | `"#111111"` | Dark color (monochrome). |
+| `light` | `string` | `"#f2efe6"` | Light color (monochrome). |
+
### ExtractLUT
```ts
@@ -345,6 +429,51 @@ new Flip({ horizontal: true, vertical: false, diagonal: false });
| `mode` | `"horizontal" \| "vertical" \| "both" \| "diagonal" \| "antiDiagonal" \| "custom"` | `"horizontal"` | Quick preset mode for flipping or transposition. |
| `symmetry` | `"none" \| "leftToRight" \| "rightToLeft" \| "topToBottom" \| "bottomToTop" \| "quadrant"` | `"none"` | Split-mirror reflection and symmetry effects. |
+### Gooey
+
+```ts
+import { Gooey } from "framefields/effects";
+
+new Gooey({ radius: 12, threshold: 0.5, softness: 0.04 });
+```
+
+| Prop | Type | Default | Notes |
+| --- | --- | --- | --- |
+| `radius` | `EffectProp<number>` | `12` | Range 1 to 60. Melt distance, px. |
+| `threshold` | `EffectProp<number>` | `0.5` | Range 0 to 1. Alpha cut, 0–1 (higher = thinner blobs). |
+| `softness` | `EffectProp<number>` | `0.04` | Range 0.001 to 0.5. Edge softness. |
+
+### Iridescence
+
+```ts
+import { Iridescence } from "framefields/effects";
+
+new Iridescence({ strength: 0.6, scale: 2, shift: 0 });
+```
+
+| Prop | Type | Default | Notes |
+| --- | --- | --- | --- |
+| `strength` | `EffectProp<number>` | `0.6` | Range 0 to 1. How much rainbow, 0–1. |
+| `scale` | `EffectProp<number>` | `2` | Range 0.1 to 10. Rainbow bands over the range. |
+| `shift` | `EffectProp<number>` | `0` | Range -3600 to 3600. Hue shift, degrees (animate it). |
+| `mode` | `"luminance" \| "relief"` | `"relief"` | Bands from brightness, or from the slope of the image (foil). |
+
+### Kaleidoscope
+
+```ts
+import { Kaleidoscope } from "framefields/effects";
+
+new Kaleidoscope({ segments: 6, rotation: 0, centerX: 0.5 });
+```
+
+| Prop | Type | Default | Notes |
+| --- | --- | --- | --- |
+| `segments` | `EffectProp<number>` | `6` | Range 2 to 32. Mirror segments. |
+| `rotation` | `EffectProp<number>` | `0` | Range -3600 to 3600. Pattern rotation, degrees. |
+| `centerX` | `EffectProp<number>` | `0.5` | Range 0 to 1. Center, 0–1 across. |
+| `centerY` | `EffectProp<number>` | `0.5` | Range 0 to 1. Center, 0–1 down. |
+| `zoom` | `EffectProp<number>` | `1` | Range 0.2 to 4. Scale of the folded image. |
+
### KenBurns
```ts
@@ -475,6 +604,24 @@ new NoiseGenerator({ noiseType: "Perlin", outputType: "Image", width: 512 });
| `durationMs` | `number` | `5000` | Range 1 to 60000. Duration (ms) |
| `fps` | `number` | `30` | Range 1 to 120. FPS |
+### OpArt
+
+```ts
+import { OpArt } from "framefields/effects";
+
+new OpArt({ pattern: "stripes", frequency: 48, angle: 0 });
+```
+
+| Prop | Type | Default | Notes |
+| --- | --- | --- | --- |
+| `pattern` | `"stripes" \| "rings" \| "checker" \| "waves"` | `"stripes"` | Line pattern. |
+| `frequency` | `EffectProp<number>` | `48` | Range 2 to 300. Lines across the height. |
+| `angle` | `EffectProp<number>` | `0` | Range -360 to 360. Pattern angle, degrees. |
+| `warp` | `EffectProp<number>` | `0.6` | Range 0 to 3. How far brightness bends the lines. |
+| `source` | `EffectProp<number>` | `1` | Range 0 to 1. How much darks thicken the lines (0 = even lines). |
+| `colorA` | `string` | `"#0a0a0a"` | Line color. |
+| `colorB` | `string` | `"#f5f5f5"` | Gap color. |
+
### Paint
```ts
@@ -492,6 +639,22 @@ new Paint({ width: 1080, height: 1080, maintainAspect: true });
| `backgroundColor` | `string` | `"#ffffff"` | |
| `strokes` | `(PaintStrokesItemOption1 \| PaintStrokesItemOption2 \| PaintStrokesItemOption3)[]` | — | |
+### Painterly
+
+```ts
+import { Painterly } from "framefields/effects";
+
+new Painterly({ style: "oil", radius: 5, edgeDarkening: 0.5 });
+```
+
+| Prop | Type | Default | Notes |
+| --- | --- | --- | --- |
+| `style` | `"oil" \| "watercolor"` | `"oil"` | Oil (dense strokes) or watercolor (wet edges, paper). |
+| `radius` | `EffectProp<number>` | `5` | Range 2 to 12. Brush size, px. |
+| `edgeDarkening` | `EffectProp<number>` | `0.5` | Range 0 to 1. Watercolor: pigment pooling at patch edges. |
+| `paper` | `EffectProp<number>` | `0.3` | Range 0 to 1. Paper / canvas grain. |
+| `saturation` | `EffectProp<number>` | `1.05` | Range 0 to 2. Color saturation. |
+
### PatchHeal
```ts
@@ -513,6 +676,36 @@ new PatchHeal({ centerX: 0.5, centerY: 0.5, offsetX: 50 });
| `opacity` | `EffectProp<number>` | `1` | Range 0 to 1. Blending opacity of the healed patch (0.0–1.0). |
| `mode` | `"Clone" \| "SeamlessHeal" \| "TextureTransfer"` | `"SeamlessHeal"` | Healing algorithm: Clone (direct stamp), SeamlessHeal (Poisson color/lighting blend), TextureTransfer (luminance structure matching). |
+### Pixelate
+
+```ts
+import { Pixelate } from "framefields/effects";
+
+new Pixelate({ size: 12, shape: "square", gap: 0 });
+```
+
+| Prop | Type | Default | Notes |
+| --- | --- | --- | --- |
+| `size` | `EffectProp<number>` | `12` | Range 1 to 256. Cell size, px. |
+| `shape` | `"square" \| "circle" \| "diamond"` | `"square"` | Cell shape: square pixels, round LEDs or diamonds. |
+| `gap` | `EffectProp<number>` | `0` | Range 0 to 0.9. Space between cells, as a fraction of a cell (0 = touching). |
+
+### Posterize
+
+```ts
+import { Posterize } from "framefields/effects";
+
+new Posterize({ levels: 6, palette: "none", dither: 0 });
+```
+
+| Prop | Type | Default | Notes |
+| --- | --- | --- | --- |
+| `levels` | `EffectProp<number>` | `6` | Range 2 to 64. Steps per channel when no palette is set. |
+| `palette` | `"none" \| "gameboy" \| "teletext" \| "cga" \| "pico8" \| "c64" \| "grayscale" \| "sepia" \| "custom"` | `"none"` | Snap to a retro palette, or `custom` to use `colors`. |
+| `colors` | `string[]` | `[]` | Your palette (up to 16 hex colors), used when `palette` is `custom`. |
+| `dither` | `EffectProp<number>` | `0` | Range 0 to 1. Ordered (Bayer) dithering between steps, 0–1. |
+| `pixelSize` | `EffectProp<number>` | `1` | Range 1 to 64. Pixel size, px: above 1 for pixel art. |
+
### ProceduralVFX
```ts
@@ -523,7 +716,7 @@ new ProceduralVFX({ effectType: "Smoke", outputType: "Video", width: 1080 });
| Prop | Type | Default | Notes |
| --- | --- | --- | --- |
-| `effectType` | `"Smoke" \| "Fire" \| "Rain" \| "Sparks" \| "Snow" \| "Dust" \| "Lightning" \| "Magic" \| "LensFlare" \| "Embers" \| "EnergyBeam"` | `"Smoke"` | Which procedural particle / light effect to synthesize. |
+| `effectType` | `"Smoke" \| "Fire" \| "Rain" \| "Sparks" \| "Snow" \| "Dust" \| "Lightning" \| "Magic" \| "LensFlare" \| "Embers" \| "EnergyBeam" \| "Aurora"` | `"Smoke"` | Which procedural particle / light effect to synthesize. |
| `outputType` | `"Image" \| "Video"` | `"Video"` | Image renders a static frame; Video animates over time. |
| `width` | `number` | `1080` | Range 16 to 4096. Width |
| `height` | `number` | `1080` | Range 16 to 4096. Height |
@@ -607,6 +800,20 @@ new ResizerScaler({ aspectRatioPreset: "16:9", resolutionPreset: "1080p", target
| `anchorX` | `"left" \| "center" \| "right"` | `"center"` | |
| `anchorY` | `"top" \| "center" \| "bottom"` | `"center"` | |
+### RGBSplit
+
+```ts
+import { RGBSplit } from "framefields/effects";
+
+new RGBSplit({ amount: 8, angle: 0, radial: false });
+```
+
+| Prop | Type | Default | Notes |
+| --- | --- | --- | --- |
+| `amount` | `EffectProp<number>` | `8` | Range 0 to 200. Split distance, px. |
+| `angle` | `EffectProp<number>` | `0` | Range -360 to 360. Split direction, degrees (linear mode). |
+| `radial` | `boolean` | `false` | Split outward from the center instead of along `angle`. |
+
### Rotate
```ts
@@ -633,6 +840,22 @@ new StereoPanning({ pan: 0 });
| --- | --- | --- | --- |
| `pan` | `EffectProp<number>` | `0` | Range -1 to 1. Stereo panning value: -1 (full left) to 1 (full right), 0 is center. Can be modulated by a static number or dynamic signal. |
+### Toon
+
+```ts
+import { Toon } from "framefields/effects";
+
+new Toon({ levels: 4, edgeThreshold: 0.2, edgeWidth: 1 });
+```
+
+| Prop | Type | Default | Notes |
+| --- | --- | --- | --- |
+| `levels` | `EffectProp<number>` | `4` | Range 2 to 12. Brightness bands. |
+| `edgeThreshold` | `EffectProp<number>` | `0.2` | Range 0 to 1. How strong an edge must be to get ink, 0–1. |
+| `edgeWidth` | `EffectProp<number>` | `1` | Range 0.5 to 4. Ink line width, px. |
+| `edgeColor` | `string` | `"#111111"` | Ink color. |
+| `saturation` | `EffectProp<number>` | `1.15` | Range 0 to 2. Color saturation after banding. |
+
### Trails
```ts
@@ -1061,4 +1284,4 @@ new Modulate({ hue: 0, brightness: 1.0, contrast: 1.0 });
Beyond these classes, the engine ships node plugins under `nodes/` (audio DSP, generators,
signal maths, vision). Each is a package named `@framefields/node-<name>`:
-`node-apply-lut`, `node-audio-compressor`, `node-audio-delay`, `node-audio-fade`, `node-audio-noise-gate`, `node-audio-parametric-eq`, `node-audio-reverb`, `node-audio-signal-extractor`, `node-blur`, `node-camera-parallax-3d`, `node-canvas-generator`, `node-caption-editor`, `node-caption-generator`, `node-channel-merger`, `node-channel-splitter`, `node-color-balance`, `node-colorkey`, `node-compositor`, `node-corner-pin`, `node-crop`, `node-curves`, `node-datamosh`, `node-deflicker`, `node-displacement-map`, `node-extract-frame`, `node-extract-lut`, `node-film-grain`, `node-flip`, `node-gradient-map`, `node-halftone-screen`, `node-high-pass`, `node-kenburns`, `node-layer-style`, `node-levels`, `node-liquify`, `node-mask-math`, `node-mesh-warp`, `node-modulate`, `node-noise-generator`, `node-paint`, `node-particles`, `node-patch-heal`, `node-procedural-vfx`, `node-refine-edge`, `node-refraction-caustics`, `node-relight-3d`, `node-resizer-scaler`, `node-rotate`, `node-selective-color`, `node-shadows-highlights`, `node-shape-generator`, `node-signal-gate`, `node-signal-math`, `node-signal`, `node-stereo-panning`, `node-text`, `node-tile-offset`, `node-trails`, `node-unsharp-mask`, `node-vignette`, `node-vision`
+`node-apply-lut`, `node-ascii`, `node-audio-compressor`, `node-audio-delay`, `node-audio-fade`, `node-audio-noise-gate`, `node-audio-parametric-eq`, `node-audio-reverb`, `node-audio-signal-extractor`, `node-blur`, `node-camera-parallax-3d`, `node-canvas-generator`, `node-caption-editor`, `node-caption-generator`, `node-channel-merger`, `node-channel-splitter`, `node-color-balance`, `node-colorkey`, `node-compositor`, `node-contour`, `node-corner-pin`, `node-crop`, `node-crt`, `node-curves`, `node-datamosh`, `node-deflicker`, `node-displacement-map`, `node-dither`, `node-extract-frame`, `node-extract-lut`, `node-film-grain`, `node-flip`, `node-gooey`, `node-gradient-map`, `node-halftone-screen`, `node-high-pass`, `node-iridescence`, `node-kaleidoscope`, `node-kenburns`, `node-layer-style`, `node-levels`, `node-liquify`, `node-mask-math`, `node-mesh-warp`, `node-modulate`, `node-noise-generator`, `node-op-art`, `node-paint`, `node-painterly`, `node-particles`, `node-patch-heal`, `node-pixelate`, `node-posterize`, `node-procedural-vfx`, `node-refine-edge`, `node-refraction-caustics`, `node-relight-3d`, `node-resizer-scaler`, `node-rgb-split`, `node-rotate`, `node-selective-color`, `node-shadows-highlights`, `node-shape-generator`, `node-signal-gate`, `node-signal-math`, `node-signal`, `node-stereo-panning`, `node-text`, `node-tile-offset`, `node-toon`, `node-trails`, `node-unsharp-mask`, `node-vignette`, `node-vision`
diff --git a/plugins/framefields/skills/framefields-effects/references/style-guide.md b/plugins/framefields/skills/framefields-effects/references/style-guide.md
new file mode 100644
index 00000000..6ce313c8
--- /dev/null
+++ b/plugins/framefields/skills/framefields-effects/references/style-guide.md
@@ -0,0 +1,67 @@
+# Style guide: which look for which request
+
+Use this guide to turn what someone asks for ("make it look like a VHS tape", "8-bit", "liquid logo") into the framefields features that produce it. Start from a `Styles.*` preset when one fits, then tune it or add layers. Every preset returns an effect stack: `layer.withEffects(Styles.vhs())`. Effects attach to media layers (video, image, SVG, particles, VFX). To stylize a whole scene, apply the effects to the composition's master pass (see SKILL.md "Whole-Composition Master Emulsion").
+
+## Visual styles
+
+| They ask for… | Use | Notes |
+|---|---|---|
+| 8-bit, pixel art, retro game | `Styles.pixelArt()` | `palette: "c64" \| "cga"`; add `LayerAnimation.stepped(2)` on sprites. |
+| Game Boy | `Styles.gameBoy()` | Four greens. |
+| Teletext, Ceefax, blocky TV text | `Styles.teletext()` | Pair with a monospace font in a grid layout. |
+| LED wall, stadium screen, dot matrix | `Styles.ledWall()` | `Pixelate` `shape: "circle"`. |
+| 1-bit, Mac Paint, dithered, Obra Dinn | `Styles.oneBit()` | `Dither` `mode: "bayer" \| "noise" \| "halftone"`. |
+| ASCII, text art, terminal, hacker, Matrix | `Styles.ascii({ matrix: true })` | `colorMode: "source"` keeps the clip's colors. |
+| Risograph, zine, print, duotone | `Styles.risograph({ inkA, inkB })` | Two inks plus paper. |
+| Comic book, pop art | `Styles.comic()` | `Toon` + `HalftoneScreen`; add speech bubbles as boxes. |
+| Cartoon, cel-shaded, anime outline | `Styles.cartoon()` | `Toon`. |
+| VHS, camcorder, 90s home video | `Styles.vhs()` | Add a timestamp text layer and `FilmGrain`. |
+| CRT, old monitor, arcade screen | `Styles.crt()` | |
+| Glitch, corrupted, error | `Styles.glitch()` + `Datamosh` | Drive `RGBSplit.amount` from audio or keyframes for hits. |
+| Datamosh, pixel bleed | `Datamosh({ keyframes })` | Clean picture on the keyframes, smears between. |
+| Oil painting | `Styles.oilPainting()` | |
+| Watercolor, painted | `Styles.watercolor()` | Add a paper-texture image with `blendMode: "multiply"`. |
+| Topographic, contour map | `Styles.topographic()` | `Contour` `fill: "source"` keeps the footage under the lines. |
+| Kaleidoscope, psychedelic, trippy | `Styles.kaleidoscope()` | Animate `rotation`; add `Modulate` hue cycling and `Trails`. |
+| Op art, line portrait, Bridget Riley | `Styles.opArt()` | `pattern: "rings" \| "checker" \| "waves"`. |
+| Holographic, foil, iridescent, chrome sheen | `Styles.holographic()` | Animate `shift`; on 3D text use `material: "glass"` or a metallic PBR material. |
+| Thermal, heat vision, predator | `Styles.thermal()` | |
+| Film noir, black and white | `Styles.noir()` | |
+| Film, analog, cinematic | `Styles.film()` | Add `ApplyLUT`, `Curves`, `DepthOfField` as needed. |
+| Neon, glow, synthwave | `LayerStyle` outer glow + `blendMode: "screen"` | Dark background, saturated pinks and cyans, bloom on 3D. |
+| Y2K chrome, metallic 3D type | `Layer3D.extrudedText` metallic + `Layer.environment` | |
+| Glass, glassmorphism, frosted | `Layer3D` `material: "glass"` (refracts what is behind it) | 2D: `PBRGlass`. |
+| Clay, plasticine, claymation | `Layer3D` rough materials + soft lighting + `LayerAnimation.stepped(2)` | Stepped timing gives the stop-motion feel. |
+| Paper cut-out, origami, papercraft | Shapes with drop shadows + `stepped(2)` + paper texture (`multiply`) | |
+| Hand-drawn, doodle, line boil | Stroke `trimEnd` draw-on + `wiggle` on `d`/position + `stepped(2)` | |
+| Isometric | `perspective: 0` + `rotateX`/`rotateZ` | |
+| Blueprint, technical drawing | Grid boxes + stroke draw-on (`trimEnd`) on a blue background | |
+| Aurora, northern lights | `Layer.vfx({ effectType: "Aurora" })` | `colorStart` (base) and `colorEnd` (top). |
+| Smoke, fire, rain, snow, dust, sparks, embers, magic, lightning, lens flare | `Layer.vfx({ effectType })` for a backdrop, `Layer.particles` when particles must react to something | |
+| Particles, flow field, swarm | `Layer.particles` with `noise`, `attractors` | |
+| Light painting, light trails | `Layer.particles` `blend: "add"` following a tracked wrist, or `Trails` on bright footage | |
+| Dancer moving through particles | `Layer.particles({ push: { person } })` + a vision cutout above | |
+| Liquid, blob, metaballs, morphing logo | Animate a shape's `d` (morph) and/or `Gooey` on an SVG or particle layer | |
+| Collage, sticker, cut-out people | `withVision({ mode: "matte" })` cutouts with stroke and shadow (`LayerStyle`) | |
+| Text behind subject | Subject sandwich (SKILL.md) | |
+| Bauhaus, Memphis, Art deco, neo-brutalism, Web 1.0, retro desktop, skeuomorphic, neumorphism, Word Art | Layout, shapes, gradients, `LayerStyle` (bevel, inner/drop shadow), fonts | Composition work, not effects. |
+
+## Motion templates
+
+| They ask for… | Use |
+|---|---|
+| Things falling, dropping, piling up, gravity, bouncing | `Physics.world2d` / `world3d` bodies; a ground and walls |
+| Objects hitting a person / dancer | `comp.vision(clip)`, then kinematic limb colliders following `person.point(...)` |
+| Jiggle, wobble, jelly | `spring` eases, `wiggle` tracks, or physics joints |
+| Kinetic typography, hook text | `TextAnimator`, keyframes with `back` / `expo` eases |
+| Stop-motion feel, "on twos" | `LayerAnimation.stepped(2)` |
+| Reveal, wipe, text through a shape | `withMatte` |
+| Scene changes | Transitions (compose SKILL.md "Scenes & Transitions") |
+| Beat-synced cuts and pulses | Audio signals driving props or effect strengths |
+| UI mockups (prompt bar, NLE timeline, comment drop, notifications) | Boxes, text, `flex` layout, `spring` keyframes |
+
+## Combining
+
+- One stylize look per layer is usually enough. Stacking more than two strong looks (e.g. ASCII then CRT) works, but keep the strongest one last.
+- Stylize the footage and keep text and UI clean on top. Readable text sells the video.
+- Pair a look with matching motion: pixel art and paper styles use `stepped(2)`; VHS and glitch work with hard cuts; watercolor and aurora suit slow eases.
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 28e73282..0b4aeb12 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -463,6 +463,31 @@ importers:
specifier: ^0.4.0
version: 0.4.0
+ nodes/node-ascii:
+ dependencies:
+ '@framefields/node-sdk':
+ specifier: workspace:*
+ version: link:../../packages/node-sdk
+ zod:
+ specifier: ^4.3.6
+ version: 4.3.6
+ devDependencies:
+ '@framefields/tsconfig':
+ specifier: workspace:*
+ version: link:../../packages/tsconfig
+ '@types/node':
+ specifier: ^24.1.0
+ version: 24.10.14
+ tsdown:
+ specifier: ^0.19.0
+ typescript:
+ specifier: ^5.8.3
+ version: 5.9.3
+ webgpu:
+ specifier: ^0.4.0
+ version: 0.4.0
+
nodes/node-audio-compressor:
dependencies:
'@framefields/core':
@@ -993,6 +1018,31 @@ importers:
specifier: ^0.4.0
version: 0.4.0
+ nodes/node-contour:
+ dependencies:
+ '@framefields/node-sdk':
+ specifier: workspace:*
+ version: link:../../packages/node-sdk
+ zod:
+ specifier: ^4.3.6
+ version: 4.3.6
+ devDependencies:
+ '@framefields/tsconfig':
+ specifier: workspace:*
+ version: link:../../packages/tsconfig
+ '@types/node':
+ specifier: ^24.1.0
+ version: 24.10.14
+ tsdown:
+ specifier: ^0.19.0
+ typescript:
+ specifier: ^5.8.3
+ version: 5.9.3
+ webgpu:
+ specifier: ^0.4.0
+ version: 0.4.0
+
nodes/node-corner-pin:
dependencies:
'@framefields/core':
@@ -1043,6 +1093,31 @@ importers:
specifier: ^5.8.3
version: 5.8.3
+ nodes/node-crt:
+ dependencies:
+ '@framefields/node-sdk':
+ specifier: workspace:*
+ version: link:../../packages/node-sdk
+ zod:
+ specifier: ^4.3.6
+ version: 4.3.6
+ devDependencies:
+ '@framefields/tsconfig':
+ specifier: workspace:*
+ version: link:../../packages/tsconfig
+ '@types/node':
+ specifier: ^24.1.0
+ version: 24.10.14
+ tsdown:
+ specifier: ^0.19.0
+ typescript:
+ specifier: ^5.8.3
+ version: 5.9.3
+ webgpu:
+ specifier: ^0.4.0
+ version: 0.4.0
+
nodes/node-curves:
dependencies:
'@framefields/core':
@@ -1161,6 +1236,31 @@ importers:
specifier: ^0.4.0
version: 0.4.0
+ nodes/node-dither:
+ dependencies:
+ '@framefields/node-sdk':
+ specifier: workspace:*
+ version: link:../../packages/node-sdk
+ zod:
+ specifier: ^4.3.6
+ version: 4.3.6
+ devDependencies:
+ '@framefields/tsconfig':
+ specifier: workspace:*
+ version: link:../../packages/tsconfig
+ '@types/node':
+ specifier: ^24.1.0
+ version: 24.10.14
+ tsdown:
+ specifier: ^0.19.0
+ typescript:
+ specifier: ^5.8.3
+ version: 5.9.3
+ webgpu:
+ specifier: ^0.4.0
+ version: 0.4.0
+
nodes/node-extract-frame:
dependencies:
'@framefields/core':
@@ -1276,6 +1376,31 @@ importers:
specifier: ^0.4.0
version: 0.4.0
+ nodes/node-gooey:
+ dependencies:
+ '@framefields/node-sdk':
+ specifier: workspace:*
+ version: link:../../packages/node-sdk
+ zod:
+ specifier: ^4.3.6
+ version: 4.3.6
+ devDependencies:
+ '@framefields/tsconfig':
+ specifier: workspace:*
+ version: link:../../packages/tsconfig
+ '@types/node':
+ specifier: ^24.1.0
+ version: 24.10.14
+ tsdown:
+ specifier: ^0.19.0
+ typescript:
+ specifier: ^5.8.3
+ version: 5.9.3
+ webgpu:
+ specifier: ^0.4.0
+ version: 0.4.0
+
nodes/node-gradient-map:
dependencies:
'@framefields/core':
@@ -1372,6 +1497,56 @@ importers:
specifier: ^0.4.0
version: 0.4.0
+ nodes/node-iridescence:
+ dependencies:
+ '@framefields/node-sdk':
+ specifier: workspace:*
+ version: link:../../packages/node-sdk
+ zod:
+ specifier: ^4.3.6
+ version: 4.3.6
+ devDependencies:
+ '@framefields/tsconfig':
+ specifier: workspace:*
+ version: link:../../packages/tsconfig
+ '@types/node':
+ specifier: ^24.1.0
+ version: 24.10.14
+ tsdown:
+ specifier: ^0.19.0
+ typescript:
+ specifier: ^5.8.3
+ version: 5.9.3
+ webgpu:
+ specifier: ^0.4.0
+ version: 0.4.0
+
+ nodes/node-kaleidoscope:
+ dependencies:
+ '@framefields/node-sdk':
+ specifier: workspace:*
+ version: link:../../packages/node-sdk
+ zod:
+ specifier: ^4.3.6
+ version: 4.3.6
+ devDependencies:
+ '@framefields/tsconfig':
+ specifier: workspace:*
+ version: link:../../packages/tsconfig
+ '@types/node':
+ specifier: ^24.1.0
+ version: 24.10.14
+ tsdown:
+ specifier: ^0.19.0
+ typescript:
+ specifier: ^5.8.3
+ version: 5.9.3
+ webgpu:
+ specifier: ^0.4.0
+ version: 0.4.0
+
nodes/node-kenburns:
dependencies:
'@framefields/core':
@@ -1602,6 +1777,31 @@ importers:
specifier: ^0.4.0
version: 0.4.0
+ nodes/node-op-art:
+ dependencies:
+ '@framefields/node-sdk':
+ specifier: workspace:*
+ version: link:../../packages/node-sdk
+ zod:
+ specifier: ^4.3.6
+ version: 4.3.6
+ devDependencies:
+ '@framefields/tsconfig':
+ specifier: workspace:*
+ version: link:../../packages/tsconfig
+ '@types/node':
+ specifier: ^24.1.0
+ version: 24.10.14
+ tsdown:
+ specifier: ^0.19.0
+ typescript:
+ specifier: ^5.8.3
+ version: 5.9.3
+ webgpu:
+ specifier: ^0.4.0
+ version: 0.4.0
+
nodes/node-paint:
dependencies:
'@framefields/core':
@@ -1630,6 +1830,31 @@ importers:
specifier: ^5.8.3
version: 5.8.3
+ nodes/node-painterly:
+ dependencies:
+ '@framefields/node-sdk':
+ specifier: workspace:*
+ version: link:../../packages/node-sdk
+ zod:
+ specifier: ^4.3.6
+ version: 4.3.6
+ devDependencies:
+ '@framefields/tsconfig':
+ specifier: workspace:*
+ version: link:../../packages/tsconfig
+ '@types/node':
+ specifier: ^24.1.0
+ version: 24.10.14
+ tsdown:
+ specifier: ^0.19.0
+ typescript:
+ specifier: ^5.8.3
+ version: 5.9.3
+ webgpu:
+ specifier: ^0.4.0
+ version: 0.4.0
+
nodes/node-particles:
dependencies:
'@framefields/node-sdk':
@@ -1683,6 +1908,56 @@ importers:
specifier: ^0.4.0
version: 0.4.0
+ nodes/node-pixelate:
+ dependencies:
+ '@framefields/node-sdk':
+ specifier: workspace:*
+ version: link:../../packages/node-sdk
+ zod:
+ specifier: ^4.3.6
+ version: 4.3.6
+ devDependencies:
+ '@framefields/tsconfig':
+ specifier: workspace:*
+ version: link:../../packages/tsconfig
+ '@types/node':
+ specifier: ^24.1.0
+ version: 24.10.14
+ tsdown:
+ specifier: ^0.19.0
+ typescript:
+ specifier: ^5.8.3
+ version: 5.9.3
+ webgpu:
+ specifier: ^0.4.0
+ version: 0.4.0
+
+ nodes/node-posterize:
+ dependencies:
+ '@framefields/node-sdk':
+ specifier: workspace:*
+ version: link:../../packages/node-sdk
+ zod:
+ specifier: ^4.3.6
+ version: 4.3.6
+ devDependencies:
+ '@framefields/tsconfig':
+ specifier: workspace:*
+ version: link:../../packages/tsconfig
+ '@types/node':
+ specifier: ^24.1.0
+ version: 24.10.14
+ tsdown:
+ specifier: ^0.19.0
+ typescript:
+ specifier: ^5.8.3
+ version: 5.9.3
+ webgpu:
+ specifier: ^0.4.0
+ version: 0.4.0
+
nodes/node-procedural-vfx:
dependencies:
'@framefields/core':
@@ -1838,6 +2113,31 @@ importers:
specifier: ^0.4.0
version: 0.4.0
+ nodes/node-rgb-split:
+ dependencies:
+ '@framefields/node-sdk':
+ specifier: workspace:*
+ version: link:../../packages/node-sdk
+ zod:
+ specifier: ^4.3.6
+ version: 4.3.6
+ devDependencies:
+ '@framefields/tsconfig':
+ specifier: workspace:*
+ version: link:../../packages/tsconfig
+ '@types/node':
+ specifier: ^24.1.0
+ version: 24.10.14
+ tsdown:
+ specifier: ^0.19.0
+ typescript:
+ specifier: ^5.8.3
+ version: 5.9.3
+ webgpu:
+ specifier: ^0.4.0
+ version: 0.4.0
+
nodes/node-rotate:
dependencies:
'@framefields/core':
@@ -2136,6 +2436,31 @@ importers:
specifier: ^0.4.0
version: 0.4.0
+ nodes/node-toon:
+ dependencies:
+ '@framefields/node-sdk':
+ specifier: workspace:*
+ version: link:../../packages/node-sdk
+ zod:
+ specifier: ^4.3.6
+ version: 4.3.6
+ devDependencies:
+ '@framefields/tsconfig':
+ specifier: workspace:*
+ version: link:../../packages/tsconfig
+ '@types/node':
+ specifier: ^24.1.0
+ version: 24.10.14
+ tsdown:
+ specifier: ^0.19.0
+ typescript:
+ specifier: ^5.8.3
+ version: 5.9.3
+ webgpu:
+ specifier: ^0.4.0
+ version: 0.4.0
+
nodes/node-trails:
dependencies:
'@framefields/node-sdk':
@@ -2664,6 +2989,9 @@ importers:
'@framefields/core':
specifier: workspace:*
version: link:../core
+ '@framefields/node-ascii':
+ specifier: workspace:*
+ version: link:../../nodes/node-ascii
'@framefields/node-audio-compressor':
specifier: workspace:*
version: link:../../nodes/node-audio-compressor
@@ -2709,12 +3037,18 @@ importers:
'@framefields/node-compositor':
specifier: workspace:*
version: link:../../nodes/node-compositor
+ '@framefields/node-contour':
+ specifier: workspace:*
+ version: link:../../nodes/node-contour
'@framefields/node-corner-pin':
specifier: workspace:*
version: link:../../nodes/node-corner-pin
'@framefields/node-crop':
specifier: workspace:*
version: link:../../nodes/node-crop
+ '@framefields/node-crt':
+ specifier: workspace:*
+ version: link:../../nodes/node-crt
'@framefields/node-curves':
specifier: workspace:*
version: link:../../nodes/node-curves
@@ -2727,6 +3061,9 @@ importers:
'@framefields/node-displacement-map':
specifier: workspace:*
version: link:../../nodes/node-displacement-map
+ '@framefields/node-dither':
+ specifier: workspace:*
+ version: link:../../nodes/node-dither
'@framefields/node-extract-frame':
specifier: workspace:*
version: link:../../nodes/node-extract-frame
@@ -2739,6 +3076,9 @@ importers:
'@framefields/node-flip':
specifier: workspace:*
version: link:../../nodes/node-flip
+ '@framefields/node-gooey':
+ specifier: workspace:*
+ version: link:../../nodes/node-gooey
'@framefields/node-gradient-map':
specifier: workspace:*
version: link:../../nodes/node-gradient-map
@@ -2748,6 +3088,12 @@ importers:
'@framefields/node-high-pass':
specifier: workspace:*
version: link:../../nodes/node-high-pass
+ '@framefields/node-iridescence':
+ specifier: workspace:*
+ version: link:../../nodes/node-iridescence
+ '@framefields/node-kaleidoscope':
+ specifier: workspace:*
+ version: link:../../nodes/node-kaleidoscope
'@framefields/node-kenburns':
specifier: workspace:*
version: link:../../nodes/node-kenburns
@@ -2775,15 +3121,30 @@ importers:
'@framefields/node-noise-generator':
specifier: workspace:*
version: link:../../nodes/node-noise-generator
+ '@framefields/node-op-art':
+ specifier: workspace:*
+ version: link:../../nodes/node-op-art
'@framefields/node-paint':
specifier: workspace:*
version: link:../../nodes/node-paint
+ '@framefields/node-painterly':
+ specifier: workspace:*
+ version: link:../../nodes/node-painterly
'@framefields/node-particles':
specifier: workspace:*
version: link:../../nodes/node-particles
'@framefields/node-patch-heal':
specifier: workspace:*
version: link:../../nodes/node-patch-heal
+ '@framefields/node-pixelate':
+ specifier: workspace:*
+ version: link:../../nodes/node-pixelate
+ '@framefields/node-posterize':
+ specifier: workspace:*
+ version: link:../../nodes/node-posterize
+ '@framefields/node-procedural-vfx':
+ specifier: workspace:*
+ version: link:../../nodes/node-procedural-vfx
'@framefields/node-refine-edge':
specifier: workspace:*
version: link:../../nodes/node-refine-edge
@@ -2796,6 +3157,9 @@ importers:
'@framefields/node-resizer-scaler':
specifier: workspace:*
version: link:../../nodes/node-resizer-scaler
+ '@framefields/node-rgb-split':
+ specifier: workspace:*
+ version: link:../../nodes/node-rgb-split
'@framefields/node-rotate':
specifier: workspace:*
version: link:../../nodes/node-rotate
@@ -2820,6 +3184,9 @@ importers:
'@framefields/node-tile-offset':
specifier: workspace:*
version: link:../../nodes/node-tile-offset
+ '@framefields/node-toon':
+ specifier: workspace:*
+ version: link:../../nodes/node-toon
'@framefields/node-trails':
specifier: workspace:*
version: link:../../nodes/node-trails