Production-ready animations, transitions, backgrounds, and scenes for Remotion
TypeScript ai-agentsclaude-codedemo-videomcpmcp-servermodel-context-protocolmotion-designproduct-demoreactremotionshadcnvideo
feat: halftone
kapishdimaebeb5189c285
diff --git a/components/docs/examples/canvas-scenes.tsx b/components/docs/examples/canvas-scenes.tsxindex 047d9b62..dd55fa64 100644--- a/components/docs/examples/canvas-scenes.tsx+++ b/components/docs/examples/canvas-scenes.tsx@@ -70,6 +70,73 @@ export function CanvasSceneA() {);}+const POSTER_BARS = [+ { tone: "#1f7a72", width: 0.92 },+ { tone: "#e2673a", width: 0.68 },+ { tone: "#2c3f8f", width: 0.44 },+];++export function CanvasScenePoster() {+ return (+ <AbsoluteFill+ style={{+ background: "#efe9dc",+ padding: 96,+ justifyContent: "center",+ fontFamily: SANS,+ }}+ >+ <span+ style={{+ fontSize: 30,+ fontWeight: 500,+ color: "#8a7f6b",+ }}+ >+ Issue 04+ </span>+ <span+ style={{+ marginTop: 18,+ maxWidth: 760,+ fontSize: 92,+ fontWeight: 600,+ letterSpacing: "-0.035em",+ lineHeight: 1.02,+ color: "#171410",+ }}+ >+ Ship the demo, not the deck+ </span>+ <span+ style={{+ marginTop: 28,+ maxWidth: 640,+ fontSize: 32,+ lineHeight: 1.4,+ color: "#5c5346",+ }}+ >+ A recorded product beats a rehearsed one. Cut it in the afternoon and+ send it before the meeting.+ </span>+ <div style={{ marginTop: 56, display: "flex", flexDirection: "column" }}>+ {POSTER_BARS.map((bar) => (+ <div+ key={bar.tone}+ style={{+ width: `${bar.width * 100}%`,+ height: 26,+ marginBottom: 14,+ background: bar.tone,+ }}+ />+ ))}+ </div>+ </AbsoluteFill>+ );+}+export const SECRET_ROW_X = 504;export const SECRET_ROW_WIDTH = 600;export const SECRET_ROW_HEIGHT = 72;diff --git a/components/docs/examples/halftone-print-example.tsx b/components/docs/examples/halftone-print-example.tsxnew file mode 100644index 00000000..b6178a8d--- /dev/null+++ b/components/docs/examples/halftone-print-example.tsx@@ -0,0 +1,50 @@+"use client";++import { CanvasScenePoster } from "@/components/docs/examples/canvas-scenes";+import { HalftonePrint } from "@/registry/remocn/halftone-print";++interface HalftonePrintExampleProps {+ dotSize?: number;+ angle?: number;+ misregistration?: number;+ paperTint?: string;+}++export function HalftonePrintExampleScene({+ dotSize,+ angle,+ misregistration,+ paperTint,+}: HalftonePrintExampleProps) {+ return (+ <HalftonePrint+ dotSize={dotSize}+ angle={angle}+ misregistration={misregistration}+ paperTint={paperTint}+ >+ <CanvasScenePoster />+ </HalftonePrint>+ );+}++export const halftonePrintExampleCode = (+ values: Record<string, unknown>,+): string => {+ const dotSize = (values.dotSize as number) ?? 10;+ const angle = (values.angle as number) ?? 0;+ const misregistration = (values.misregistration as number) ?? 1.2;+ const paperTint = (values.paperTint as string) ?? "#f4efe4";+ return `import { HalftonePrint } from "@/components/remocn/halftone-print";++export const MyScene = () => (+ <HalftonePrint+ dotSize={${dotSize}}+ angle={${angle}}+ misregistration={${misregistration}}+ paperTint="${paperTint}"+ >+ <Scene />+ </HalftonePrint>+);`;+};diff --git a/components/docs/examples/halftone-print-recipes.tsx b/components/docs/examples/halftone-print-recipes.tsxnew file mode 100644index 00000000..1749ffcf--- /dev/null+++ b/components/docs/examples/halftone-print-recipes.tsx@@ -0,0 +1,46 @@+"use client";++import { AbsoluteFill, interpolate, useCurrentFrame } from "remotion";+import { CanvasScenePoster } from "@/components/docs/examples/canvas-scenes";+import { HalftonePrint } from "@/registry/remocn/halftone-print";++export function HalftoneRegisterExampleScene() {+ const frame = useCurrentFrame();+ const misregistration = interpolate(frame, [0, 36, 74, 90], [9, 1.2, 1.2, 9]);++ return (+ <HalftonePrint misregistration={misregistration}>+ <CanvasScenePoster />+ </HalftonePrint>+ );+}++export function HalftoneResolveExampleScene() {+ const frame = useCurrentFrame();+ const dotSize = interpolate(frame, [0, 40, 72, 90], [30, 7, 7, 30]);++ return (+ <HalftonePrint dotSize={dotSize}>+ <CanvasScenePoster />+ </HalftonePrint>+ );+}++function PanningPoster() {+ const frame = useCurrentFrame();+ const offset = Math.sin((frame / 90) * Math.PI * 2) * 70;++ return (+ <AbsoluteFill style={{ transform: `translateX(${offset}px) scale(1.12)` }}>+ <CanvasScenePoster />+ </AbsoluteFill>+ );+}++export function HalftoneLiveExampleScene() {+ return (+ <HalftonePrint dotSize={12}>+ <PanningPoster />+ </HalftonePrint>+ );+}diff --git a/components/docs/examples/index.tsx b/components/docs/examples/index.tsxindex 4e9a38ba..44354f63 100644--- a/components/docs/examples/index.tsx+++ b/components/docs/examples/index.tsx@@ -41,6 +41,11 @@ import {FadeThroughExampleScene,fadeThroughExampleCode,} from "./fade-through-example";+import {+ HalftoneLiveExampleScene,+ HalftoneRegisterExampleScene,+ HalftoneResolveExampleScene,+} from "./halftone-print-recipes";import { InputExampleScene, inputExampleCode } from "./input-example";import {MessageBubbleExampleScene,@@ -466,4 +471,34 @@ export const examples: Record<string, ExampleEntry> = {height: H,previewBackdrop: { type: "color", value: "#0a0a0a" },},+ "halftone-register-example": {+ Component: HalftoneRegisterExampleScene,+ code: "<HalftonePrint misregistration={misregistration} />",+ // Plates pull into register by frame 36, hold, then drift back so the loop closes.+ durationInFrames: 90,+ fps: FPS,+ width: W,+ height: H,+ previewBackdrop: { type: "color", value: "#26231d" },+ },+ "halftone-resolve-example": {+ Component: HalftoneResolveExampleScene,+ code: "<HalftonePrint dotSize={dotSize} />",+ // Newsprint at frame 0 down to fine offset by frame 40, then back for the loop.+ durationInFrames: 90,+ fps: FPS,+ width: W,+ height: H,+ previewBackdrop: { type: "color", value: "#26231d" },+ },+ "halftone-live-example": {+ Component: HalftoneLiveExampleScene,+ code: "<HalftonePrint dotSize={12} />",+ // The picture pans one full sine cycle over these 90 frames; the screen never moves.+ durationInFrames: 90,+ fps: FPS,+ width: W,+ height: H,+ previewBackdrop: { type: "color", value: "#26231d" },+ },};diff --git a/content/changelog/2026-08-02-filters.mdx b/content/changelog/2026-08-02-filters.mdxindex 3405f138..23d1d622 100644--- a/content/changelog/2026-08-02-filters.mdx+++ b/content/changelog/2026-08-02-filters.mdx@@ -10,6 +10,7 @@ Canvas transitions gave the catalog effects that live at a cut. Filters are the### New components- [VHS Filter](/docs/filters/components/vhs-filter) — a scene held under analog tape. Colour bleeds sideways off every edge while brightness stays sharp, which is what separates tape from a blur; rows wander out of line on a slow drift with per-line jitter on top; the bottom of the frame tears where a real deck switches heads; luma noise and scanlines settle over all of it. Every knob is a plain number, so `intensity` can be interpolated to let a scene surface out of the wear.+- [Halftone Print](/docs/filters/components/halftone-print) — the scene put through a press. Cyan, magenta and yellow each get their own screen of dots, rotated to their own angle so the overlap makes a rosette rather than a moiré, and each dot is sized by how much of that ink belongs under it. The three screens land slightly out of register — each colour samples the scene at its own offset — so edges fringe the way real printing does, and paper shows through everywhere the ink does not cover. Feed it something light and graphic; a dark scene saturates every cell and the screen disappears.- [ASCII Render](/docs/filters/components/ascii-render) — the scene redrawn as text. The frame divides into glyph cells, each one measures the average brightness of the picture inside it and becomes the matching character from a density ramp, and because the measurement happens every frame the characters flow with whatever moves underneath. Monochrome on black for a terminal, or `colored` to let each glyph keep the colour of its own cell. `intensity` blends the text back toward the untouched scene and is read every frame, so a scene can resolve out of ASCII on entry, drop into it on a beat, or sit in it the whole time. It is the sustained sibling of `ascii-dissolve` — the same alphabet, held over a scene instead of covering a cut.- [Pixelate Region](/docs/filters/components/pixelate-region) — the practical one. Hand it rectangles in composition coordinates and everything inside them becomes an opaque mosaic, each cell the average of the picture under it, while the rest of the frame stays perfectly sharp. It is built so that failing open is impossible: the mosaic is composited over black at full alpha every frame, the CSS fallback degrades to a plain opaque block rather than an approximation, and passing more regions than can be covered throws instead of quietly dropping one. Record the real dashboard, cover the real key.- [Sustained Glitch](/docs/filters/components/sustained-glitch) — broadcast corruption held over a scene as scheduled bursts rather than a constant texture. Slices tear sideways on their own beats, channels pull apart, and blocks fill with picture dragged in from elsewhere in the frame; a few frames later it has decayed and the scene is untouched again until the next hit. `intensity` is read every frame, so the damage can be interpolated onto a beat. It is the sustained sibling of `glitch-cut` — the same look, living between the cuts instead of at one.diff --git a/content/docs/filters/components/halftone-print.mdx b/content/docs/filters/components/halftone-print.mdxnew file mode 100644index 00000000..9b98734f--- /dev/null+++ b/content/docs/filters/components/halftone-print.mdx@@ -0,0 +1,184 @@+---+title: Halftone Print+description: Print a scene onto paper — rotated dot screens per colour, slightly out of register+component: halftone-print+vibe: paper+length: sustained+useWhen:+ - "A scene should read as something printed rather than displayed — zine-flavoured intros, riso posters, editorial title cards."+ - "A page should arrive by being printed — interpolate misregistration from wide to tight and the plates pull into register on entry."+ - "The scene is light and graphic with real midtones, which is where a dot screen has something to render."+ - "You want the print character on everything in frame at once, including type and photography, for the scene's full duration."+avoidWhen:+ - "Only one element should feel papery while the rest of the scene stays clean — use `paper-sticker` or `paper-wobble`."+ - "The scene is dark, since almost every cell saturates to full ink and the screen disappears into a solid field."+ - "Small type has to stay readable — a dot screen throws away everything inside a cell but its colour."+---++<ComponentPreview name="halftone-print" />++<CanvasFilterNote />++## Installation++<InstallBlock name="halftone-print" />++## Usage++`HalftonePrint` is a wrapper. Put a scene inside it and it comes out as a printed+page: the picture separates into cyan, magenta and yellow, each screened onto its+own grid of dots rotated to its own angle, each dot sized by how much of that ink+belongs under it. The three screens land slightly out of register, and what shows+between them is paper.++```tsx+import { HalftonePrint } from "@/components/remocn/halftone-print";++export const MyScene = () => (+ <HalftonePrint>+ <Scene />+ </HalftonePrint>+);+```++## What to reach for it for++There is no master switch here, and that is deliberate: fading print back toward+a clean screen render is not a thing presses do. What print does have is two+honest arrivals — plates finding register, and a screen getting finer — and both+are just numbers read every frame.++### Let the press find register++The strongest opening. The plates start badly out of alignment and pull together+over the first second, so the page arrives by being printed rather than by fading+in. It is a move with a mechanical reason behind it, which is why it reads as+craft rather than as an effect.++<ComponentExample name="halftone-register" />++```tsx+import { interpolate, useCurrentFrame } from "remotion";+import { HalftonePrint } from "@/components/remocn/halftone-print";++export const Opening = () => {+ const frame = useCurrentFrame();+ const misregistration = interpolate(frame, [0, 36], [9, 1.2], {+ extrapolateRight: "clamp",+ });++ return (+ <HalftonePrint misregistration={misregistration}>+ <Poster />+ </HalftonePrint>+ );+};+```++The preview drifts back out at the end so that it loops; a real opening would+settle and stay.++### Resolve from newsprint to offset++The other arrival: start coarse and let the screen get finer. Where the register+move feels like a press starting up, this one feels like the image itself coming+into focus, and it survives on scenes with less colour to separate.++<ComponentExample name="halftone-resolve" />++```tsx+const dotSize = interpolate(frame, [0, 40], [30, 7], {+ extrapolateRight: "clamp",+});+```++### The screen belongs to the frame++Worth knowing before you animate anything underneath: the dot grid is fixed to+the frame, not to the picture. Move the scene and it travels through a stationary+screen, re-sampled every frame — the same way a moving subject would be+re-screened on every printed page of a flipbook, not carried along by its dots.++<ComponentExample name="halftone-live" />++That is what makes it safe to put animation inside the wrapper. It is also why+pushing a scene around behind a coarse screen shimmers: at `dotSize` above the+low twenties, cells flip between ink levels as content crosses them. Keep the dots+fine when the content moves, and save the coarse screens for scenes that hold.++## Feed it a light scene++This is the one filter in the pack with a strong opinion about what it wraps. A+dot screen renders tone by varying dot size, so it needs tone to render: on a+light, graphic scene the dots stay small and separate and the paper does the+work. On a dark scene nearly every cell saturates, the dots merge, and the result+is a flat field with none of the character.++If the scene you want to print is dark, invert it before wrapping rather than+turning `dotSize` up.++## Registration++`misregistration` is how far the three screens drift apart, in composition units.+The default is a fraction of a dot — enough that colour edges fringe the way a+real press does, not enough to read as a mistake. Push it past a few units and it+becomes the effect rather than the texture, which is a legitimate riso look but a+deliberate one.++Setting it to `0` gives a clean digital separation, which reads as a print+simulation rather than as print.++## Props++<PropsTable+ rows={[+ {+ name: "dotSize",+ type: "number",+ default: "10",+ description:+ "Width of one screen cell in composition units, and so the pitch of the dots. Small values read as fine offset, large values as coarse newsprint.",+ },+ {+ name: "angle",+ type: "number",+ default: "0",+ description:+ "Rotation in degrees applied to all three screens together. The 15/75/0 spread between them is fixed, since that is what produces a rosette instead of a moiré; this turns the whole set.",+ },+ {+ name: "misregistration",+ type: "number",+ default: "1.2",+ description:+ "How far the colour screens drift out of alignment, in composition units. Each channel samples the scene at its own offset, so edges fringe. 0 prints in perfect register.",+ },+ {+ name: "paperTint",+ type: "string",+ default: '"#f4efe4"',+ description:+ "The stock being printed on. It shows wherever ink does not cover, so it sets the whole temperature of the result.",+ },+ {+ name: "children",+ type: "React.ReactNode",+ description: "The scene the filter wraps and re-reads every frame.",+ },+ ]}+/>++## Notes++Nothing animates. The screen is fixed geometry and the dots re-measure the scene+every frame, so a still scene is pixel-identical frame to frame and a moving one+prints as it moves — no shimmer of its own to loop or drift.++Paper is emitted only where the scene is opaque, so wrapping a transparent+element does not box it into a sheet. Inside opaque areas the output is fully+covered, so the untouched scene beneath never shows through the gaps between+dots.++In browsers without html-in-canvas the scene renders untouched. A flat paper tint+over the frame was the obvious fallback and it was rejected: it would claim the+scene had been printed when nothing had been screened at all.diff --git a/content/docs/filters/components/meta.json b/content/docs/filters/components/meta.jsonindex 32497fc5..469d312c 100644--- a/content/docs/filters/components/meta.json+++ b/content/docs/filters/components/meta.json@@ -6,6 +6,7 @@"crt-screen","sustained-glitch","pixelate-region",- "ascii-render"+ "ascii-render",+ "halftone-print"]}diff --git a/registry-artifacts/halftone-print.json b/registry-artifacts/halftone-print.jsonnew file mode 100644index 00000000..47fa94b7--- /dev/null+++ b/registry-artifacts/halftone-print.json@@ -0,0 +1,17 @@+{+ "$schema": "https://ui.shadcn.com/schema/registry-item.json",+ "name": "halftone-print",+ "title": "Halftone Print",+ "description": "Print a scene onto paper: each colour separates onto its own rotated screen of dots sized by the ink under them, slightly out of register the way a real press runs.",+ "dependencies": ["remotion"],+ "registryDependencies": ["@remocn/canvas-presentation"],+ "files": [+ {+ "path": "registry/remocn/halftone-print/index.tsx",+ "content": "\"use client\";\n\nimport type React from \"react\";\nimport { AbsoluteFill, useVideoConfig } from \"remotion\";\nimport {\n type CanvasFilterProps,\n makeCanvasFilter,\n makeFilterShader,\n} from \"@/lib/remocn/canvas-presentation\";\n\nexport type HalftonePrintProps = {\n dotSize?: number;\n angle?: number;\n misregistration?: number;\n paperTint?: string;\n};\n\nconst DEFAULTS = {\n dotSize: 10,\n angle: 0,\n misregistration: 1.2,\n paperTint: \"#f4efe4\",\n};\n\ntype NormalizedProps = {\n cell: number;\n angle: number;\n shift: number;\n paper: string;\n};\n\nconst FRAGMENT_SHADER = `#version 300 es\nprecision highp float;\n\nuniform sampler2D u_scene;\nuniform float u_aspect;\nuniform float u_cell;\nuniform float u_angle;\nuniform float u_shift;\nuniform vec3 u_paper;\n\nin vec2 v_uv;\nout vec4 outColor;\n\nconst vec3 CYAN_ABSORB = vec3(0.92, 0.12, 0.02);\nconst vec3 MAGENTA_ABSORB = vec3(0.10, 0.88, 0.06);\nconst vec3 YELLOW_ABSORB = vec3(0.03, 0.10, 0.90);\n\nvec2 toSquare(vec2 uv) {\n return vec2(uv.x * u_aspect, uv.y);\n}\n\nvec2 fromSquare(vec2 p) {\n return vec2(p.x / u_aspect, p.y);\n}\n\nfloat screenInk(float angle, vec2 drift, vec3 pick) {\n vec2 p = toSquare(v_uv);\n float s = sin(angle);\n float c = cos(angle);\n vec2 r = vec2(p.x * c - p.y * s, p.x * s + p.y * c);\n\n vec2 center = (floor(r / u_cell) + 0.5) * u_cell;\n vec2 unrotated =\n vec2(center.x * c + center.y * s, -center.x * s + center.y * c);\n\n vec4 texel = texture(u_scene, fromSquare(unrotated + drift));\n vec3 straight = texel.rgb / max(texel.a, 0.004);\n float ink = clamp(1.0 - dot(straight, pick), 0.0, 1.0) * texel.a;\n\n float radius = sqrt(ink) * u_cell * 0.72;\n float aa = u_cell * 0.045;\n float coverage = 1.0 - smoothstep(radius - aa, radius + aa, length(r - center));\n return coverage * step(0.002, ink);\n}\n\nvoid main() {\n vec4 source = texture(u_scene, v_uv);\n\n float cyan =\n screenInk(u_angle + 0.2618, u_shift * vec2(1.0, 0.0), vec3(1.0, 0.0, 0.0));\n float magenta =\n screenInk(u_angle + 1.3090, u_shift * vec2(-0.5, 0.866), vec3(0.0, 1.0, 0.0));\n float yellow =\n screenInk(u_angle, u_shift * vec2(-0.5, -0.866), vec3(0.0, 0.0, 1.0));\n\n vec3 color = u_paper;\n color *= 1.0 - cyan * CYAN_ABSORB;\n color *= 1.0 - magenta * MAGENTA_ABSORB;\n color *= 1.0 - yellow * YELLOW_ABSORB;\n\n outColor = vec4(color * source.a, source.a);\n}`;\n\nfunction toRgb(hex: string): [number, number, number] {\n const value = hex.replace(\"#\", \"\");\n const full =\n value.length === 3\n ? value\n .split(\"\")\n .map((c) => c + c)\n .join(\"\")\n : value;\n const int = Number.parseInt(full, 16);\n if (Number.isNaN(int)) return [1, 1, 1];\n return [\n ((int >> 16) & 255) / 255,\n ((int >> 8) & 255) / 255,\n (int & 255) / 255,\n ];\n}\n\nconst shader = makeFilterShader<NormalizedProps>(\n FRAGMENT_SHADER,\n ({ gl, uniform, passedProps }) => {\n const { cell, angle, shift, paper } = passedProps;\n gl.uniform1f(uniform(\"u_cell\"), cell);\n gl.uniform1f(uniform(\"u_angle\"), angle);\n gl.uniform1f(uniform(\"u_shift\"), shift);\n gl.uniform3fv(uniform(\"u_paper\"), toRgb(paper));\n },\n);\n\nconst HalftonePrintFallback: React.FC<NormalizedProps & CanvasFilterProps> = ({\n children,\n}) => <AbsoluteFill>{children}</AbsoluteFill>;\n\nconst HalftonePrintCanvas = makeCanvasFilter<NormalizedProps>({\n shader,\n fallback: HalftonePrintFallback,\n});\n\nexport const HalftonePrint: React.FC<\n HalftonePrintProps & CanvasFilterProps\n> = ({\n dotSize = DEFAULTS.dotSize,\n angle = DEFAULTS.angle,\n misregistration = DEFAULTS.misregistration,\n paperTint = DEFAULTS.paperTint,\n children,\n}) => {\n const { height } = useVideoConfig();\n\n return (\n <HalftonePrintCanvas\n cell={Math.max(dotSize, 1) / height}\n angle={(angle * Math.PI) / 180}\n shift={misregistration / height}\n paper={paperTint}\n >\n {children}\n </HalftonePrintCanvas>\n );\n};\n",+ "type": "registry:component",+ "target": "components/remocn/halftone-print.tsx"+ }+ ],+ "type": "registry:component"+}diff --git a/registry-artifacts/registry.json b/registry-artifacts/registry.jsonindex 78b77fa5..6afd56b0 100644--- a/registry-artifacts/registry.json+++ b/registry-artifacts/registry.json@@ -1674,6 +1674,21 @@],"type": "registry:component"},+ {+ "name": "halftone-print",+ "title": "Halftone Print",+ "description": "Print a scene onto paper: each colour separates onto its own rotated screen of dots sized by the ink under them, slightly out of register the way a real press runs.",+ "dependencies": ["remotion"],+ "registryDependencies": ["@remocn/canvas-presentation"],+ "files": [+ {+ "path": "registry/remocn/halftone-print/index.tsx",+ "type": "registry:component",+ "target": "components/remocn/halftone-print.tsx"+ }+ ],+ "type": "registry:component"+ },{"name": "ascii-render","title": "ASCII Render",diff --git a/registry/__index__.tsx b/registry/__index__.tsxindex 09b8d3d5..02a81cc3 100644--- a/registry/__index__.tsx+++ b/registry/__index__.tsx@@ -33,6 +33,7 @@ import { glassCodeWalkConfig } from "@/registry/remocn/glass-code-walk/config";import { glitchCutConfig } from "@/registry/remocn/glitch-cut/config";import { grainDissolveConfig } from "@/registry/remocn/grain-dissolve/config";import { gridWaveConfig } from "@/registry/remocn/grid-wave/config";+import { halftonePrintConfig } from "@/registry/remocn/halftone-print/config";import { handCountConfig } from "@/registry/remocn/hand-count/config";import { handwriteConfig } from "@/registry/remocn/handwrite/config";import { iconScatterConfig } from "@/registry/remocn/icon-scatter/config";@@ -1497,6 +1498,13 @@ const registry: Record<string, RegistryEntry> = {})),config: asciiRenderConfig,},+ "halftone-print": {+ load: () =>+ import("@/components/docs/examples/halftone-print-example").then((m) => ({+ default: m.HalftonePrintExampleScene,+ })),+ config: halftonePrintConfig,+ },"slide-swap": {load: () =>import("@/components/docs/examples/slide-swap-example").then((m) => ({diff --git a/registry/remocn/halftone-print/config.ts b/registry/remocn/halftone-print/config.tsnew file mode 100644index 00000000..1c81d402--- /dev/null+++ b/registry/remocn/halftone-print/config.ts@@ -0,0 +1,44 @@+import { halftonePrintExampleCode } from "@/components/docs/examples/halftone-print-example";+import { type ComponentConfig, FPS, H, W } from "@/lib/customizer-config";++export const halftonePrintConfig: ComponentConfig = {+ componentName: "HalftonePrint",+ importPath: "@/components/remocn/halftone-print",+ controls: {+ dotSize: {+ type: "number",+ default: 10,+ min: 4,+ max: 32,+ step: 1,+ label: "Dot size",+ },+ angle: {+ type: "number",+ default: 0,+ min: 0,+ max: 90,+ step: 1,+ label: "Screen angle",+ },+ misregistration: {+ type: "number",+ default: 1.2,+ min: 0,+ max: 6,+ step: 0.2,+ label: "Misregistration",+ },+ paperTint: {+ type: "color",+ default: "#f4efe4",+ label: "Paper",+ },+ },+ durationInFrames: 90,+ fps: FPS,+ compositionWidth: W,+ compositionHeight: H,+ previewBackdrop: { type: "color", value: "#26231d" },+ snippet: halftonePrintExampleCode,+};diff --git a/registry/remocn/halftone-print/index.tsx b/registry/remocn/halftone-print/index.tsxnew file mode 100644index 00000000..bb9dbebc--- /dev/null+++ b/registry/remocn/halftone-print/index.tsx@@ -0,0 +1,154 @@+"use client";++import type React from "react";+import { AbsoluteFill, useVideoConfig } from "remotion";+import {+ type CanvasFilterProps,+ makeCanvasFilter,+ makeFilterShader,+} from "@/lib/remocn/canvas-presentation";++export type HalftonePrintProps = {+ dotSize?: number;+ angle?: number;+ misregistration?: number;+ paperTint?: string;+};++const DEFAULTS = {+ dotSize: 10,+ angle: 0,+ misregistration: 1.2,+ paperTint: "#f4efe4",+};++type NormalizedProps = {+ cell: number;+ angle: number;+ shift: number;+ paper: string;+};++const FRAGMENT_SHADER = `#version 300 es+precision highp float;++uniform sampler2D u_scene;+uniform float u_aspect;+uniform float u_cell;+uniform float u_angle;+uniform float u_shift;+uniform vec3 u_paper;++in vec2 v_uv;+out vec4 outColor;++const vec3 CYAN_ABSORB = vec3(0.92, 0.12, 0.02);+const vec3 MAGENTA_ABSORB = vec3(0.10, 0.88, 0.06);+const vec3 YELLOW_ABSORB = vec3(0.03, 0.10, 0.90);++vec2 toSquare(vec2 uv) {+ return vec2(uv.x * u_aspect, uv.y);+}++vec2 fromSquare(vec2 p) {+ return vec2(p.x / u_aspect, p.y);+}++float screenInk(float angle, vec2 drift, vec3 pick) {+ vec2 p = toSquare(v_uv);+ float s = sin(angle);+ float c = cos(angle);+ vec2 r = vec2(p.x * c - p.y * s, p.x * s + p.y * c);++ vec2 center = (floor(r / u_cell) + 0.5) * u_cell;+ vec2 unrotated =+ vec2(center.x * c + center.y * s, -center.x * s + center.y * c);++ vec4 texel = texture(u_scene, fromSquare(unrotated + drift));+ vec3 straight = texel.rgb / max(texel.a, 0.004);+ float ink = clamp(1.0 - dot(straight, pick), 0.0, 1.0) * texel.a;++ float radius = sqrt(ink) * u_cell * 0.72;+ float aa = u_cell * 0.045;+ float coverage = 1.0 - smoothstep(radius - aa, radius + aa, length(r - center));+ return coverage * step(0.002, ink);+}++void main() {+ vec4 source = texture(u_scene, v_uv);++ float cyan =+ screenInk(u_angle + 0.2618, u_shift * vec2(1.0, 0.0), vec3(1.0, 0.0, 0.0));+ float magenta =+ screenInk(u_angle + 1.3090, u_shift * vec2(-0.5, 0.866), vec3(0.0, 1.0, 0.0));+ float yellow =+ screenInk(u_angle, u_shift * vec2(-0.5, -0.866), vec3(0.0, 0.0, 1.0));++ vec3 color = u_paper;+ color *= 1.0 - cyan * CYAN_ABSORB;+ color *= 1.0 - magenta * MAGENTA_ABSORB;+ color *= 1.0 - yellow * YELLOW_ABSORB;++ outColor = vec4(color * source.a, source.a);+}`;++function toRgb(hex: string): [number, number, number] {+ const value = hex.replace("#", "");+ const full =+ value.length === 3+ ? value+ .split("")+ .map((c) => c + c)+ .join("")+ : value;+ const int = Number.parseInt(full, 16);+ if (Number.isNaN(int)) return [1, 1, 1];+ return [+ ((int >> 16) & 255) / 255,+ ((int >> 8) & 255) / 255,+ (int & 255) / 255,+ ];+}++const shader = makeFilterShader<NormalizedProps>(+ FRAGMENT_SHADER,+ ({ gl, uniform, passedProps }) => {+ const { cell, angle, shift, paper } = passedProps;+ gl.uniform1f(uniform("u_cell"), cell);+ gl.uniform1f(uniform("u_angle"), angle);+ gl.uniform1f(uniform("u_shift"), shift);+ gl.uniform3fv(uniform("u_paper"), toRgb(paper));+ },+);++const HalftonePrintFallback: React.FC<NormalizedProps & CanvasFilterProps> = ({+ children,+}) => <AbsoluteFill>{children}</AbsoluteFill>;++const HalftonePrintCanvas = makeCanvasFilter<NormalizedProps>({+ shader,+ fallback: HalftonePrintFallback,+});++export const HalftonePrint: React.FC<+ HalftonePrintProps & CanvasFilterProps+> = ({+ dotSize = DEFAULTS.dotSize,+ angle = DEFAULTS.angle,+ misregistration = DEFAULTS.misregistration,+ paperTint = DEFAULTS.paperTint,+ children,+}) => {+ const { height } = useVideoConfig();++ return (+ <HalftonePrintCanvas+ cell={Math.max(dotSize, 1) / height}+ angle={(angle * Math.PI) / 180}+ shift={misregistration / height}+ paper={paperTint}+ >+ {children}+ </HalftonePrintCanvas>+ );+};diff --git a/registry/remocn/registry.json b/registry/remocn/registry.jsonindex 931b7efe..f035802b 100644--- a/registry/remocn/registry.json+++ b/registry/remocn/registry.json@@ -1674,6 +1674,21 @@}]},+ {+ "name": "halftone-print",+ "type": "registry:component",+ "title": "Halftone Print",+ "description": "Print a scene onto paper: each colour separates onto its own rotated screen of dots sized by the ink under them, slightly out of register the way a real press runs.",+ "dependencies": ["remotion"],+ "registryDependencies": ["@remocn/canvas-presentation"],+ "files": [+ {+ "path": "halftone-print/index.tsx",+ "type": "registry:component",+ "target": "components/remocn/halftone-print.tsx"+ }+ ]+ },{"name": "ascii-render","type": "registry:component",diff --git a/src/remotion/canvas-spike-root.tsx b/src/remotion/canvas-spike-root.tsxindex 55eaaa10..381199b8 100644--- a/src/remotion/canvas-spike-root.tsx+++ b/src/remotion/canvas-spike-root.tsx@@ -12,6 +12,7 @@ import { DisplacementExampleScene } from "@/components/docs/examples/displacemenimport { EmberBurnExampleScene } from "@/components/docs/examples/ember-burn-example";import { GlitchCutExampleScene } from "@/components/docs/examples/glitch-cut-example";import { GridWaveExampleScene } from "@/components/docs/examples/grid-wave-example";+import { HalftonePrintExampleScene } from "@/components/docs/examples/halftone-print-example";import { ParticleDissolveExampleScene } from "@/components/docs/examples/particle-dissolve-example";import { PixelateRegionExampleScene } from "@/components/docs/examples/pixelate-region-example";import { SustainedGlitchExampleScene } from "@/components/docs/examples/sustained-glitch-example";@@ -23,6 +24,7 @@ import { displacementConfig } from "@/registry/remocn/displacement/config";import { emberBurnConfig } from "@/registry/remocn/ember-burn/config";import { glitchCutConfig } from "@/registry/remocn/glitch-cut/config";import { gridWaveConfig } from "@/registry/remocn/grid-wave/config";+import { halftonePrintConfig } from "@/registry/remocn/halftone-print/config";import { particleDissolveConfig } from "@/registry/remocn/particle-dissolve/config";import { pixelateRegionConfig } from "@/registry/remocn/pixelate-region/config";import { sustainedGlitchConfig } from "@/registry/remocn/sustained-glitch/config";@@ -63,6 +65,10 @@ const SCENES: Record<config: pixelateRegionConfig,},"ascii-render": { Scene: AsciiRenderExampleScene, config: asciiRenderConfig },+ "halftone-print": {+ Scene: HalftonePrintExampleScene,+ config: halftonePrintConfig,+ },};function makeStage(Scene: ComponentType) {