Skip to content

Production-ready animations, transitions, backgrounds, and scenes for Remotion

feat: underwatter

kapishdimac82204b4e414
diff --git a/components/docs/examples/index.tsx b/components/docs/examples/index.tsx
index 44354f63..6d7314b7 100644
--- a/components/docs/examples/index.tsx
+++ b/components/docs/examples/index.tsx
@@ -87,6 +87,10 @@ import {
TypingIndicatorExampleScene,
typingIndicatorExampleCode,
} from "./typing-indicator-example";
+import {
+ RippleBackdropExampleScene,
+ RippleSurfaceExampleScene,
+} from "./underwater-ripple-recipes";
export interface ExampleEntry {
Component: ComponentType;
@@ -501,4 +505,24 @@ export const examples: Record<string, ExampleEntry> = {
height: H,
previewBackdrop: { type: "color", value: "#26231d" },
},
+ "ripple-surface-example": {
+ Component: RippleSurfaceExampleScene,
+ code: "<UnderwaterRipple amplitude={amplitude} speed={3} />",
+ // Settles to still water by frame 46, holds, then sinks back so the loop closes.
+ durationInFrames: 120,
+ fps: FPS,
+ width: W,
+ height: H,
+ previewBackdrop: { type: "color", value: "#06171c" },
+ },
+ "ripple-backdrop-example": {
+ Component: RippleBackdropExampleScene,
+ code: "<UnderwaterRipple amplitude={14} scale={0.8} speed={2} />",
+ // speed=2 over 120 frames is a whole number of cycles, so the water loops seamlessly.
+ durationInFrames: 120,
+ fps: FPS,
+ width: W,
+ height: H,
+ previewBackdrop: { type: "color", value: "#06171c" },
+ },
};
diff --git a/components/docs/examples/underwater-ripple-example.tsx b/components/docs/examples/underwater-ripple-example.tsx
new file mode 100644
index 00000000..e05a39b1
--- /dev/null
+++ b/components/docs/examples/underwater-ripple-example.tsx
@@ -0,0 +1,50 @@
+"use client";
+
+import { CanvasSceneA } from "@/components/docs/examples/canvas-scenes";
+import { UnderwaterRipple } from "@/registry/remocn/underwater-ripple";
+
+interface UnderwaterRippleExampleProps {
+ amplitude?: number;
+ scale?: number;
+ speed?: number;
+ dispersion?: number;
+}
+
+export function UnderwaterRippleExampleScene({
+ amplitude,
+ scale,
+ speed,
+ dispersion,
+}: UnderwaterRippleExampleProps) {
+ return (
+ <UnderwaterRipple
+ amplitude={amplitude}
+ scale={scale}
+ speed={speed}
+ dispersion={dispersion}
+ >
+ <CanvasSceneA />
+ </UnderwaterRipple>
+ );
+}
+
+export const underwaterRippleExampleCode = (
+ values: Record<string, unknown>,
+): string => {
+ const amplitude = (values.amplitude as number) ?? 7;
+ const scale = (values.scale as number) ?? 1;
+ const speed = (values.speed as number) ?? 2;
+ const dispersion = (values.dispersion as number) ?? 1;
+ return `import { UnderwaterRipple } from "@/components/remocn/underwater-ripple";
+
+export const MyScene = () => (
+ <UnderwaterRipple
+ amplitude={${amplitude}}
+ scale={${scale}}
+ speed={${speed}}
+ dispersion={${dispersion}}
+ >
+ <Scene />
+ </UnderwaterRipple>
+);`;
+};
diff --git a/components/docs/examples/underwater-ripple-recipes.tsx b/components/docs/examples/underwater-ripple-recipes.tsx
new file mode 100644
index 00000000..9f661da1
--- /dev/null
+++ b/components/docs/examples/underwater-ripple-recipes.tsx
@@ -0,0 +1,73 @@
+"use client";
+
+import { AbsoluteFill, interpolate, useCurrentFrame } from "remotion";
+import { CanvasSceneA } from "@/components/docs/examples/canvas-scenes";
+import { UnderwaterRipple } from "@/registry/remocn/underwater-ripple";
+
+const SANS =
+ "var(--font-geist-sans), -apple-system, BlinkMacSystemFont, sans-serif";
+
+export function RippleSurfaceExampleScene() {
+ const frame = useCurrentFrame();
+ const amplitude = interpolate(frame, [0, 46, 86, 120], [34, 0, 0, 34]);
+
+ return (
+ <UnderwaterRipple amplitude={amplitude} speed={3}>
+ <CanvasSceneA />
+ </UnderwaterRipple>
+ );
+}
+
+function PoolBackdrop() {
+ return (
+ <AbsoluteFill
+ style={{
+ background:
+ "linear-gradient(160deg, #0b3b47 0%, #10606b 55%, #1b8a86 100%)",
+ }}
+ >
+ {[0.24, 0.46, 0.68, 0.86].map((top) => (
+ <div
+ key={top}
+ style={{
+ position: "absolute",
+ insetInline: 0,
+ top: `${top * 100}%`,
+ height: 10,
+ background: "rgba(226, 255, 250, 0.22)",
+ }}
+ />
+ ))}
+ </AbsoluteFill>
+ );
+}
+
+export function RippleBackdropExampleScene() {
+ return (
+ <AbsoluteFill>
+ <UnderwaterRipple amplitude={14} scale={0.8} speed={2}>
+ <PoolBackdrop />
+ </UnderwaterRipple>
+ <AbsoluteFill
+ style={{ padding: 96, justifyContent: "center", fontFamily: SANS }}
+ >
+ <span
+ style={{
+ fontSize: 92,
+ fontWeight: 600,
+ letterSpacing: "-0.035em",
+ lineHeight: 1.04,
+ color: "#f4fbfa",
+ }}
+ >
+ Deep work,
+ <br />
+ shallow setup
+ </span>
+ <span style={{ marginTop: 26, fontSize: 34, color: "#a9d4d0" }}>
+ Everything configured before your coffee lands
+ </span>
+ </AbsoluteFill>
+ </AbsoluteFill>
+ );
+}
diff --git a/content/changelog/2026-08-02-filters.mdx b/content/changelog/2026-08-02-filters.mdx
index 23d1d622..1a653644 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.
+- [Underwater Ripple](/docs/filters/components/underwater-ripple) — a scene held under moving water. Every pixel is read through a layered refraction field and the colour channels separate where the water bends hardest, so edges fringe the way light does through a real surface. `speed` is a count of complete cycles across the composition rather than a rate, which means whole numbers loop with no seam to hide — and inside a `Sequence` it picks up that sequence's length, so a long ambient hold and a short beat each close on their own. Wrap only the backdrop and your type stays crisp in front of it.
- [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.
diff --git a/content/docs/filters/components/meta.json b/content/docs/filters/components/meta.json
index 469d312c..4c6467c5 100644
--- a/content/docs/filters/components/meta.json
+++ b/content/docs/filters/components/meta.json
@@ -7,6 +7,7 @@
"sustained-glitch",
"pixelate-region",
"ascii-render",
- "halftone-print"
+ "halftone-print",
+ "underwater-ripple"
]
}
diff --git a/content/docs/filters/components/underwater-ripple.mdx b/content/docs/filters/components/underwater-ripple.mdx
new file mode 100644
index 00000000..8ccfea8f
--- /dev/null
+++ b/content/docs/filters/components/underwater-ripple.mdx
@@ -0,0 +1,168 @@
+---
+title: Underwater Ripple
+description: Hold a scene under moving water — layered refraction that closes on a whole number of cycles
+component: underwater-ripple
+vibe: premium
+length: sustained
+useWhen:
+ - "A scene should sit under water for its whole run — calm premium backdrops, ambient hero loops, a title card that needs motion without a direction."
+ - "A scene should surface out of the water on entry — interpolate amplitude down to 0 and the picture settles into stillness."
+ - "The section loops, since the ripple closes exactly on a whole number of cycles across the composition."
+avoidWhen:
+ - "The water should be its own layer rather than something the scene is seen through — use `shader-caustics` behind a crisp scene."
+ - "The scene carries small type that has to stay legible, since refraction bends every edge it touches."
+ - "You want a single travelling wave rather than a field that moves everywhere at once — nothing here sweeps."
+---
+
+<ComponentPreview name="underwater-ripple" />
+
+<CanvasFilterNote />
+
+## Installation
+
+<InstallBlock name="underwater-ripple" />
+
+## Usage
+
+`UnderwaterRipple` is a wrapper. Put a scene inside it and every pixel is read
+through a moving water surface: the picture bends along the slope of the field,
+and where the water bends hardest the colour channels separate a little, the way
+light does through a real surface.
+
+```tsx
+import { UnderwaterRipple } from "@/components/remocn/underwater-ripple";
+
+export const MyScene = () => (
+ <UnderwaterRipple>
+ <Scene />
+ </UnderwaterRipple>
+);
+```
+
+## The loop closes by construction
+
+`speed` is not a rate, it is a count: how many complete cycles the water goes
+through over the composition. Keep it a whole number and the last frame hands
+back to the first with nothing to hide — put the section on repeat and there is
+no seam to find.
+
+That is also why the filter reads `durationInFrames` rather than seconds. Inside
+a `Sequence` it picks up that sequence's length, so a ten-second ambient hold and
+a two-second beat each close on their own.
+
+A fractional `speed` still renders, it simply will not loop.
+
+## What to reach for it for
+
+### Surface out of the water
+
+The arrival. The scene starts deep under a heavy ripple and settles into
+stillness over a second and a half — motion that resolves rather than motion that
+merely stops.
+
+<ComponentExample name="ripple-surface" />
+
+```tsx
+import { interpolate, useCurrentFrame } from "remotion";
+import { UnderwaterRipple } from "@/components/remocn/underwater-ripple";
+
+export const Opening = () => {
+ const frame = useCurrentFrame();
+ const amplitude = interpolate(frame, [0, 46], [34, 0], {
+ extrapolateRight: "clamp",
+ });
+
+ return (
+ <UnderwaterRipple amplitude={amplitude} speed={3}>
+ <Scene />
+ </UnderwaterRipple>
+ );
+};
+```
+
+The preview sinks back at the end so that it loops; a real opening would settle
+at 0 and stay there. At `amplitude={0}` the scene passes through untouched, so
+there is nothing to tear down afterwards.
+
+### Water behind, type in front
+
+The more useful shape in practice. Wrap only the backdrop and leave the type
+outside the wrapper: the water moves, the words stay perfectly crisp. Refraction
+is the one thing in this pack you almost never want on your own copy.
+
+<ComponentExample name="ripple-backdrop" />
+
+```tsx
+import { AbsoluteFill } from "remotion";
+import { UnderwaterRipple } from "@/components/remocn/underwater-ripple";
+
+export const Scene = () => (
+ <AbsoluteFill>
+ <UnderwaterRipple amplitude={14} scale={0.8} speed={2}>
+ <PoolBackdrop />
+ </UnderwaterRipple>
+ <AbsoluteFill>{/* headline stays sharp out here */}</AbsoluteFill>
+ </AbsoluteFill>
+);
+```
+
+## Props
+
+<PropsTable
+ rows={[
+ {
+ name: "amplitude",
+ type: "number",
+ default: "7",
+ description:
+ "How far the water pushes the picture, in composition units. Read every frame, so interpolating it is how a scene surfaces. At 0 the scene passes through untouched.",
+ },
+ {
+ name: "scale",
+ type: "number",
+ default: "1",
+ description:
+ "Size of the wave structure. Low values give long swells, high values a tight chop. Changing it does not change how far pixels move — that stays with amplitude.",
+ },
+ {
+ name: "speed",
+ type: "number",
+ default: "2",
+ description:
+ "Complete cycles across the composition, not a rate. Whole numbers loop seamlessly; higher values are faster water on the same length of scene.",
+ },
+ {
+ name: "dispersion",
+ type: "number",
+ default: "1",
+ description:
+ "How far red and blue separate where the water bends hardest. Scales with the local slope, so flat water stays clean and the fringing appears only in the troughs and crests.",
+ },
+ {
+ name: "children",
+ type: "React.ReactNode",
+ description: "The scene the filter wraps and re-reads every frame.",
+ },
+ ]}
+/>
+
+## Notes
+
+The field is a closed-form sum of three travelling waves whose temporal phases
+are whole multiples of the base cycle, and the displacement is its exact
+analytic gradient rather than a sampled difference. Nothing is simulated forward
+from the previous frame, so any frame can be rendered in isolation and parallel
+workers cannot drift apart.
+
+It never sweeps. The whole surface moves at once, so there is no front crossing
+the frame and no direction to the effect — which is what lets it sit on a scene
+for a minute without becoming an event.
+
+The filter expects a full-bleed scene. It reads pixels from a displaced
+coordinate, so where the scene is transparent it has nothing to bend and the
+untouched original shows through underneath — put a background inside the
+wrapper rather than behind it.
+
+In browsers without html-in-canvas the scene renders untouched. CSS cannot read a
+pixel from anywhere but where it is, and a wobbling blur would be a different
+effect wearing this one's name.
diff --git a/registry-artifacts/registry.json b/registry-artifacts/registry.json
index 6afd56b0..f633c57d 100644
--- a/registry-artifacts/registry.json
+++ b/registry-artifacts/registry.json
@@ -1674,6 +1674,21 @@
],
"type": "registry:component"
},
+ {
+ "name": "underwater-ripple",
+ "title": "Underwater Ripple",
+ "description": "Hold a scene under moving water: every pixel is read through a layered refraction field that closes on a whole number of cycles, with colour fringing where the water bends hardest.",
+ "dependencies": ["remotion"],
+ "registryDependencies": ["@remocn/canvas-presentation"],
+ "files": [
+ {
+ "path": "registry/remocn/underwater-ripple/index.tsx",
+ "type": "registry:component",
+ "target": "components/remocn/underwater-ripple.tsx"
+ }
+ ],
+ "type": "registry:component"
+ },
{
"name": "halftone-print",
"title": "Halftone Print",
diff --git a/registry-artifacts/underwater-ripple.json b/registry-artifacts/underwater-ripple.json
new file mode 100644
index 00000000..243ceb88
--- /dev/null
+++ b/registry-artifacts/underwater-ripple.json
@@ -0,0 +1,17 @@
+{
+ "$schema": "https://ui.shadcn.com/schema/registry-item.json",
+ "name": "underwater-ripple",
+ "title": "Underwater Ripple",
+ "description": "Hold a scene under moving water: every pixel is read through a layered refraction field that closes on a whole number of cycles, with colour fringing where the water bends hardest.",
+ "dependencies": ["remotion"],
+ "registryDependencies": ["@remocn/canvas-presentation"],
+ "files": [
+ {
+ "path": "registry/remocn/underwater-ripple/index.tsx",
+ "content": "\"use client\";\n\nimport type React from \"react\";\nimport { AbsoluteFill, useCurrentFrame, useVideoConfig } from \"remotion\";\nimport {\n type CanvasFilterProps,\n makeCanvasFilter,\n makeFilterShader,\n} from \"@/lib/remocn/canvas-presentation\";\n\nexport type UnderwaterRippleProps = {\n amplitude?: number;\n scale?: number;\n speed?: number;\n dispersion?: number;\n};\n\nconst DEFAULTS = {\n amplitude: 7,\n scale: 1,\n speed: 2,\n dispersion: 1,\n};\n\ntype NormalizedProps = {\n amplitude: number;\n scale: number;\n phase: number;\n dispersion: number;\n};\n\nconst FRAGMENT_SHADER = `#version 300 es\nprecision highp float;\n\nuniform sampler2D u_scene;\nuniform float u_aspect;\nuniform float u_phase;\nuniform float u_amplitude;\nuniform float u_scale;\nuniform float u_dispersion;\n\nin vec2 v_uv;\nout vec4 outColor;\n\nvec2 fieldGradient(vec2 p, float phase) {\n float scale = max(u_scale, 0.05);\n vec2 k1 = vec2(1.0, 0.35);\n vec2 k2 = vec2(-0.42, 1.0);\n vec2 k3 = vec2(0.78, -0.63);\n float f1 = 6.1 * scale;\n float f2 = 8.7 * scale;\n float f3 = 12.3 * scale;\n\n vec2 g = vec2(0.0);\n g += cos(dot(p, k1) * f1 + phase) * f1 * k1;\n g += cos(dot(p, k2) * f2 - phase * 2.0) * f2 * k2;\n g += cos(dot(p, k3) * f3 + phase * 3.0) * f3 * k3;\n\n return g / (3.0 * f2);\n}\n\nvoid main() {\n vec2 p = vec2(v_uv.x * u_aspect, v_uv.y);\n vec2 grad = fieldGradient(p, u_phase);\n\n vec2 offset = grad * u_amplitude;\n float strength = length(grad);\n vec2 direction = strength > 0.0001 ? grad / strength : vec2(0.0);\n float spread = u_dispersion * u_amplitude * 0.3 * min(strength, 2.0);\n\n vec2 base = v_uv + vec2(offset.x / u_aspect, offset.y);\n vec2 lead = vec2(direction.x / u_aspect, direction.y) * spread;\n\n vec4 center = texture(u_scene, base);\n float r = texture(u_scene, base + lead).r;\n float b = texture(u_scene, base - lead).b;\n\n outColor = vec4(r, center.g, b, center.a);\n}`;\n\nconst shader = makeFilterShader<NormalizedProps>(\n FRAGMENT_SHADER,\n ({ gl, uniform, passedProps }) => {\n const { amplitude, scale, phase, dispersion } = passedProps;\n gl.uniform1f(uniform(\"u_amplitude\"), amplitude);\n gl.uniform1f(uniform(\"u_scale\"), scale);\n gl.uniform1f(uniform(\"u_phase\"), phase);\n gl.uniform1f(uniform(\"u_dispersion\"), dispersion);\n },\n);\n\nconst UnderwaterRippleFallback: React.FC<\n NormalizedProps & CanvasFilterProps\n> = ({ children }) => <AbsoluteFill>{children}</AbsoluteFill>;\n\nconst UnderwaterRippleCanvas = makeCanvasFilter<NormalizedProps>({\n shader,\n fallback: UnderwaterRippleFallback,\n});\n\nexport const UnderwaterRipple: React.FC<\n UnderwaterRippleProps & CanvasFilterProps\n> = ({\n amplitude = DEFAULTS.amplitude,\n scale = DEFAULTS.scale,\n speed = DEFAULTS.speed,\n dispersion = DEFAULTS.dispersion,\n children,\n}) => {\n const frame = useCurrentFrame();\n const { height, durationInFrames } = useVideoConfig();\n const cycle = Math.max(durationInFrames, 1);\n\n return (\n <UnderwaterRippleCanvas\n amplitude={amplitude / height}\n scale={scale}\n phase={(frame / cycle) * speed * Math.PI * 2}\n dispersion={dispersion}\n >\n {children}\n </UnderwaterRippleCanvas>\n );\n};\n",
+ "type": "registry:component",
+ "target": "components/remocn/underwater-ripple.tsx"
+ }
+ ],
+ "type": "registry:component"
+}
diff --git a/registry/__index__.tsx b/registry/__index__.tsx
index 02a81cc3..ae296fc3 100644
--- a/registry/__index__.tsx
+++ b/registry/__index__.tsx
@@ -114,6 +114,7 @@ import { terminalSimulatorConfig } from "@/registry/remocn/terminal-simulator/co
import { topDownLettersConfig } from "@/registry/remocn/top-down-letters/config";
import { trackingInConfig } from "@/registry/remocn/tracking-in/config";
import { typewriterConfig } from "@/registry/remocn/typewriter/config";
+import { underwaterRippleConfig } from "@/registry/remocn/underwater-ripple/config";
import { v0Config } from "@/registry/remocn/v0/config";
import { valueSwapConfig } from "@/registry/remocn/value-swap/config";
import { vhsFilterConfig } from "@/registry/remocn/vhs-filter/config";
@@ -1505,6 +1506,13 @@ const registry: Record<string, RegistryEntry> = {
})),
config: halftonePrintConfig,
},
+ "underwater-ripple": {
+ load: () =>
+ import("@/components/docs/examples/underwater-ripple-example").then(
+ (m) => ({ default: m.UnderwaterRippleExampleScene }),
+ ),
+ config: underwaterRippleConfig,
+ },
"slide-swap": {
load: () =>
import("@/components/docs/examples/slide-swap-example").then((m) => ({
diff --git a/registry/remocn/registry.json b/registry/remocn/registry.json
index f035802b..e7a543cb 100644
--- a/registry/remocn/registry.json
+++ b/registry/remocn/registry.json
@@ -1674,6 +1674,21 @@
}
]
},
+ {
+ "name": "underwater-ripple",
+ "type": "registry:component",
+ "title": "Underwater Ripple",
+ "description": "Hold a scene under moving water: every pixel is read through a layered refraction field that closes on a whole number of cycles, with colour fringing where the water bends hardest.",
+ "dependencies": ["remotion"],
+ "registryDependencies": ["@remocn/canvas-presentation"],
+ "files": [
+ {
+ "path": "underwater-ripple/index.tsx",
+ "type": "registry:component",
+ "target": "components/remocn/underwater-ripple.tsx"
+ }
+ ]
+ },
{
"name": "halftone-print",
"type": "registry:component",
diff --git a/registry/remocn/underwater-ripple/config.ts b/registry/remocn/underwater-ripple/config.ts
new file mode 100644
index 00000000..758dd668
--- /dev/null
+++ b/registry/remocn/underwater-ripple/config.ts
@@ -0,0 +1,47 @@
+import { underwaterRippleExampleCode } from "@/components/docs/examples/underwater-ripple-example";
+import { type ComponentConfig, FPS, H, W } from "@/lib/customizer-config";
+
+export const underwaterRippleConfig: ComponentConfig = {
+ componentName: "UnderwaterRipple",
+ importPath: "@/components/remocn/underwater-ripple",
+ controls: {
+ amplitude: {
+ type: "number",
+ default: 7,
+ min: 0,
+ max: 40,
+ step: 1,
+ label: "Amplitude",
+ },
+ scale: {
+ type: "number",
+ default: 1,
+ min: 0.2,
+ max: 4,
+ step: 0.1,
+ label: "Scale",
+ },
+ speed: {
+ type: "number",
+ default: 2,
+ min: 1,
+ max: 8,
+ step: 1,
+ label: "Cycles",
+ },
+ dispersion: {
+ type: "number",
+ default: 1,
+ min: 0,
+ max: 4,
+ step: 0.1,
+ label: "Dispersion",
+ },
+ },
+ durationInFrames: 120,
+ fps: FPS,
+ compositionWidth: W,
+ compositionHeight: H,
+ previewBackdrop: { type: "color", value: "#06171c" },
+ snippet: underwaterRippleExampleCode,
+};
diff --git a/registry/remocn/underwater-ripple/index.tsx b/registry/remocn/underwater-ripple/index.tsx
new file mode 100644
index 00000000..005d025f
--- /dev/null
+++ b/registry/remocn/underwater-ripple/index.tsx
@@ -0,0 +1,124 @@
+"use client";
+
+import type React from "react";
+import { AbsoluteFill, useCurrentFrame, useVideoConfig } from "remotion";
+import {
+ type CanvasFilterProps,
+ makeCanvasFilter,
+ makeFilterShader,
+} from "@/lib/remocn/canvas-presentation";
+
+export type UnderwaterRippleProps = {
+ amplitude?: number;
+ scale?: number;
+ speed?: number;
+ dispersion?: number;
+};
+
+const DEFAULTS = {
+ amplitude: 7,
+ scale: 1,
+ speed: 2,
+ dispersion: 1,
+};
+
+type NormalizedProps = {
+ amplitude: number;
+ scale: number;
+ phase: number;
+ dispersion: number;
+};
+
+const FRAGMENT_SHADER = `#version 300 es
+precision highp float;
+
+uniform sampler2D u_scene;
+uniform float u_aspect;
+uniform float u_phase;
+uniform float u_amplitude;
+uniform float u_scale;
+uniform float u_dispersion;
+
+in vec2 v_uv;
+out vec4 outColor;
+
+vec2 fieldGradient(vec2 p, float phase) {
+ float scale = max(u_scale, 0.05);
+ vec2 k1 = vec2(1.0, 0.35);
+ vec2 k2 = vec2(-0.42, 1.0);
+ vec2 k3 = vec2(0.78, -0.63);
+ float f1 = 6.1 * scale;
+ float f2 = 8.7 * scale;
+ float f3 = 12.3 * scale;
+
+ vec2 g = vec2(0.0);
+ g += cos(dot(p, k1) * f1 + phase) * f1 * k1;
+ g += cos(dot(p, k2) * f2 - phase * 2.0) * f2 * k2;
+ g += cos(dot(p, k3) * f3 + phase * 3.0) * f3 * k3;
+
+ return g / (3.0 * f2);
+}
+
+void main() {
+ vec2 p = vec2(v_uv.x * u_aspect, v_uv.y);
+ vec2 grad = fieldGradient(p, u_phase);
+
+ vec2 offset = grad * u_amplitude;
+ float strength = length(grad);
+ vec2 direction = strength > 0.0001 ? grad / strength : vec2(0.0);
+ float spread = u_dispersion * u_amplitude * 0.3 * min(strength, 2.0);
+
+ vec2 base = v_uv + vec2(offset.x / u_aspect, offset.y);
+ vec2 lead = vec2(direction.x / u_aspect, direction.y) * spread;
+
+ vec4 center = texture(u_scene, base);
+ float r = texture(u_scene, base + lead).r;
+ float b = texture(u_scene, base - lead).b;
+
+ outColor = vec4(r, center.g, b, center.a);
+}`;
+
+const shader = makeFilterShader<NormalizedProps>(
+ FRAGMENT_SHADER,
+ ({ gl, uniform, passedProps }) => {
+ const { amplitude, scale, phase, dispersion } = passedProps;
+ gl.uniform1f(uniform("u_amplitude"), amplitude);
+ gl.uniform1f(uniform("u_scale"), scale);
+ gl.uniform1f(uniform("u_phase"), phase);
+ gl.uniform1f(uniform("u_dispersion"), dispersion);
+ },
+);
+
+const UnderwaterRippleFallback: React.FC<
+ NormalizedProps & CanvasFilterProps
+> = ({ children }) => <AbsoluteFill>{children}</AbsoluteFill>;
+
+const UnderwaterRippleCanvas = makeCanvasFilter<NormalizedProps>({
+ shader,
+ fallback: UnderwaterRippleFallback,
+});
+
+export const UnderwaterRipple: React.FC<
+ UnderwaterRippleProps & CanvasFilterProps
+> = ({
+ amplitude = DEFAULTS.amplitude,
+ scale = DEFAULTS.scale,
+ speed = DEFAULTS.speed,
+ dispersion = DEFAULTS.dispersion,
+ children,
+}) => {
+ const frame = useCurrentFrame();
+ const { height, durationInFrames } = useVideoConfig();
+ const cycle = Math.max(durationInFrames, 1);
+
+ return (
+ <UnderwaterRippleCanvas
+ amplitude={amplitude / height}
+ scale={scale}
+ phase={(frame / cycle) * speed * Math.PI * 2}
+ dispersion={dispersion}
+ >
+ {children}
+ </UnderwaterRippleCanvas>
+ );
+};
diff --git a/src/remotion/canvas-spike-root.tsx b/src/remotion/canvas-spike-root.tsx
index 381199b8..987aa478 100644
--- a/src/remotion/canvas-spike-root.tsx
+++ b/src/remotion/canvas-spike-root.tsx
@@ -16,6 +16,7 @@ import { HalftonePrintExampleScene } from "@/components/docs/examples/halftone-p
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";
+import { UnderwaterRippleExampleScene } from "@/components/docs/examples/underwater-ripple-example";
import { VhsFilterExampleScene } from "@/components/docs/examples/vhs-filter-example";
import type { ComponentConfig } from "@/lib/customizer-config";
import { asciiRenderConfig } from "@/registry/remocn/ascii-render/config";
@@ -28,6 +29,7 @@ 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";
+import { underwaterRippleConfig } from "@/registry/remocn/underwater-ripple/config";
import { vhsFilterConfig } from "@/registry/remocn/vhs-filter/config";
const { fontFamily: GEIST } = loadFont();
@@ -69,6 +71,10 @@ const SCENES: Record<
Scene: HalftonePrintExampleScene,
config: halftonePrintConfig,
},
+ "underwater-ripple": {
+ Scene: UnderwaterRippleExampleScene,
+ config: underwaterRippleConfig,
+ },
};
function makeStage(Scene: ComponentType) {