Code-first video & image, rendered natively on WebGPU.
name: framefields-effects 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, and procedural VFX in framefields. Use when adding blur, grain, LUTs, relighting, curves, greenscreen color keying, or effects driven by vision signals in framefields compositions; detection, cutouts, pose and SAM tracking themselves are in framefields-vision.
framefields-effects
Effects are typed Effect classes imported from framefields (grading, lens, texture, stylize, keying, temporal). Every prop takes a value or a Signal. No project yet: see the framefields skill.
Look every prop up in references/effects-catalog.md before setting it (generated: every class, prop, default and range). Scales differ per effect, and a value on the wrong scale renders as nothing, without an error.
Attaching effects
import { ApplyLUT, Blur, Crop, Curves, FilmGrain, Layer, Media, Vignette } from "framefields";
// 1. A layer (box, flex, shape, text, media): withEffect / withEffects
Layer.video("assets/footage.mp4", { fit: "cover" })
.withEffect(new Curves({ master: [{ x: 0, y: 0.05 }, { x: 0.5, y: 0.52 }, { x: 1, y: 0.95 }] }))
.withEffect(new Vignette({ strength: 40, radius: 0.85, softness: 0.6 }));
// 2. The whole composition
comp.apply(new FilmGrain({ strength: 18, size: 1.5, monochrome: true }));
// 3. A region (rectangle or tracked object) of a plate
comp.section({ source: "assets/interview.mp4", x: 400, y: 200, width: 300, height: 300, borderRadius: 150,
effects: [new Blur({ strength: 25, blurType: "Gaussian" })] });
// 4. A clip outside the layout tree
const clip = Media.video("assets/raw_log.mp4")
.apply(new ApplyLUT({ lutUrl: "assets/luts/cinematic.cube", intensity: 1 }))
.apply(new Crop({ cropType: "rect", topPercentage: 10, heightPercentage: 80 }));
await clip.renderFrame({ atMs: 1500 });
Effects
Grading
Curves: master/RGB tone curves plus hue and saturation curves (hueVsHue,hueVsSat,lumVsSat,satVsSat).ColorBalance: shadows/midtones/highlights shifts,preserveLuminosity.Levels: black/white points and gamma, master or per channel.SelectiveColor: CMYK-style adjustments per color range (reds … blacks).GradientMap: gradient remap (stops: [{ position: 0, color: "#000" }, { position: 1, color: "#FFF" }]).ShadowsHighlights: shadow lift and highlight recovery.ApplyLUT: 1D/3D.cubeLUTs.Modulate:hue,brightness,contrast,exposure,saturation,sepia.
Optics and texture
FilmGrain: grain with size, tonal masking, animation speed.Vignette: lens falloff: center, roundness, softness.Blur:"Gaussian","Box","Median","Motion","Bilateral","Edge-preserving","Radial","Zoom"; partial regions and tracked boxes.UnsharpMask: sharpen with threshold.HighPass: frequency isolation.HalftoneScreen: print screen:"Circle","Diamond","Line", or"Square"dots in"Monochrome"or"CMYK"angles.TileOffset: UV wrap:"wrap","clamp","mirror", or"transparent".MotionBlur: directional shutter blur.TemporalDeflicker: optical-flow blend that removes flicker (AI clips, high-speed footage).
Temporal (with memory)
Trails: the layer over a decaying copy of its own past.mode: "blend"(default; echoes on full-frame footage),"over"(cutouts and text),"add"(light painting on dark scenes),"max"(light trails).decay0.8 short echo → 0.97 long trails; per-framezoom(1.02 = tunnel),rotation,offsetX/Y,hueShift(psychedelic cycling).Datamosh: the previous picture dragged along the new frame's optical flow instead of being refreshed, until akeyframesframe (I-frame) shows the clean picture. Put keyframes where you want it clean; leave a cut out to smear one shot with the next one's motion.strength,bleed(clean picture mixed back per frame).- Both step as frames render; after a jump (scrubbing, a single
renderFrame) they replay the last frames (warmup) to rebuild the history.
Screen-space 3D
Relight3D: screen-space normal relighting (point, spot, directional).SSAO: contact shadows from depth.PBRGlass: refraction, IOR, dispersion, Fresnel.DepthOfField: aperture, focal length, focus distance.
Keying and crop
ColorKey: green/bluescreen keyer with spill suppression.Crop:cropType: "rect"(percent edges,roundnessfor rounded or circular corners) or"path"(pathPointspolygon);mode: "rest"keeps the outside instead.
Stylized looks (Styles.*)
When someone names a style ("VHS", "8-bit", "comic", "liquid logo"), read references/style-guide.md: it maps requests to presets, effects and techniques.
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 apalette(gameboy,teletext,cga,pico8,c64,grayscale,sepia,custom+colors) with BayerditherandpixelSize.Dither:bayer/noise/halftone; 1-bit duotone (dark/light) or per-channellevels.Ascii: glyphs by brightness;colorMode: "mono" | "source" | "green",cellSize,fg/bg,invert.Toon: brightness bands plus Sobel ink lines (edgeColor,edgeWidth,edgeThreshold).- 3D ink and cel shading are scene features, not this image effect:
Layer.environment(..., { outlines })andmaterial: "toon"(seeframefields-compose, 3D Look). RGBSplit: chromatic aberration alongangleorradial.CRT: curvature, scanlines, aperture mask, noise, flicker, vignette;trackingandchromagive VHS wobble and colour bleed.Painterly: Kuwaharaoil/watercolor(pigment edges, paper grain).Contour: topographic isolines over thesource, aflatpaper colour, or nothing.Kaleidoscope: mirrorsegmentsaround a center; animaterotation/zoom.OpArt: stripes / rings / checker / waves bent and thickened by the image.Iridescence: thin-film rainbow from brightness or relief; animateshift.Gooey: blur + alpha threshold (metaballs). Use it on layers with transparency (SVG, particles), not on opaque footage.
Signals and vision
Any numeric prop takes a Signal sampled every frame: audio envelopes, physics impacts, vision bounds, sineSignal({ frequency: 0.5, min: 0, max: 20 }). Detection, cutouts, pose and SAM tracking live in framefields-vision; effects consume their signals, e.g. layer.blurRegion(vision.objects.byCategory("person")) or a uniform driven by clip.signals.objects.get(1).bounds.
Rules of thumb
- Check the scale in the catalog.
FilmGrainandVignettestrengthrun 0–100 (defaults 15 and 50),Blurstrength0–100, whileBlurradiusis the 0–1 size of a partial blur region. - Restraint:
FilmGrainaround 10–25,Vignette25–45. - Order: tonal grading (
Curves,ColorBalance) before optics (Blur,DepthOfField); grain outermost. - Stills:
animated: falseonFilmGrainkeeps grain fixed on a held image.