Skip to content

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

feat: new components

kapishdimae3dc260ff196
diff --git a/components/docs/examples/shader-seam-example.tsx b/components/docs/examples/shader-seam-example.tsx
new file mode 100644
index 00000000..6358524a
--- /dev/null
+++ b/components/docs/examples/shader-seam-example.tsx
@@ -0,0 +1,134 @@
+"use client";
+
+import { linearTiming, TransitionSeries } from "@remotion/transitions";
+import { AbsoluteFill } from "remotion";
+import {
+ type ShaderSeamProps,
+ shaderSeam,
+} from "@/registry/remocn/shader-seam";
+
+function Scene({ next = false }: { next?: boolean }) {
+ const color = next ? "#25212d" : "#f0ecf5";
+ return (
+ <AbsoluteFill
+ style={{
+ background: next ? "#e9e5ee" : "#14121c",
+ color,
+ padding: 72,
+ fontFamily: "Arial, sans-serif",
+ }}
+ >
+ <div
+ style={{
+ display: "flex",
+ justifyContent: "space-between",
+ fontSize: 20,
+ }}
+ >
+ <span>remocn</span>
+ <span style={{ opacity: 0.5 }}>
+ {next ? "02 / Next scene" : "01 / Current scene"}
+ </span>
+ </div>
+ <div style={{ position: "absolute", left: 72, top: 252 }}>
+ <div
+ style={{
+ fontSize: 108,
+ letterSpacing: "-6px",
+ lineHeight: 1.05,
+ fontWeight: 600,
+ }}
+ >
+ {next ? "A new chapter." : "Let it dissolve."}
+ </div>
+ <div style={{ fontSize: 25, marginTop: 26, opacity: 0.5 }}>
+ {next
+ ? "Same frame. Another perspective."
+ : "A moment between two scenes."}
+ </div>
+ </div>
+ <div
+ style={{
+ position: "absolute",
+ right: -100,
+ bottom: -170,
+ width: 560,
+ height: 560,
+ border: `1px solid ${next ? "#b9afc8" : "#393040"}`,
+ borderRadius: "50%",
+ }}
+ >
+ <div
+ style={{
+ position: "absolute",
+ inset: 58,
+ border: "inherit",
+ borderRadius: "inherit",
+ }}
+ />
+ <div
+ style={{
+ position: "absolute",
+ inset: 116,
+ border: "inherit",
+ borderRadius: "inherit",
+ }}
+ />
+ </div>
+ <div
+ style={{
+ position: "absolute",
+ bottom: 64,
+ left: 72,
+ fontSize: 16,
+ opacity: 0.45,
+ }}
+ >
+ {next ? "Shader Seam" : "OpenShaders × remocn"}
+ </div>
+ </AbsoluteFill>
+ );
+}
+
+export function ShaderSeamExampleScene(props: ShaderSeamProps) {
+ return (
+ <TransitionSeries>
+ <TransitionSeries.Sequence durationInFrames={108}>
+ <Scene />
+ </TransitionSeries.Sequence>
+ <TransitionSeries.Transition
+ timing={linearTiming({ durationInFrames: 60 })}
+ presentation={shaderSeam(props)}
+ />
+ <TransitionSeries.Sequence durationInFrames={108}>
+ <Scene next />
+ </TransitionSeries.Sequence>
+ </TransitionSeries>
+ );
+}
+
+export function shaderSeamExampleCode(values: Record<string, unknown>) {
+ const props = {
+ softness: values.softness ?? 0.18,
+ detail: values.detail ?? 0.65,
+ speed: values.speed ?? 0,
+ timeOffset: values.timeOffset ?? 0,
+ };
+ return `import { TransitionSeries, linearTiming } from "@remotion/transitions";
+import { shaderSeam } from "@/components/remocn/shader-seam";
+
+export const MyVideo = () => (
+ <TransitionSeries>
+ <TransitionSeries.Sequence durationInFrames={108}>
+ <SceneA />
+ </TransitionSeries.Sequence>
+ <TransitionSeries.Transition
+ timing={linearTiming({ durationInFrames: 60 })}
+ presentation={shaderSeam(${JSON.stringify(props, null, 2).replace(/\n/g, "\n ")})}
+ />
+ <TransitionSeries.Sequence durationInFrames={108}>
+ <SceneB />
+ </TransitionSeries.Sequence>
+ </TransitionSeries>
+);`;
+}
diff --git a/components/docs/examples/shader-spiral-pass-example.tsx b/components/docs/examples/shader-spiral-pass-example.tsx
new file mode 100644
index 00000000..903036f7
--- /dev/null
+++ b/components/docs/examples/shader-spiral-pass-example.tsx
@@ -0,0 +1,104 @@
+"use client";
+
+import { linearTiming, TransitionSeries } from "@remotion/transitions";
+import { AbsoluteFill, useVideoConfig } from "remotion";
+import {
+ type ShaderSpiralPassProps,
+ shaderSpiralPass,
+} from "@/registry/remocn/shader-spiral-pass";
+
+function Scene({ next = false }: { next?: boolean }) {
+ const { width } = useVideoConfig();
+ return (
+ <AbsoluteFill
+ style={{
+ background: next ? "#f1edf4" : "#15111c",
+ color: next ? "#211a2c" : "#f4eefb",
+ padding: 64,
+ fontFamily: "Arial, sans-serif",
+ }}
+ >
+ <div
+ style={{
+ display: "flex",
+ justifyContent: "space-between",
+ fontSize: 20,
+ }}
+ >
+ <span>remocn</span>
+ <span style={{ opacity: 0.45 }}>
+ {next ? "02 / Arrival" : "01 / Departure"}
+ </span>
+ </div>
+ <AbsoluteFill style={{ justifyContent: "center", alignItems: "center" }}>
+ <div
+ style={{
+ fontSize: Math.min(106, width * 0.083),
+ fontWeight: 600,
+ letterSpacing: -5,
+ }}
+ >
+ {next ? "On the other side." : "Through the center."}
+ </div>
+ <div style={{ fontSize: 24, opacity: 0.5, marginTop: 24 }}>
+ {next ? "A new scene comes into view." : "One continuous journey."}
+ </div>
+ </AbsoluteFill>
+ <div
+ style={{
+ position: "absolute",
+ bottom: 60,
+ left: 64,
+ right: 64,
+ height: 2,
+ background: next ? "#c8bbd4" : "#463351",
+ }}
+ />
+ </AbsoluteFill>
+ );
+}
+
+export function ShaderSpiralPassExampleScene(props: ShaderSpiralPassProps) {
+ return (
+ <TransitionSeries>
+ <TransitionSeries.Sequence durationInFrames={120}>
+ <Scene />
+ </TransitionSeries.Sequence>
+ <TransitionSeries.Transition
+ timing={linearTiming({ durationInFrames: 72 })}
+ presentation={shaderSpiralPass(props)}
+ />
+ <TransitionSeries.Sequence durationInFrames={120}>
+ <Scene next />
+ </TransitionSeries.Sequence>
+ </TransitionSeries>
+ );
+}
+
+export function shaderSpiralPassExampleCode(values: Record<string, unknown>) {
+ const props = {
+ speed: values.speed ?? 1,
+ spirals: values.spirals ?? 3,
+ twist: values.twist ?? 0.7,
+ zoom: values.zoom ?? 14,
+ softness: values.softness ?? 0.12,
+ timeOffset: values.timeOffset ?? 0,
+ };
+ return `import { TransitionSeries, linearTiming } from "@remotion/transitions";
+import { shaderSpiralPass } from "@/components/remocn/shader-spiral-pass";
+
+export const MyVideo = () => (
+ <TransitionSeries>
+ <TransitionSeries.Sequence durationInFrames={120}>
+ <SceneA />
+ </TransitionSeries.Sequence>
+ <TransitionSeries.Transition
+ timing={linearTiming({ durationInFrames: 72 })}
+ presentation={shaderSpiralPass(${JSON.stringify(props, null, 2).replace(/\n/g, "\n ")})}
+ />
+ <TransitionSeries.Sequence durationInFrames={120}>
+ <SceneB />
+ </TransitionSeries.Sequence>
+ </TransitionSeries>
+);`;
+}
diff --git a/config/site.ts b/config/site.ts
index 968304d6..5689ecfe 100644
--- a/config/site.ts
+++ b/config/site.ts
@@ -64,23 +64,13 @@ export const NAV_LINKS: NavLink[] = [
* tag another menu item — no component changes needed. See `withNewBadges`.
*/
export const NEW_BADGE_PATHS = new Set<string>([
- "/docs/layout/stage",
+ "/docs/typography/inline-word-roll",
+ "/docs/typography/shader-text-reveal",
+ "/docs/transitions/shader-seam",
+ "/docs/transitions/shader-spiral-pass",
+ "/docs/shaders/components/shader-light-tunnel",
"/docs/typography/type-fossil",
- "/docs/typography/caret-swap",
- "/docs/typography/centered-word-build",
- "/docs/typography/fog-rise",
- "/docs/typography/gradient-scale-cut-text",
- "/docs/typography/inline-pill-takeover",
"/docs/typography/kinetic-morph-text",
- "/docs/typography/outline-fill-track-text",
- "/docs/typography/rush-type",
- "/docs/typography/shadow-sweep-text",
- "/docs/typography/sheen-slide-in",
- "/docs/typography/squeeze-in",
- "/docs/typography/typed-split-wipe",
- "/docs/typography/word-push",
- "/docs/typography/word-stream",
- "/docs/typography/zoom-words",
"/docs/effects/cursor-gravity",
"/docs/effects/radial-burst",
"/docs/ui-blocks/search-reveal",
diff --git a/content/changelog/2026-09-09-inline-word-roll.mdx b/content/changelog/2026-09-09-inline-word-roll.mdx
new file mode 100644
index 00000000..b6a4bf36
--- /dev/null
+++ b/content/changelog/2026-09-09-inline-word-roll.mdx
@@ -0,0 +1,14 @@
+---
+title: Inline word switching
+date: 2026-09-09
+---
+
+### New components
+
+[Inline Word Roll](/docs/typography/inline-word-roll) cycles through words beside
+a fixed prefix. Each replacement rolls up from below while the line smoothly
+recenters around its new width. Configure the words, prefix, suffix, interval
+and acceleration; the final word stays visible. Text measurement uses composition
+coordinates so scaled website previews retain the correct spacing and clipping.
+
+<ChangelogPreview name="inline-word-roll" />
diff --git a/content/changelog/2026-09-09-shader-light-tunnel.mdx b/content/changelog/2026-09-09-shader-light-tunnel.mdx
new file mode 100644
index 00000000..9abc1232
--- /dev/null
+++ b/content/changelog/2026-09-09-shader-light-tunnel.mdx
@@ -0,0 +1,22 @@
+---
+title: Hero shader light tunnel
+date: 2026-09-09
+---
+
+### New components
+
+[Light Tunnel](/docs/shaders/components/shader-light-tunnel) projects the original
+@remocn OpenShaders hero field into a tunnel with straight forward travel.
+The original colors, silk folds and halftone remain intact. The folds rotate
+around a fixed central vanishing point, making the circular motion visible
+throughout the tunnel. Three repetitions of the hero ribbons fill the tunnel
+with more spiral lines. Controls adjust flight speed, spiral motion, spiral
+count, depth and exposure. The hero's material phase stays fixed so its color
+cycle does not dim the ribbons during motion. Light folds stream inward toward
+the center on top of the circular motion, with a fast inward flow inspired by
+the reference clip's 1–3 second tunnel sequence.
+
+The center blends into a soft blur, removing the outlined dark circle at the
+vanishing point while keeping the outer ribbons sharp.
+
+<ChangelogPreview name="shader-light-tunnel" />
diff --git a/content/changelog/2026-09-09-shader-seam.mdx b/content/changelog/2026-09-09-shader-seam.mdx
new file mode 100644
index 00000000..d5c6eacb
--- /dev/null
+++ b/content/changelog/2026-09-09-shader-seam.mdx
@@ -0,0 +1,15 @@
+---
+title: OpenShaders dissolve transition
+date: 2026-09-09
+---
+
+### New components
+
+[Shader Seam](/docs/transitions/shader-seam) reveals the original @remocn
+OpenShaders material, then dissolves it in place to uncover the next scene.
+The scene exchange happens under the fully opaque shader. Its dark areas fade
+first and luminous folds remain briefly, with no directional travel or cropped
+edges. Adjust dissolve softness, organic detail and shader time, or supply
+another compatible local OpenShaders export.
+
+<ChangelogPreview name="shader-seam" />
diff --git a/content/changelog/2026-09-09-shader-spiral-pass.mdx b/content/changelog/2026-09-09-shader-spiral-pass.mdx
new file mode 100644
index 00000000..fb000d5b
--- /dev/null
+++ b/content/changelog/2026-09-09-shader-spiral-pass.mdx
@@ -0,0 +1,15 @@
+---
+title: Fly through the hero spiral
+date: 2026-09-09
+---
+
+### New components
+
+[Shader Spiral Pass](/docs/transitions/shader-spiral-pass) accelerates straight
+into a luminous spiral and reveals the next scene through its soft center.
+It reuses the Light Tunnel shader with its fixed color phase, rotating ribbons
+and fast inward flow. Controls adjust camera push, exit softness and shader motion.
+The incoming scene stays clipped inside a narrow, softly edged exit until the
+final approach, keeping its content from showing through the spiral walls.
+
+<ChangelogPreview name="shader-spiral-pass" />
diff --git a/content/changelog/2026-09-09-shader-text-reveal.mdx b/content/changelog/2026-09-09-shader-text-reveal.mdx
new file mode 100644
index 00000000..4a2b936d
--- /dev/null
+++ b/content/changelog/2026-09-09-shader-text-reveal.mdx
@@ -0,0 +1,14 @@
+---
+title: Liquid shader typography
+date: 2026-09-09
+---
+
+### New components
+
+[Shader Text Reveal](/docs/typography/shader-text-reveal) reveals words through
+the original @remocn OpenShaders hero field and halftone texture, then settles into clean white type. A dark diagonal
+wave clears each word before the next one appears. The shader controls the
+letters' surface and subtle edge refraction, with frame-driven playback and
+automatic text fitting.
+
+<ChangelogPreview name="shader-text-reveal" />
diff --git a/content/docs/shaders/components/meta.json b/content/docs/shaders/components/meta.json
index 41b1b5d0..848f10d7 100644
--- a/content/docs/shaders/components/meta.json
+++ b/content/docs/shaders/components/meta.json
@@ -2,6 +2,7 @@
"title": "Shaders",
"collapsible": false,
"pages": [
+ "shader-light-tunnel",
"shader-mesh-gradient",
"shader-grain-gradient",
"shader-warp",
diff --git a/content/docs/shaders/components/shader-light-tunnel.mdx b/content/docs/shaders/components/shader-light-tunnel.mdx
new file mode 100644
index 00000000..54985fd0
--- /dev/null
+++ b/content/docs/shaders/components/shader-light-tunnel.mdx
@@ -0,0 +1,90 @@
+---
+title: Light Tunnel
+description: Fly straight through the original OpenShaders hero field mapped into a light tunnel
+component: shader-light-tunnel
+vibe: premium
+length: 90
+useWhen:
+ - "A title reveal or product intro needs a luminous forward flight through a tunnel."
+ - "Light ribbons should have perspective, depth and soft atmospheric glow."
+avoidWhen:
+ - "A quiet background should leave attention on dense UI — use `shader-mesh-gradient`."
+ - "You need a flat liquid distortion instead of forward flight — use `shader-warp`."
+---
+
+<ComponentPreview name="shader-light-tunnel" />
+
+<InstallBlock name="shader-light-tunnel" />
+
+## Usage
+
+The original [@remocn OpenShaders shader](https://openshaders.com/@remocn) from the
+site's hero is projected onto a cylindrical tunnel. Its field equations, colors,
+silk folds and halftone texture are preserved. The adapter changes the field's
+sampling coordinates to create perspective and forward travel. The hero's
+material phase is held fixed, keeping its colors and brightness stable instead
+of cycling through darker phases. Movement comes from the tunnel mapping.
+
+The camera follows a fixed straight axis. The vanishing point stays centered;
+there is no lateral movement or camera roll. Twist winds the material around
+the tube and rotates its folds continuously around the center, while depth
+controls its perspective mapping. At the default settings, the material's
+pattern rotates by about 75 degrees per second. The hero ribbons repeat three
+times around the tunnel by default; `spirals` adjusts their density without
+changing the rotation speed. Folds also travel radially inward, so the light
+streams into the center as it rotates. At default speed, a fold reaches one
+tenth of its starting radius in about one second, independently of rotation.
+This inward flow remains visible with
+`twist={0}` and freezes along with rotation at `speed={0}`.
+
+```tsx
+import { AbsoluteFill } from "remotion";
+import { ShaderLightTunnel } from "@/components/remocn/shader-light-tunnel";
+
+export const Intro = () => (
+ <AbsoluteFill>
+ <ShaderLightTunnel speed={1} twist={0.7} spirals={3} glow={1} />
+ <AbsoluteFill
+ style={{
+ justifyContent: "center",
+ alignItems: "center",
+ color: "white",
+ fontFamily: "Arial, sans-serif",
+ fontSize: 72,
+ }}
+ >
+ Your next idea.
+ </AbsoluteFill>
+ </AbsoluteFill>
+);
+```
+
+The component fills the composition with an opaque background. Overlay titles or
+other React layers separately. The preview runs for 90 frames at 30 fps; the
+shader can run for any duration. It does not automatically fade in or out, and
+the camera path is continuous rather than a seamless loop.
+
+## Props
+
+<PropsTable rows={[
+ { name: "speed", type: "number", default: "1", description: "Forward travel and shader animation rate; clamped to 0–5. At 0 the tunnel is frozen at timeOffset." },
+ { name: "twist", type: "number", default: "0.7", description: "Spiral winding and circular motion of the material; clamped to 0–2. At 0, circular motion stops while forward travel continues." },
+ { name: "spirals", type: "number", default: "3", description: "Repetitions of the hero ribbons around the tunnel. Rounded to an integer and clamped to 1–6; 1 restores the original density." },
+ { name: "glow", type: "number", default: "1", description: "Brightness of the hero material after halftone; clamped to 0–3." },
+ { name: "depth", type: "number", default: "1", description: "Perspective depth scale; clamped to 0.5–2. Higher values show a deeper section of the tunnel." },
+ { name: "timeOffset", type: "number", default: "0", description: "Starting shader time in seconds. Select another part of the camera path." },
+]} />
+
+## Rendering
+
+The original hero field is rendered into an offscreen texture with the tunnel
+coordinate mapping, followed by the original halftone pass. Exposure is applied
+after halftone. A local Gaussian blur softens the vanishing point, blending
+the field's colors instead of masking out a dark circle. Its influence falls
+off smoothly, keeping the outer ribbons and halftone texture sharp.
+No textures are downloaded and no additional shader package is required.
+
+Time comes exclusively from `useCurrentFrame()` and `fps`, so seeking and offline
+renders reproduce the same frame. WebGL2 is required; allocation, compilation
+and context errors fail explicitly. GPU resources are released when the
+component unmounts, and its render target is resized with the composition.
diff --git a/content/docs/transitions/index.mdx b/content/docs/transitions/index.mdx
index 9dba43e8..0d2af7d1 100644
--- a/content/docs/transitions/index.mdx
+++ b/content/docs/transitions/index.mdx
@@ -40,10 +40,22 @@ Pure CSS-transform physics, no dependencies beyond Remotion.
## Shader
-Textured, organic transitions driven by frame-synced shaders. They install `@paper-design/shaders-react`.
+Textured, organic transitions driven by frame-synced shaders. Most use `@paper-design/shaders-react`; Shader Seam and Shader Spiral Pass use a local OpenShaders export.
<ComponentCardGrid
items={[
+ {
+ name: "ShaderSpiralPass",
+ description: "Fly into a luminous spiral and emerge through its center into the next scene",
+ status: "stable",
+ href: "/docs/transitions/shader-spiral-pass",
+ },
+ {
+ name: "ShaderSeam",
+ description: "Dissolve an OpenShaders material in place to uncover the next scene",
+ status: "stable",
+ href: "/docs/transitions/shader-seam",
+ },
{
name: "GrainDissolve",
description: "Disintegrate the outgoing scene into soft grainy shapes and condense the next out of the noise",
diff --git a/content/docs/transitions/meta.json b/content/docs/transitions/meta.json
index b3da4c7c..18f8fd86 100644
--- a/content/docs/transitions/meta.json
+++ b/content/docs/transitions/meta.json
@@ -5,6 +5,8 @@
"index",
"grain-dissolve",
"wave-wipe",
+ "shader-seam",
+ "shader-spiral-pass",
"ripple-zoom",
"warp-dissolve",
"swirl-dissolve",
diff --git a/content/docs/transitions/shader-seam.mdx b/content/docs/transitions/shader-seam.mdx
new file mode 100644
index 00000000..f9a6bb6a
--- /dev/null
+++ b/content/docs/transitions/shader-seam.mdx
@@ -0,0 +1,95 @@
+---
+title: Shader Seam
+description: Reveal an OpenShaders material, then dissolve it in place to uncover the next scene
+component: shader-seam
+vibe: premium
+length: 60
+useWhen:
+ - "An OpenShaders material should dissolve in place to reveal the next scene."
+ - "A scene change needs an organic disappearance without directional travel."
+avoidWhen:
+ - "A minimal typographic cut is enough — use `caret-wipe`."
+ - "The scenes themselves should be distorted at pixel level — use `displacement`."
+---
+
+<ComponentPreview name="shader-seam" />
+
+<InstallBlock name="shader-seam" />
+
+## Usage
+
+`shaderSeam()` reveals a stationary shader across the frame, exchanges the scenes
+while it is fully opaque, then dissolves it along its own brightness and a soft
+organic texture. Dark areas disappear first; luminous folds linger briefly.
+The shader stays at its original position, rotation and scale throughout.
+The default material is the original [@remocn OpenShaders shader](https://openshaders.com/@remocn),
+including its colored silk field and halftone dots.
+
+```tsx
+import { TransitionSeries, linearTiming } from "@remotion/transitions";
+import { shaderSeam } from "@/components/remocn/shader-seam";
+
+export const MyVideo = () => (
+ <TransitionSeries>
+ <TransitionSeries.Sequence durationInFrames={108}>
+ <SceneA />
+ </TransitionSeries.Sequence>
+ <TransitionSeries.Transition
+ timing={linearTiming({ durationInFrames: 60 })}
+ presentation={shaderSeam({ softness: 0.18, detail: 0.65 })}
+ />
+ <TransitionSeries.Sequence durationInFrames={108}>
+ <SceneB />
+ </TransitionSeries.Sequence>
+ </TransitionSeries>
+);
+```
+
+The shader and dissolve use WebGL2. The scenes remain ordinary React layers;
+they switch beneath the opaque material, so no HTML capture or experimental
+browser flag is needed. The shader is local and adds no network request or extra package.
+Give each scene its own background when you want an opaque cut. Transparent
+areas reveal the composition backdrop. WebGL2 is required; unavailable WebGL or
+invalid shader code produces an explicit render error.
+
+## Props
+
+<PropsTable rows={[
+ { name: "softness", type: "number", default: "0.18", description: "Softness of the dissolve boundary; clamped to 0.02–0.4." },
+ { name: "detail", type: "number", default: "0.65", description: "Organic variation mixed with the shader's brightness; clamped to 0–1. At 0, the dissolve follows brightness alone." },
+ { name: "speed", type: "number", default: "0", description: "Internal shader evolution speed. The default keeps the material still while it dissolves. Set above 0 to animate the shader itself." },
+ { name: "timeOffset", type: "number", default: "0", description: "Starting shader time in seconds. Pick another moment in the same material." },
+ { name: "shader", type: "OpenShaderSource", default: "remocnOpenShader", description: "Local OpenShaders GLSL field and optional postprocessing pass." },
+]} />
+
+## Use another OpenShaders material
+
+Open a profile in [Explore](https://openshaders.com/explore) and select
+**Copy code → React · WebGL**. Copy the exported `FIELD_SHADER` string and, if
+present, `RARITY_SHADER` into a local module. Preserve the source attribution.
+The transition uses the GLSL strings directly; it does not run the exported
+component's animation loop.
+
+```tsx
+import type { OpenShaderSource } from "@/components/remocn/shader-seam";
+import { FIELD_SHADER, RARITY_SHADER } from "./my-openshader";
+
+const material: OpenShaderSource = {
+ field: FIELD_SHADER,
+ postprocess: RARITY_SHADER, // Omit for a plain field.
+};
+
+const transition = shaderSeam({ shader: material, softness: 0.2 });
+```
+
+This adapter supports a self-contained WebGL2 field with OpenShaders' standard
+uniforms (`iResolution`, `iTime`, background colors and `uLightMode`) and an
+optional postprocessing pass reading `tScene`. It renders in dark mode with a
+neutral tilt. Exports needing extra textures, such as the ASCII glyph atlas,
+need an additional adapter and are rejected with a named error. WebGPU source
+and arbitrary profile URLs are not accepted as GLSL.
+
+Use `linearTiming` to supply the transition clock. Appearance, opaque scene
+exchange and dissolution are built into the presentation. The dissolve texture
+is static and shader time comes from progress and duration, so seeking to the
+same frame reproduces the same result.
diff --git a/content/docs/transitions/shader-spiral-pass.mdx b/content/docs/transitions/shader-spiral-pass.mdx
new file mode 100644
index 00000000..a1bf00bb
--- /dev/null
+++ b/content/docs/transitions/shader-spiral-pass.mdx
@@ -0,0 +1,79 @@
+---
+title: Shader Spiral Pass
+description: Fly into the hero spiral and emerge through its soft center into the next scene
+component: shader-spiral-pass
+vibe: premium
+length: 72
+useWhen:
+ - "A scene change should feel like flying through the center of a luminous spiral."
+ - "A product reveal needs a fast, centered shader journey with a soft exit."
+avoidWhen:
+ - "You need a continuous background without a scene change — use `shader-light-tunnel`."
+ - "A subtle camera push is enough — use `push-through`."
+---
+
+<ComponentPreview name="shader-spiral-pass" />
+
+<InstallBlock name="shader-spiral-pass" />
+
+## Usage
+
+`shaderSpiralPass()` covers the outgoing scene with the original hero spiral,
+accelerates the camera straight toward its center, then opens a feathered exit
+onto the next scene. The vanishing point remains centered throughout the move.
+The incoming scene settles as the tunnel passes beyond the frame.
+
+The transition reuses [Light Tunnel](/docs/shaders/components/shader-light-tunnel),
+including its fast inward flow, rotating ribbons, fixed color phase, halftone
+and soft center. Installing the transition installs that dependency as well.
+
+```tsx
+import { TransitionSeries, linearTiming } from "@remotion/transitions";
+import { shaderSpiralPass } from "@/components/remocn/shader-spiral-pass";
+
+export const MyVideo = () => (
+ <TransitionSeries>
+ <TransitionSeries.Sequence durationInFrames={120}>
+ <SceneA />
+ </TransitionSeries.Sequence>
+ <TransitionSeries.Transition
+ timing={linearTiming({ durationInFrames: 72 })}
+ presentation={shaderSpiralPass({ spirals: 3, zoom: 14 })}
+ />
+ <TransitionSeries.Sequence durationInFrames={120}>
+ <SceneB />
+ </TransitionSeries.Sequence>
+ </TransitionSeries>
+);
+```
+
+Use `linearTiming`: camera acceleration, shader coverage and the exit are built
+into the presentation. The default transition takes 72 frames (2.4 seconds at
+30 fps); the preview includes holds before and after it. Give both scenes their
+own opaque backgrounds for a complete scene exchange.
+
+## Props
+
+<PropsTable rows={[
+ { name: "speed", type: "number", default: "1", description: "Shader flow rate, clamped to 0–5. At 0 the material clock stops, but the camera and scene transition still follow presentation progress." },
+ { name: "spirals", type: "number", default: "3", description: "Hero ribbon repetitions, rounded and clamped to 1–6." },
+ { name: "twist", type: "number", default: "0.7", description: "Spiral winding and circular motion, clamped to 0–2." },
+ { name: "zoom", type: "number", default: "14", description: "Camera magnification reached during the pass, clamped to 2–24." },
+ { name: "softness", type: "number", default: "0.12", description: "Maximum exit feather width as a fraction of the shorter composition dimension, clamped to 0.02–0.3. Also capped at 12% of the current opening radius to keep the scene inside the exit." },
+ { name: "timeOffset", type: "number", default: "0", description: "Initial shader time in seconds." },
+]} />
+
+## Rendering
+
+WebGL2 renders the opaque spiral, and a radial mask on the incoming React scene
+confines it to the central exit. The mask stays in screen space while the scene
+scales inside it. Its narrow feather lies inside the opening, so text cannot
+show through the surrounding ribbons. The exit opens during the final 36% of
+the transition. Scenes remain ordinary HTML layers; no screenshots,
+HTML capture or network textures are needed. The outgoing scene is exchanged
+only after the shader fully covers it. The exit expands beyond the diagonal
+of the composition, leaving no shader residue at the end in landscape or portrait.
+
+Time and camera movement derive from transition progress and duration. Seeking
+reproduces the same frame. GPU resources are disposed when the presentation
+ends; WebGL allocation and compilation failures produce explicit render errors.
diff --git a/content/docs/typography/index.mdx b/content/docs/typography/index.mdx
index 955bdc68..d1e94b7e 100644
--- a/content/docs/typography/index.mdx
+++ b/content/docs/typography/index.mdx
@@ -9,6 +9,18 @@ Every way text can move, fade, glitch, or stretch across the screen. From quiet
<ComponentCardGrid
items={[
+ {
+ name: "Inline Word Roll",
+ description: "Roll words upward beside a fixed prefix, smoothly recentering as their widths change",
+ status: "stable",
+ href: "/docs/typography/inline-word-roll",
+ },
+ {
+ name: "Shader Text Reveal",
+ description: "The original OpenShaders hero material reveals words, then settles into white type",
+ status: "stable",
+ href: "/docs/typography/shader-text-reveal",
+ },
{
name: "Type Fossil",
description: "Readable revisions with fine contour layers that compress into one clean typographic imprint",
diff --git a/content/docs/typography/inline-word-roll.mdx b/content/docs/typography/inline-word-roll.mdx
new file mode 100644
index 00000000..41b6f019
--- /dev/null
+++ b/content/docs/typography/inline-word-roll.mdx
@@ -0,0 +1,74 @@
+---
+title: Inline Word Roll
+description: Switch words beside a fixed prefix with an accelerating vertical roll
+component: inline-word-roll
+vibe: clean
+length: 75
+useWhen:
+ - "A headline keeps its opening phrase while cycling through audiences, benefits or outcomes."
+ - "Different word lengths should smoothly recenter the whole line during each switch."
+avoidWhen:
+ - "Every new word should remain in the sentence — use `word-push`."
+ - "Entire phrases should transform letter by letter — use `kinetic-morph-text`."
+---
+
+<ComponentPreview name="inline-word-roll" />
+
+<InstallBlock name="inline-word-roll" />
+
+## Usage
+
+The prefix remains on the baseline while the changing word rolls upward through
+a softly masked slot. The next word arrives from below. The whole line smoothly
+recenters as the word width changes, and successive switches get closer together.
+The first word starts readable and the final word stays on screen.
+
+```tsx
+import { AbsoluteFill } from "remotion";
+import { InlineWordRoll } from "@/components/remocn/inline-word-roll";
+
+export const Headline = () => (
+ <AbsoluteFill style={{ background: "#000" }}>
+ <InlineWordRoll
+ prefix="Looking for"
+ text="leads | customers | subscribers | appointments | demos | quotes | registrants | trials | conversions"
+ suffix="?"
+ />
+ </AbsoluteFill>
+);
+```
+
+The default sequence finishes moving at frame 75. The demo adds a 30-frame final
+hold. All durations use composition frames; at 30 fps the movement takes about
+2.5 seconds. Set `acceleration={1}` for a steady pace. Faster intervals never
+become shorter than the roll itself, so transitions cannot overlap.
+
+Words and phrases are separated by `|` or newlines. Spaces inside a phrase are
+preserved. Empty entries are ignored. The component has a transparent background;
+add your own scene or texture behind it.
+
+## Props
+
+<PropsTable rows={[
+ { name: "prefix", type: "string", default: '"Looking for"', description: "Text that stays on the baseline. Its horizontal position follows the changing total width." },
+ { name: "text", type: "string", default: '"leads | customers | … | conversions"', description: "Words or phrases separated by | or newlines." },
+ { name: "suffix", type: "string", default: '"?"', description: "Appended to every changing word and rolls with it." },
+ { name: "fontSize", type: "number", default: "60", description: "Font size in composition pixels. The whole line scales down to fit the longest phrase within 84% of frame width." },
+ { name: "fontFamily", type: "string", default: '"Arial, Helvetica, sans-serif"', description: "Font family. Load custom font faces in your composition; measurement waits for the selected face." },
+ { name: "fontWeight", type: "number", default: "400", description: "Font weight." },
+ { name: "color", type: "string", default: '"#f5f5f5"', description: "Text color." },
+ { name: "interval", type: "number", default: "12", description: "Initial frames between switch starts. Also the first-word hold; never shorter than transitionFrames." },
+ { name: "acceleration", type: "number", default: "0.9", description: "Multiplier for each following interval, clamped to 0.5–1. Lower values accelerate faster; 1 gives constant timing." },
+ { name: "transitionFrames", type: "number", default: "6", description: "Duration of each upward roll, clamped to at least 1 frame." },
+]} />
+
+For custom sequences, `getInlineWordRollDuration({ text, interval, acceleration,
+transitionFrames })` returns the number of frames until the last word settles.
+Add your desired hold when choosing the composition or Sequence duration.
+A single phrase needs no transition and returns 0.
+
+Widths are measured in unscaled composition pixels after fonts load and again
+when the text or font changes, preserving layout inside resized Players.
+The same scale is used for every word, preventing font-size jumps. All movement
+comes from Remotion frames; seeking directly to a switch reproduces the same
+layout. No CSS animation clock or WebGL context is required.
diff --git a/content/docs/typography/meta.json b/content/docs/typography/meta.json
index 941f4c4d..bbccfaf1 100644
--- a/content/docs/typography/meta.json
+++ b/content/docs/typography/meta.json
@@ -3,6 +3,8 @@
"defaultOpen": true,
"pages": [
"index",
+ "inline-word-roll",
+ "shader-text-reveal",
"type-fossil",
"soft-blur-in",
"per-character-rise",
diff --git a/content/docs/typography/shader-text-reveal.mdx b/content/docs/typography/shader-text-reveal.mdx
new file mode 100644
index 00000000..9be8cd39
--- /dev/null
+++ b/content/docs/typography/shader-text-reveal.mdx
@@ -0,0 +1,64 @@
+---
+title: Shader Text Reveal
+description: Reveal words through the original OpenShaders hero material, then settle into white type
+component: shader-text-reveal
+vibe: premium
+length: 48
+useWhen:
+ - "A short headline needs the hero shader reveal, one word at a time."
+ - "The hero material should appear inside letters before they settle into white."
+avoidWhen:
+ - "A quiet text entrance is enough — use `soft-blur-in`."
+ - "Words should physically morph into each other — use `kinetic-morph-text`."
+---
+
+<ComponentPreview name="shader-text-reveal" />
+
+<InstallBlock name="shader-text-reveal" />
+
+## Usage
+
+The original [@remocn OpenShaders shader](https://openshaders.com/@remocn) from the
+site's hero fills the letters, including its magenta-violet field and halftone
+texture. A reveal exposes the material, then leaves clean white type. A diagonal
+dark wave removes the word before the next one appears. The final word stays
+visible. The hero field and halftone GLSL are included unchanged; Remotion drives
+their clock and a separate compositing pass applies the text shape and timing.
+
+```tsx
+import { AbsoluteFill } from "remotion";
+import { ShaderTextReveal } from "@/components/remocn/shader-text-reveal";
+
+export const Headline = () => (
+ <AbsoluteFill style={{ background: "#000" }}>
+ <ShaderTextReveal text="Your product" wordDuration={30} />
+ </AbsoluteFill>
+);
+```
+
+At 30 fps the default shows **Your** during the first second and **product**
+during the second. Give the composition at least 60 frames; 75 frames includes
+a short final hold. Animation timing is measured in frames. For N words,
+allocate at least `(N - 1) * wordDuration + 0.6 * wordDuration` frames, then add
+any hold you need.
+
+Space-separated text plays word by word. Use newlines to keep phrases together:
+`text={"Your product\nOne clear story"}`. Blank lines are ignored.
+
+## Props
+
+<PropsTable rows={[
+ { name: "text", type: "string", default: '"Your product"', description: "Words, or newline-separated phrases, shown in sequence." },
+ { name: "fontSize", type: "number", default: "400", description: "Maximum font size in composition pixels. Text automatically fits within 72% of the frame width and a font-size cap of 58% of its height." },
+ { name: "fontFamily", type: "string", default: '"Arial, sans-serif"', description: "Canvas font family. Load custom font faces in your composition; rendering waits for the selected font." },
+ { name: "fontWeight", type: "number", default: "500", description: "Font weight." },
+ { name: "wordDuration", type: "number", default: "30", description: "Frames per word, rounded and clamped to at least 12. The final word remains after its entrance." },
+ { name: "intensity", type: "number", default: "1", description: "Original hero material and subtle refraction; clamped to 0–1. At 0, the reveal uses white letters." },
+]} />
+
+The background is transparent. A black backdrop matches the preview; the shader
+can also be composed over other layers. Text is rasterized once per font or
+content change and uploaded when the active word changes. GLSL controls the
+hero field, halftone texture, reveal, exit and local refraction. All timing comes from Remotion
+frames, so seeking is deterministic. WebGL2 is required; shader or font errors
+fail the render explicitly.
diff --git a/docs/plans/2026-09-09-inline-word-roll-design.md b/docs/plans/2026-09-09-inline-word-roll-design.md
new file mode 100644
index 00000000..8452a16c
--- /dev/null
+++ b/docs/plans/2026-09-09-inline-word-roll-design.md
@@ -0,0 +1,19 @@
+# Inline Word Roll
+
+Reference: seconds 1–4 of user-provided zBcFAFAZZryzvwMy.mp4. Recreate only the
+word switching as a separate registry primitive. Fixed prefix "Looking for",
+changing leads/customers/subscribers/appointments/demos/quotes/registrants/trials/
+conversions, with a question mark attached to each word. Outgoing text rolls up;
+incoming text arrives from below through a vertically masked one-line window.
+Smoothly center the phrase as word widths change. Accelerate successive switches.
+
+Transparent React/Remotion primitive, no dependency on previous shader items.
+Measure real DOM text widths after font load. Use one stable fit scale based on
+the longest phrase, interpolate line width during switches, and derive each
+pair and its progress directly from the frame. No cumulative state or CSS clock.
+Default interval 12 frames, multiplier 0.9, roll duration 6. Prevent overlapping
+rolls by flooring intervals to the transition length. Final word holds.
+
+Ship source, controls, docs, navigation, changelog, preview registration and both
+registry artifacts. Verify timing endpoints, acceleration, reverse seeking,
+portrait fit, render and types. Keep the dev server stopped and show the MP4.
diff --git a/docs/plans/2026-09-09-shader-light-tunnel-design.md b/docs/plans/2026-09-09-shader-light-tunnel-design.md
new file mode 100644
index 00000000..43aab386
--- /dev/null
+++ b/docs/plans/2026-09-09-shader-light-tunnel-design.md
@@ -0,0 +1,47 @@
+# Shader Light Tunnel
+
+Use the original @remocn hero field and halftone GLSL. The user requested that
+only its mapping be adapted to straight tunnel flight. Preserve the original
+field equations, constants and colors. Replace the field's position input with
+a cylindrical perspective mapping: angle wraps seamlessly with sin/cos, depth
+comes from inverse screen radius, and time advances world Z. No camera X/Y
+translation, gaze drift or roll. Keep a fixed central vanishing point.
+
+Make circular motion more visible with an explicit time-based rotation of the
+material in addition to winding along Z. Use (0.3 * z + 1.5 * time) * twist,
+giving about 75 degrees per second at default speed and twist. Twist zero removes
+the angular motion; speed zero freezes all motion. Keep the original hero field
+and halftone source intact and do not rotate the camera or screen-space dots.
+
+Repeat the angular mapping three times by default to add more spiral ribbons.
+Multiply the whole angle (including its time term) by an integer `spirals`,
+clamped to 1–6, so density changes preserve rotation speed and remain seamless.
+This reuses the same hero evaluation per pixel; no extra field passes.
+
+Hold the original hero material at time zero to remove its animated color and
+breathing cycle, which dims the ribbons over time. In the adapter, rename its
+time input to a constant material phase and give the tunnel mapping its own
+frame-driven time. Keep the original hero GLSL constants intact. Rotation and
+forward travel continue; the material no longer progresses into darker phases.
+
+Add inward flow on top of rotation with a logarithmic radial phase:
+5 * log(radius / (0.55 * depth)) + 12 * time. Drive the sampling ring and its
+offset with this phase, moving folds toward the center at r(t) = r(0) * exp(-2.4t).
+The user requested a faster flow after reviewing the reference's 1–3 second
+segment. Use four times the initial inward speed, reaching one tenth of the
+starting radius in about 0.96 seconds; leave the angular speed unchanged.
+Keep this independent of twist so inward motion works with rotation disabled.
+Use coordinate deformation only, preserving the fixed color phase and exposure.
+
+Render the adapted hero field into an offscreen texture, then run the original
+halftone pass. Replace the dark center mask with a local 5x5 Gaussian blur of
+the field texture (sigma 0.025 of composition height). Prefilter taps with
+generated mipmaps to prevent high-frequency spiral ghosting. Blend it over halftone
+with a Gaussian center weight (sigma 0.065), removing the outlined hole without
+blurring the outer ribbons. Apply optional exposure. Dispose GPU resources and resize the
+render target as necessary. Remove the previous custom volume shader and color
+palette controls. Props are speed, twist, spirals, glow, depth and timeOffset.
+
+Verify GLSL identity of the retained hero source, GPU rendering, deterministic
+seeking, speed-zero freezing, portrait and perspective extremes. Update source,
+controls, documentation, changelog and generated registry artifacts.
diff --git a/docs/plans/2026-09-09-shader-seam-design.md b/docs/plans/2026-09-09-shader-seam-design.md
new file mode 100644
index 00000000..a87f36c9
--- /dev/null
+++ b/docs/plans/2026-09-09-shader-seam-design.md
@@ -0,0 +1,18 @@
+# Shader Seam
+
+The latest direction replaces travel with disappearance. Preserve the original
+OpenShaders field and halftone GLSL, at its original position, scale and rotation.
+Default shader speed to zero. Reveal the shader with an organic density threshold,
+exchange the React scenes during a fully opaque interval, then dissolve the
+material in place. Bright folds survive longer than dark areas. Static smooth
+noise breaks up the density without a moving edge, floating particles or trails.
+
+Use a frame-derived phase: appearance ends at 0.34, scene exchange at 0.4,
+dissolve begins at 0.46 and ends at 1. Keep a fully opaque interval around the
+exchange so the scenes never visibly jump. Render only one WebGL canvas on the
+entering layer. No readPixels, raster scene masks or HTML capture are needed.
+
+Keep shaderSeam() and the OpenShaderSource adapter. Replace direction, width and
+distortion with softness (0.02–0.4, default 0.18) and detail (0–1, default 0.65).
+Verify endpoint visibility, opaque exchange, deterministic seeking, full GPU
+render, portrait and alternate shaders. Update controls, docs and registry output.
diff --git a/docs/plans/2026-09-09-shader-spiral-pass-design.md b/docs/plans/2026-09-09-shader-spiral-pass-design.md
new file mode 100644
index 00000000..79d2d5fc
--- /dev/null
+++ b/docs/plans/2026-09-09-shader-spiral-pass-design.md
@@ -0,0 +1,25 @@
+# Shader Spiral Pass
+
+Create a separate TransitionSeries presentation using the existing Light Tunnel
+material. The camera follows the centered axis into the spiral and exits into
+the next scene. Preserve the fixed color phase, fast inward flow and soft center.
+
+Reuse the GPU renderer through a registry dependency instead of duplicating the
+hero GLSL. Add an optional camera zoom argument with default 1 so the background
+retains its current rendering. The transition sets it from a smooth accelerating
+progress curve. Shader time also accelerates continuously as the camera dives.
+
+Cover the current scene by progress 0.18; exchange the React layers at 0.2 while
+the shader is opaque. At 0.64 start opening a soft central aperture, expanding
+beyond the composition diagonal by progress 1. Mask the incoming scene itself
+over the opaque shader, with the feather confined inside the opening and capped
+at 12% of its radius. Apply scene scale inside the mask so it cannot expand the
+visible aperture. This prevents content leaking through the surrounding ribbons.
+Only the entering presentation renders a WebGL canvas. Exact endpoints contain
+only their corresponding scenes. Derive all animation from presentation progress.
+
+Use 72 frames at 30 fps for the transition, with 48-frame holds on both sides
+in the 168-frame preview. Expose speed, spirals, twist, zoom, softness and timeOffset.
+Add docs, a two-scene example, preview registration, changelog and build artifacts.
+Verify endpoint coverage, deterministic seeking, portrait exit coverage, WebGL
+compilation and the existing Light Tunnel background's unchanged default output.
diff --git a/docs/plans/2026-09-09-shader-text-reveal-design.md b/docs/plans/2026-09-09-shader-text-reveal-design.md
new file mode 100644
index 00000000..5950d01e
--- /dev/null
+++ b/docs/plans/2026-09-09-shader-text-reveal-design.md
@@ -0,0 +1,24 @@
+# Shader Text Reveal
+
+Reference: the first two seconds of the user-supplied v65cbn8n2DVV1tKi.mp4.
+Show "Your", then "product", centered on black, about one second per word.
+The user selected the existing @remocn hero shader as the letter material.
+Preserve its original field and halftone GLSL, using a separate composite pass
+for the reference-inspired reveal and exit, leaving a pale white surface.
+A diagonal dark wave clears the first word. The final word holds.
+
+Implement a typography primitive, ShaderTextReveal. Rasterize each word into a
+transparent canvas texture after its font loads. Use a custom WebGL2 fragment
+shader for the spatial reveal, the original hero field and halftone material,
+localized refraction and exit. The OpenShaders material is clipped to the letters, with no background overlay. Use a small scale settle, with no directional text travel.
+
+The canvas is transparent. A demo backdrop supplies black. Auto-fit text within
+72% of frame width; use fontSize as a maximum. Space-separated input gives words;
+newlines give phrases. Default wordDuration 30 frames, intensity 1, fontSize 400.
+Timing is deterministic from useCurrentFrame. Prepare textures once, upload only
+on word changes, dispose GPU resources on teardown, and fail explicit render
+errors. Preserve the earlier shader-seam experiment separately.
+
+Validate reference frame comparisons, transition boundaries, repeated-frame
+identity, text fitting, portrait, registry output, typecheck and docs metadata.
+Keep the dev server stopped as requested; deliver the rendered MP4 directly.
diff --git a/registry-artifacts/elements/inline-word-roll.json b/registry-artifacts/elements/inline-word-roll.json
new file mode 100644
index 00000000..99a3cae2
--- /dev/null
+++ b/registry-artifacts/elements/inline-word-roll.json
@@ -0,0 +1,14 @@
+{
+ "type": "remotion-element",
+ "version": 1,
+ "element": {
+ "dependencies": [],
+ "dimensions": null,
+ "displayName": "Inline Word Roll",
+ "durationInFrames": 75,
+ "installationMode": "component-owned-sequence",
+ "slug": "inline-word-roll",
+ "sourceCode": "import { forwardRef, useImperativeHandle, useLayoutEffect, useRef, useState, type ComponentProps } from \"react\";\nimport { Easing, Interactive, Sequence, useCurrentFrame, useDelayRender, useVideoConfig, type InteractiveBaseProps, type InteractiveTransformProps, type InteractivitySchema, type SequenceControls } from \"remotion\";\n\ninterface InlineWordRollProps {\n prefix?: string;\n /** Separate words or phrases with | or newlines. */\n text?: string;\n suffix?: string;\n fontSize?: number;\n fontFamily?: string;\n fontWeight?: number;\n color?: string;\n /** Initial interval between switches, in frames. */\n interval?: number;\n /** Each following interval is multiplied by this number; 1 keeps a steady pace. */\n acceleration?: number;\n transitionFrames?: number;\n}\n\nconst inlineWordRollDefaultText =\n \"leads | customers | subscribers | appointments | demos | quotes | registrants | trials | conversions\";\n\nconst parseInlineWords = (text: string) =>\n text\n .split(/[|\\n\\r]+/)\n .map((word) => word.trim())\n .filter(Boolean);\n\nconst finite = (value: number, fallback: number) =>\n Number.isFinite(value) ? value : fallback;\nconst clamp = (n: number) => Math.max(0, Math.min(1, n));\nconst ease = Easing.bezier(0.22, 0.75, 0.25, 1);\n\nfunction getInlineWordRollState(\n frame: number,\n count: number,\n interval = 12,\n acceleration = 0.9,\n transitionFrames = 6,\n) {\n const transition = Math.max(1, finite(transitionFrames, 6));\n const gap = Math.max(transition, finite(interval, 12));\n const rate = Math.min(1, Math.max(0.5, finite(acceleration, 0.9)));\n const f = Math.max(0, finite(frame, 0));\n let start = 0;\n for (let index = 1; index < count; index++) {\n start += Math.max(transition, gap * rate ** (index - 1));\n if (f < start) return { from: index - 1, to: index - 1, progress: 1 };\n if (f < start + transition)\n return {\n from: index - 1,\n to: index,\n progress: clamp((f - start) / transition),\n };\n }\n const last = Math.max(0, count - 1);\n return { from: last, to: last, progress: 1 };\n}\n\nfunction getInlineWordRollDuration({\n text = inlineWordRollDefaultText,\n interval = 12,\n acceleration = 0.9,\n transitionFrames = 6,\n}: Pick<\n InlineWordRollProps,\n \"text\" | \"interval\" | \"acceleration\" | \"transitionFrames\"\n> = {}) {\n const count = parseInlineWords(text).length;\n const transition = Math.max(1, finite(transitionFrames, 6));\n const gap = Math.max(transition, finite(interval, 12));\n const rate = Math.min(1, Math.max(0.5, finite(acceleration, 0.9)));\n let total = 0;\n for (let index = 0; index < count - 1; index++)\n total += Math.max(transition, gap * rate ** index);\n return count < 2 ? 0 : Math.ceil(total + transition);\n}\n\nfunction InlineWordRollBase({\n prefix = \"Looking for\",\n text = inlineWordRollDefaultText,\n suffix = \"?\",\n fontSize = 60,\n fontFamily = \"Arial, Helvetica, sans-serif\",\n fontWeight = 400,\n color = \"#f5f5f5\",\n interval = 12,\n acceleration = 0.9,\n transitionFrames = 6,\n}: InlineWordRollProps) {\n const frame = useCurrentFrame();\n const { width, height } = useVideoConfig();\n const { delayRender, continueRender, cancelRender } = useDelayRender();\n const words = parseInlineWords(text);\n const measurement = useRef<HTMLDivElement>(null);\n const pending = useRef<number | null>(null);\n const [metrics, setMetrics] = useState<{\n prefix: number;\n words: number[];\n } | null>(null);\n const size = Math.max(1, finite(fontSize, 60));\n const typography = {\n fontFamily,\n fontSize: size,\n fontWeight,\n letterSpacing: \"-0.035em\",\n lineHeight: 1.2,\n whiteSpace: \"pre\" as const,\n };\n\n useLayoutEffect(() => {\n let cancelled = false;\n const handle = delayRender(\"Measure Inline Word Roll font\");\n pending.current = handle;\n void document.fonts\n .load(\n `${fontWeight} ${size}px ${fontFamily}`,\n `${prefix} ${text}${suffix}`,\n )\n .then(() => {\n if (cancelled || !measurement.current) return;\n const children = Array.from(measurement.current.children);\n // Computed widths are in composition pixels. Bounding rectangles include\n // the Player's preview scale and would shrink our layout a second time.\n const measure = (node: Element) =>\n Number.parseFloat(getComputedStyle(node).width);\n setMetrics({\n prefix: measure(children[0]),\n words: children.slice(1).map(measure),\n });\n })\n .catch((error: unknown) => {\n if (!cancelled)\n cancelRender(\n error instanceof Error ? error : new Error(String(error)),\n );\n });\n return () => {\n cancelled = true;\n continueRender(handle);\n if (pending.current === handle) pending.current = null;\n };\n }, [\n prefix,\n text,\n suffix,\n size,\n fontFamily,\n fontWeight,\n delayRender,\n continueRender,\n cancelRender,\n ]);\n\n useLayoutEffect(() => {\n if (metrics && pending.current !== null) {\n continueRender(pending.current);\n pending.current = null;\n }\n }, [metrics, continueRender]);\n\n const state = getInlineWordRollState(\n frame,\n words.length,\n interval,\n acceleration,\n transitionFrames,\n );\n const moving = state.from !== state.to;\n const p = ease(state.progress);\n const gap = prefix ? size * 0.23 : 0;\n const prefixWidth = metrics?.prefix ?? 0;\n const fromWidth = metrics?.words[state.from] ?? 0;\n const toWidth = metrics?.words[state.to] ?? 0;\n const slotWidth = fromWidth + (toWidth - fromWidth) * p;\n const totalWidth = prefixWidth + gap + slotWidth;\n const widest = prefixWidth + gap + Math.max(0, ...(metrics?.words ?? []));\n const fit = Math.min(\n 1,\n (width * 0.84) / Math.max(1, widest),\n (height * 0.5) / (size * 1.2),\n );\n const rowHeight = size * 1.2;\n\n return (\n <div\n role=\"img\"\n aria-label={[prefix, words[state.to] ? `${words[state.to]}${suffix}` : \"\"]\n .filter(Boolean)\n .join(\" \")}\n style={{ position: \"absolute\", inset: 0, overflow: \"hidden\", color }}\n >\n <div\n ref={measurement}\n aria-hidden=\"true\"\n style={{\n ...typography,\n position: \"absolute\",\n visibility: \"hidden\",\n pointerEvents: \"none\",\n }}\n >\n <span style={{ display: \"inline-block\" }}>{prefix}</span>\n {words.map((word, index) => (\n <span key={`${index}:${word}`} style={{ display: \"inline-block\" }}>\n {word}\n {suffix}\n </span>\n ))}\n </div>\n <div\n aria-hidden=\"true\"\n style={{\n position: \"absolute\",\n left: \"50%\",\n top: \"50%\",\n scale: fit,\n visibility: metrics && words.length ? \"visible\" : \"hidden\",\n }}\n >\n <div\n style={{\n ...typography,\n position: \"absolute\",\n left: -totalWidth / 2,\n top: -rowHeight / 2,\n height: rowHeight,\n }}\n >\n <span style={{ position: \"absolute\", left: 0 }}>{prefix}</span>\n <div\n style={{\n position: \"absolute\",\n left: prefixWidth + gap,\n top: 0,\n width: Math.max(fromWidth, toWidth) + size * 0.12,\n height: rowHeight,\n overflow: \"hidden\",\n maskImage:\n \"linear-gradient(to bottom, transparent, black 12%, black 88%, transparent)\",\n }}\n >\n <span\n style={{\n position: \"absolute\",\n left: 0,\n top: 0,\n translate: `0 ${moving ? -p * rowHeight : 0}px`,\n opacity: moving ? 1 - clamp(p * 1.2) : 1,\n }}\n >\n {words[state.from]}\n {words.length ? suffix : \"\"}\n </span>\n {moving ? (\n <span\n style={{\n position: \"absolute\",\n left: 0,\n top: 0,\n translate: `0 ${(1 - p) * rowHeight}px`,\n opacity: clamp(p * 1.6),\n }}\n >\n {words[state.to]}\n {suffix}\n </span>\n ) : null}\n </div>\n </div>\n </div>\n </div>\n );\n}\n\nconst elementSchema = {\n ...Interactive.baseSchema,\n prefix: {\n type: \"text-content\",\n default: \"Looking for\",\n description: \"Fixed text\",\n },\n text: {\n type: \"text-content\",\n default: \"leads | customers | subscribers | appointments | demos | quotes | registrants | trials | conversions\",\n description: \"Words separated by |\",\n },\n suffix: {\n type: \"text-content\",\n default: \"?\",\n description: \"Word suffix\",\n },\n fontSize: {\n type: \"number\",\n default: 60,\n min: 16,\n max: 160,\n step: 1,\n description: \"Font size\",\n hiddenFromList: false,\n },\n interval: {\n type: \"number\",\n default: 12,\n min: 6,\n max: 60,\n step: 1,\n description: \"Initial frames per word\",\n hiddenFromList: false,\n },\n acceleration: {\n type: \"number\",\n default: 0.9,\n min: 0.5,\n max: 1,\n step: 0.01,\n description: \"Interval multiplier\",\n hiddenFromList: false,\n },\n transitionFrames: {\n type: \"number\",\n default: 6,\n min: 1,\n max: 20,\n step: 1,\n description: \"Roll duration\",\n hiddenFromList: false,\n },\n color: {\n type: \"color\",\n default: \"#f5f5f5\",\n description: \"Color\",\n },\n speed: {\n type: \"number\",\n default: 1,\n min: 0.25,\n max: 4,\n step: 0.25,\n description: \"Speed\",\n hiddenFromList: false,\n },\n ...Interactive.transformSchema,\n} as const satisfies InteractivitySchema;\n\nconst ELEMENT_PROP_KEYS = new Set([\"prefix\",\"text\",\"suffix\",\"fontSize\",\"interval\",\"acceleration\",\"transitionFrames\",\"color\",\"speed\"]);\n\nconst ELEMENT_PROP_DEFAULTS: Record<string, unknown> = {\n prefix: \"Looking for\",\n text: \"leads | customers | subscribers | appointments | demos | quotes | registrants | trials | conversions\",\n suffix: \"?\",\n fontSize: 60,\n interval: 12,\n acceleration: 0.9,\n transitionFrames: 6,\n color: \"#f5f5f5\",\n speed: 1,\n};\n\ntype InlineWordRollElementProps = InteractiveBaseProps &\n InteractiveTransformProps &\n ComponentProps<typeof InlineWordRollBase>;\n\nconst InlineWordRollInner = forwardRef<\n HTMLDivElement,\n InlineWordRollElementProps & { readonly controls: SequenceControls | undefined }\n>(({ controls, name, style, ...rest }, ref) => {\n const outlineRef = useRef<HTMLDivElement>(null);\n useImperativeHandle(ref, () => outlineRef.current as HTMLDivElement, []);\n const componentProps: Record<string, unknown> = { ...ELEMENT_PROP_DEFAULTS };\n const sequenceProps: Record<string, unknown> = {};\n for (const [key, value] of Object.entries(rest)) {\n if (ELEMENT_PROP_KEYS.has(key)) {\n if (value !== undefined) componentProps[key] = value;\n } else {\n sequenceProps[key] = value;\n }\n }\n return (\n <Sequence\n layout=\"none\"\n {...sequenceProps}\n controls={controls}\n name={name ?? \"<InlineWordRoll>\"}\n outlineRef={outlineRef}\n >\n <div\n ref={outlineRef}\n style={{\n position: \"relative\",\n width: \"100%\",\n height: \"100%\",\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n ...style,\n }}\n >\n <InlineWordRollBase\n {...(componentProps as unknown as ComponentProps<typeof InlineWordRollBase>)}\n />\n </div>\n </Sequence>\n );\n});\n\nexport const InlineWordRoll = Interactive.withSchema({\n Component: InlineWordRollInner,\n componentName: \"<InlineWordRoll>\",\n componentIdentity: null,\n schema: elementSchema,\n supportsEffects: false,\n});\n"
+ },
+ "durationInFrames": 75
+}
diff --git a/registry-artifacts/elements/shader-light-tunnel.json b/registry-artifacts/elements/shader-light-tunnel.json
new file mode 100644
index 00000000..bbc31204
--- /dev/null
+++ b/registry-artifacts/elements/shader-light-tunnel.json
@@ -0,0 +1,14 @@
+{
+ "type": "remotion-element",
+ "version": 1,
+ "element": {
+ "dependencies": [],
+ "dimensions": null,
+ "displayName": "Light Tunnel",
+ "durationInFrames": 90,
+ "installationMode": "component-owned-sequence",
+ "slug": "shader-light-tunnel",
+ "sourceCode": "import { forwardRef, useImperativeHandle, useLayoutEffect, useRef, type ComponentProps } from \"react\";\nimport { Interactive, Sequence, useCurrentFrame, useDelayRender, useVideoConfig, type InteractiveBaseProps, type InteractiveTransformProps, type InteractivitySchema, type SequenceControls } from \"remotion\";\n\ninterface ShaderLightTunnelProps {\n speed?: number;\n /** Spiral winding and circular motion of the material, from 0 to 2. */\n twist?: number;\n /** Repetitions of the hero ribbons around the tunnel, integer from 1 to 6. */\n spirals?: number;\n /** Exposure of the original hero material, from 0 to 3. */\n glow?: number;\n /** Camera perspective, from 0.5 to 2. */\n depth?: number;\n /** Starting shader time, in seconds. */\n timeOffset?: number;\n}\n\nconst VERTEX = `#version 300 es\nvoid main() {\n vec2 p = vec2(float((gl_VertexID << 1) & 2), float(gl_VertexID & 2));\n gl_Position = vec4(p * 2.0 - 1.0, 0.0, 1.0);\n}`;\n\n/* @remocn · OpenShaders — https://openshaders.com/@remocn\n * Original hero field and halftone source. The tunnel adapter only remaps\n * sampling coordinates, holds the material phase, and applies exposure.\n */\nconst HERO_FIELD = `#version 300 es\nprecision highp float;\n\nuniform vec2 iResolution;\nuniform float iTime;\nuniform float uLightMode;\nuniform vec3 uDarkBackground;\nuniform vec3 uLightBackground;\nout vec4 fragColor;\n\nconst float HUE = 0.663466752;\nconst float HUE_SPREAD = 0.314346701;\nconst float HUE_TRAVEL = 1.65112376;\nconst float CHROMA = 0.160295546;\nconst float LIGHTNESS = 0.537409723;\nconst float COLOUR_CYCLE = 0.124862425;\nconst float THETA = 2.12986207;\nconst float SHEAR = 0.968176901;\nconst float SHRINK = 0.955401778;\nconst float LAYERS = 72.0;\nconst float WARP_FREQ_X = 0.439311415;\nconst float WARP_FREQ_Y = 2.87923527;\nconst float WARP_AMP_X = 0.156202048;\nconst float WARP_AMP_Y = 0.0256033838;\nconst float ASPECT_X = 2.23183894;\nconst float ASPECT_Y = 0.15731883;\nconst float OFFSET_X = 0.375628948;\nconst float OFFSET_Y = -0.017801486;\nconst float TILT = 1.63293767;\nconst float ZOOM = 0.93135649;\nconst float CENTRE_X = -0.0956316143;\nconst float CENTRE_Y = -0.520057321;\nconst float GLOW_SIZE = 0.00201825937;\nconst float FALLOFF = 0.352821857;\nconst float VIGNETTE = 0.136085436;\nconst float FLOW_SPEED = 0.391012281;\nconst float FLOW_DIRECTION = 1.0;\nconst float BREATH_RATE = 0.382053256;\nconst float BREATH_AMOUNT = 0.0873704553;\nconst float PHASE = 56.3862724;\nconst float ECHO = 0.0;\nconst float ECHO_SHIFT = 0.178754866;\nconst float SOFTNESS = 0.00164903817;\nconst float LIGHT_SWING = 0.149726808;\n\nconst float TAU = 6.28318530718;\n\nvec3 oklchToLinear(float L, float C, float h) {\n float a = C * cos(h), b = C * sin(h);\n float l_ = L + 0.3963377774 * a + 0.2158037573 * b;\n float m_ = L - 0.1055613458 * a - 0.0638541728 * b;\n float s_ = L - 0.0894841775 * a - 1.2914855480 * b;\n vec3 lms = vec3(l_, m_, s_);\n lms = lms * lms * lms;\n return mat3(4.0767416621, -1.2684380046, -0.0041960863,\n -3.3077115913, 2.6097574011, -0.7034186147,\n 0.2309699292, -0.3413193965, 1.7076147010) * lms;\n}\n\nfloat blueNoise(vec2 p, float frame) {\n p += 5.588238 * mod(frame, 64.0);\n return fract(52.9829189 * fract(0.06711056 * p.x + 0.00583715 * p.y));\n}\n\nvoid main() {\n vec2 R = iResolution.xy;\n vec2 pos = (gl_FragCoord.xy - 0.5 * R) / R.y;\n float t = iTime * FLOW_SPEED * FLOW_DIRECTION + PHASE;\n float breath = (-sin(iTime * BREATH_RATE * 1.5) + sin(iTime * BREATH_RATE + 1.0)) * 0.25 + 0.5;\n\n vec2 u = (pos - vec2(CENTRE_X, CENTRE_Y)) * (ZOOM - breath * BREATH_AMOUNT);\n float ct = cos(TILT), st = sin(TILT);\n u = mat2(ct, st, -st, ct) * u;\n\n mat2 fold = mat2(cos(THETA), sin(THETA), -SHEAR, cos(THETA));\n\n float hue0 = HUE * TAU;\n float hue1 = hue0 + HUE_SPREAD * TAU;\n vec3 color = vec3(0.0);\n\n for (float i = 1.0; i <= 96.0; i += 1.0) {\n if (i > LAYERS) break;\n u.x += -sin(u.y * WARP_FREQ_X + t + i * 0.007) * WARP_AMP_X;\n u.y += -sin(u.x * WARP_FREQ_Y - t + i * 0.02) * WARP_AMP_Y;\n u = fold * u * SHRINK;\n\n vec2 q = u - vec2(OFFSET_X + breath * 0.1, OFFSET_Y);\n vec2 s = vec2(q.x * ASPECT_X, q.y * ASPECT_Y);\n float glow = GLOW_SIZE / (dot(s, s) + SOFTNESS);\n#ifndef SKIP_ECHO\n vec2 e = vec2((q.x - ECHO_SHIFT) * ASPECT_X, s.y);\n glow += ECHO * GLOW_SIZE / (dot(e, e) + SOFTNESS);\n#endif\n glow *= 0.25 + breath * 0.4;\n\n float r = length(u);\n float k = sin(i * COLOUR_CYCLE + t * 1.2 + r * HUE_TRAVEL) * 0.5 + 0.5;\n vec3 tint = clamp(oklchToLinear(LIGHTNESS + LIGHT_SWING * k, CHROMA * (0.75 + 0.35 * k), mix(hue0, hue1, k)), 0.0, 1.0);\n color += glow * tint * exp2(-r * FALLOFF);\n }\n\n vec3 x = max(color, 0.0);\n color = (x * (2.51 * x + 0.03)) / (x * (2.43 * x + 0.59) + 0.14);\n color = pow(clamp(color, 0.0, 1.0), vec3(0.85, 0.92, 0.98));\n\n float edge = smoothstep(0.5, 1.6, length(pos));\n color *= 1.0 - edge * VIGNETTE;\n\n vec3 dark = uDarkBackground + color * (1.0 - uDarkBackground);\n float strength = max(color.r, max(color.g, color.b));\n vec3 light = uLightBackground * (1.0 - strength) + color * 0.96;\n color = mix(dark, light, uLightMode);\n\n color += (blueNoise(gl_FragCoord.xy, floor(iTime * 24.0)) - 0.5) / 255.0;\n fragColor = vec4(clamp(color, 0.0, 1.0), 1.0);\n}\n`;\n\nconst HERO_HALFTONE = `#version 300 es\nprecision highp float;\n\nuniform sampler2D tScene;\nuniform vec2 iResolution;\nuniform float iTime;\nuniform float uLightMode;\nuniform vec3 uDarkBackground;\nuniform vec3 uLightBackground;\nuniform float uPixelRatio;\nout vec4 fragColor;\n\nconst float uStrength = 0.797335207;\nconst float uScale = 0.985214949;\nconst float uSeed = 0.435611069;\n\nconst float TAU = 6.28318530718;\nconst vec3 LUMA = vec3(0.2126, 0.7152, 0.0722);\n\nvec3 toInk(vec3 c) { return mix(c - uDarkBackground, uLightBackground - c, uLightMode); }\nvec3 fromInk(vec3 ink) { return mix(uDarkBackground + ink, uLightBackground - ink, uLightMode); }\nvec3 sceneInk(vec2 uv) { return toInk(texture(tScene, clamp(uv, 0.0, 1.0)).rgb); }\n\nfloat blueNoise(vec2 p, float frame) {\n p += 5.588238 * mod(frame, 64.0);\n return fract(52.9829189 * fract(0.06711056 * p.x + 0.00583715 * p.y));\n}\n\nvec3 halftone(vec2 frag) {\n float cell = max(3.0, uScale * 3.6 * uPixelRatio);\n float angle = 0.26 + uSeed * 0.3;\n mat2 turn = mat2(cos(angle), -sin(angle), sin(angle), cos(angle));\n vec2 rotated = turn * frag;\n vec2 grid = floor(rotated / cell);\n vec2 centre = (grid + 0.5) * cell;\n vec2 source = transpose(turn) * centre;\n vec3 soft = sceneInk(frag / iResolution);\n vec3 ink = sceneInk(source / iResolution);\n float level = clamp(dot(ink, LUMA), 0.0, 1.0);\n float radius = cell * sqrt(pow(level, 0.9) / 3.14159265);\n float dist = length(rotated - centre);\n float aa = 0.7 * uPixelRatio;\n float dot_ = 1.0 - smoothstep(radius - aa, radius + aa, dist);\n vec3 dots = ink * min(0.8 / max(level, 1e-3), 2.2) * dot_;\n float presence = smoothstep(0.03, 0.16, level) * (0.3 + 0.14 * uStrength);\n return mix(soft, dots, presence);\n}\n\nvoid main() {\n vec2 frag = gl_FragCoord.xy;\n vec3 ink = halftone(frag);\n vec3 color = fromInk(clamp(ink, 0.0, 1.0));\n color += (blueNoise(frag, floor(iTime * 24.0)) - 0.5) / 255.0;\n fragColor = vec4(clamp(color, 0.0, 1.0), 1.0);\n}\n`;\n\n// Project the unchanged hero field onto a seamless cylindrical surface.\n// Material flows inward along the tunnel; the camera never moves sideways.\n// Hold the hero's color/breath cycle at its initial phase. Only the tunnel\n// coordinates advance, so the ribbons do not enter the hero's darker phases.\nconst TUNNEL_FIELD = HERO_FIELD.replaceAll(\"iTime\", \"uMaterialTime\")\n .replace(\n \"uniform float uMaterialTime;\",\n `uniform float iTime;\n const float uMaterialTime = 0.0;\n uniform float uDepth;\n uniform float uTwist;\n uniform float uSpirals;\n uniform float uCameraZoom;\n vec2 tunnelPosition(vec2 frag) {\n vec2 view = (frag - iResolution * 0.5) / iResolution.y / uCameraZoom;\n float radius = max(length(view), 0.005);\n float z = 0.55 * uDepth / radius + iTime * 1.2;\n // Rotate the material explicitly so circular motion reads at every depth.\n // The camera and its centered projection remain fixed.\n // Integer angular repeats add ribbons without a seam or extra field passes.\n float angle = (atan(view.y, view.x)\n + (z * 0.3 + iTime * 1.5) * uTwist) * uSpirals;\n // Constant phase travels to smaller radii: r(t) = r(0) * exp(-2.4 * t).\n // Log spacing keeps the inward folds readable across the whole tunnel.\n float inward = log(radius / (0.55 * uDepth)) * 5.0 + iTime * 12.0;\n float ring = 0.68 + 0.1 * sin(inward);\n return vec2(cos(angle), sin(angle)) * ring\n + vec2(sin(inward) * 0.08, cos(inward) * 0.06 - 0.25);\n }`,\n )\n .replace(\n \"vec2 pos = (gl_FragCoord.xy - 0.5 * R) / R.y;\",\n \"vec2 pos = tunnelPosition(gl_FragCoord.xy);\",\n );\n\nconst TUNNEL_HALFTONE = HERO_HALFTONE.replace(\n \"uniform vec2 iResolution;\",\n \"uniform vec2 iResolution;\\nuniform float uGlow;\",\n).replace(\n \"fragColor = vec4(clamp(color, 0.0, 1.0), 1.0);\",\n `vec2 center = (gl_FragCoord.xy - iResolution * 0.5) / iResolution.y;\n // Defocus the actual field at the vanishing point instead of cutting a dark\n // circle into it. A Gaussian blend has no visible boundary around the center.\n float centerWeight = exp(-dot(center, center) / (2.0 * 0.065 * 0.065));\n if (centerWeight > 0.001) {\n vec3 blurred = vec3(0.0);\n float totalWeight = 0.0;\n vec2 spread = vec2(iResolution.y * 0.025) / iResolution;\n // Prefilter each tap so tight spiral turns do not reappear as ghost images.\n float blurLod = max(0.0, log2(iResolution.y * 0.025));\n vec2 uv = gl_FragCoord.xy / iResolution;\n for (int y = -2; y <= 2; y++) {\n for (int x = -2; x <= 2; x++) {\n vec2 offset = vec2(float(x), float(y));\n float weight = exp(-dot(offset, offset) * 0.5);\n blurred += textureLod(tScene, clamp(uv + offset * spread, 0.0, 1.0), blurLod).rgb * weight;\n totalWeight += weight;\n }\n }\n color = mix(color, blurred / totalWeight, centerWeight);\n }\n fragColor = vec4(clamp(color * uGlow, 0.0, 1.0), 1.0);`,\n);\n\nconst bounded = (value: number, fallback: number, min: number, max: number) =>\n Math.min(max, Math.max(min, Number.isFinite(value) ? value : fallback));\n\n/** Shared GPU renderer for the background and the spiral-pass transition. */\nfunction createTunnelRenderer(canvas: HTMLCanvasElement) {\n const gl = canvas.getContext(\"webgl2\", {\n alpha: false,\n antialias: false,\n depth: false,\n stencil: false,\n });\n if (!gl) throw new Error(\"Shader Light Tunnel requires WebGL2.\");\n const shaders: WebGLShader[] = [];\n const programs: WebGLProgram[] = [];\n let texture: WebGLTexture | null = null;\n let framebuffer: WebGLFramebuffer | null = null;\n const dispose = () => {\n for (const shader of shaders) gl.deleteShader(shader);\n for (const program of programs) gl.deleteProgram(program);\n gl.deleteTexture(texture);\n gl.deleteFramebuffer(framebuffer);\n };\n const compile = (fragment: string) => {\n const program = gl.createProgram();\n if (!program)\n throw new Error(\"Shader Light Tunnel: GPU allocation failed.\");\n programs.push(program);\n for (const [type, source] of [\n [gl.VERTEX_SHADER, VERTEX],\n [gl.FRAGMENT_SHADER, fragment],\n ] as const) {\n const shader = gl.createShader(type);\n if (!shader)\n throw new Error(\"Shader Light Tunnel: shader allocation failed.\");\n shaders.push(shader);\n gl.shaderSource(shader, source);\n gl.compileShader(shader);\n if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS))\n throw new Error(\n gl.getShaderInfoLog(shader) ?? \"Tunnel shader compilation failed.\",\n );\n gl.attachShader(program, shader);\n }\n gl.linkProgram(program);\n if (!gl.getProgramParameter(program, gl.LINK_STATUS))\n throw new Error(\n gl.getProgramInfoLog(program) ?? \"Tunnel shader link failed.\",\n );\n const locations = new Map<string, WebGLUniformLocation | null>();\n const uniform = (name: string) => {\n if (!locations.has(name))\n locations.set(name, gl.getUniformLocation(program, name));\n return locations.get(name) ?? null;\n };\n return {\n begin: (\n time: number,\n twist: number,\n glow: number,\n depth: number,\n spirals: number,\n cameraZoom = 1,\n ) => {\n gl.useProgram(program);\n gl.viewport(0, 0, canvas.width, canvas.height);\n gl.uniform2f(uniform(\"iResolution\"), canvas.width, canvas.height);\n gl.uniform1f(uniform(\"iTime\"), time);\n gl.uniform1f(uniform(\"uLightMode\"), 0);\n gl.uniform3f(uniform(\"uDarkBackground\"), 9 / 255, 9 / 255, 9 / 255);\n gl.uniform3f(uniform(\"uLightBackground\"), 1, 1, 1);\n gl.uniform1f(uniform(\"uPixelRatio\"), 1);\n gl.uniform1f(uniform(\"uTwist\"), bounded(twist, 0.7, 0, 2));\n gl.uniform1f(\n uniform(\"uSpirals\"),\n Math.round(bounded(spirals, 3, 1, 6)),\n );\n gl.uniform1f(uniform(\"uGlow\"), bounded(glow, 1, 0, 3));\n gl.uniform1f(uniform(\"uDepth\"), bounded(depth, 1, 0.5, 2));\n gl.uniform1f(uniform(\"uCameraZoom\"), bounded(cameraZoom, 1, 1, 32));\n gl.uniform1i(uniform(\"tScene\"), 0);\n },\n };\n };\n try {\n const field = compile(TUNNEL_FIELD);\n const halftone = compile(TUNNEL_HALFTONE);\n texture = gl.createTexture();\n framebuffer = gl.createFramebuffer();\n if (!texture || !framebuffer)\n throw new Error(\"Shader Light Tunnel: render target allocation failed.\");\n gl.activeTexture(gl.TEXTURE0);\n gl.bindTexture(gl.TEXTURE_2D, texture);\n gl.texParameteri(\n gl.TEXTURE_2D,\n gl.TEXTURE_MIN_FILTER,\n gl.LINEAR_MIPMAP_LINEAR,\n );\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);\n let targetWidth = 0,\n targetHeight = 0;\n return {\n dispose,\n draw: (\n time: number,\n twist: number,\n glow: number,\n depth: number,\n spirals: number,\n cameraZoom = 1,\n ) => {\n if (gl.isContextLost())\n throw new Error(\"Shader Light Tunnel: WebGL context lost.\");\n gl.bindFramebuffer(gl.FRAMEBUFFER, framebuffer);\n gl.bindTexture(gl.TEXTURE_2D, texture);\n if (targetWidth !== canvas.width || targetHeight !== canvas.height) {\n gl.texImage2D(\n gl.TEXTURE_2D,\n 0,\n gl.RGBA,\n canvas.width,\n canvas.height,\n 0,\n gl.RGBA,\n gl.UNSIGNED_BYTE,\n null,\n );\n gl.framebufferTexture2D(\n gl.FRAMEBUFFER,\n gl.COLOR_ATTACHMENT0,\n gl.TEXTURE_2D,\n texture,\n 0,\n );\n if (\n gl.checkFramebufferStatus(gl.FRAMEBUFFER) !==\n gl.FRAMEBUFFER_COMPLETE\n )\n throw new Error(\"Shader Light Tunnel: incomplete framebuffer.\");\n targetWidth = canvas.width;\n targetHeight = canvas.height;\n }\n field.begin(time, twist, glow, depth, spirals, cameraZoom);\n gl.drawArrays(gl.TRIANGLES, 0, 3);\n gl.bindFramebuffer(gl.FRAMEBUFFER, null);\n gl.generateMipmap(gl.TEXTURE_2D);\n halftone.begin(time, twist, glow, depth, spirals);\n gl.drawArrays(gl.TRIANGLES, 0, 3);\n },\n };\n } catch (error) {\n dispose();\n throw error;\n }\n}\n\nfunction ShaderLightTunnelBase({\n speed = 1,\n twist = 0.7,\n spirals = 3,\n glow = 1,\n depth = 1,\n timeOffset = 0,\n}: ShaderLightTunnelProps) {\n const frame = useCurrentFrame();\n const { width, height, fps } = useVideoConfig();\n const { delayRender, continueRender, cancelRender } = useDelayRender();\n const canvas = useRef<HTMLCanvasElement>(null);\n const renderer = useRef<ReturnType<typeof createTunnelRenderer> | null>(null);\n\n useLayoutEffect(() => {\n if (!canvas.current) return;\n const handle = delayRender(\"Initialize Shader Light Tunnel\");\n try {\n renderer.current = createTunnelRenderer(canvas.current);\n continueRender(handle);\n } catch (error) {\n cancelRender(error instanceof Error ? error : new Error(String(error)));\n }\n return () => {\n renderer.current?.dispose();\n renderer.current = null;\n };\n }, [delayRender, continueRender, cancelRender]);\n\n // biome-ignore lint/correctness/useExhaustiveDependencies: canvas resizing clears its buffer, including on paused frames.\n useLayoutEffect(() => {\n try {\n const time =\n bounded(timeOffset, 0, -10000, 10000) +\n (frame / fps) * bounded(speed, 1, 0, 5);\n renderer.current?.draw(time, twist, glow, depth, spirals);\n } catch (error) {\n cancelRender(error instanceof Error ? error : new Error(String(error)));\n }\n }, [\n frame,\n fps,\n width,\n height,\n speed,\n twist,\n spirals,\n glow,\n depth,\n timeOffset,\n cancelRender,\n ]);\n\n return (\n <canvas\n ref={canvas}\n width={width}\n height={height}\n aria-hidden=\"true\"\n tabIndex={-1}\n style={{\n position: \"absolute\",\n inset: 0,\n width: \"100%\",\n height: \"100%\",\n pointerEvents: \"none\",\n }}\n />\n );\n}\n\nconst elementSchema = {\n ...Interactive.baseSchema,\n speed: {\n type: \"number\",\n default: 1,\n min: 0.25,\n max: 4,\n step: 0.25,\n description: \"Speed\",\n hiddenFromList: false,\n },\n twist: {\n type: \"number\",\n default: 0.7,\n min: 0,\n max: 2,\n step: 0.05,\n description: \"Spiral motion\",\n hiddenFromList: false,\n },\n spirals: {\n type: \"number\",\n default: 3,\n min: 1,\n max: 6,\n step: 1,\n description: \"Spiral count\",\n hiddenFromList: false,\n },\n glow: {\n type: \"number\",\n default: 1,\n min: 0,\n max: 3,\n step: 0.05,\n description: \"Light exposure\",\n hiddenFromList: false,\n },\n depth: {\n type: \"number\",\n default: 1,\n min: 0.5,\n max: 2,\n step: 0.05,\n description: \"Perspective\",\n hiddenFromList: false,\n },\n timeOffset: {\n type: \"number\",\n default: 0,\n min: 0,\n max: 60,\n step: 0.1,\n description: \"Start time\",\n hiddenFromList: false,\n },\n ...Interactive.transformSchema,\n} as const satisfies InteractivitySchema;\n\nconst ELEMENT_PROP_KEYS = new Set([\"speed\",\"twist\",\"spirals\",\"glow\",\"depth\",\"timeOffset\"]);\n\nconst ELEMENT_PROP_DEFAULTS: Record<string, unknown> = {\n speed: 1,\n twist: 0.7,\n spirals: 3,\n glow: 1,\n depth: 1,\n timeOffset: 0,\n};\n\ntype ShaderLightTunnelElementProps = InteractiveBaseProps &\n InteractiveTransformProps &\n ComponentProps<typeof ShaderLightTunnelBase>;\n\nconst ShaderLightTunnelInner = forwardRef<\n HTMLDivElement,\n ShaderLightTunnelElementProps & { readonly controls: SequenceControls | undefined }\n>(({ controls, name, style, ...rest }, ref) => {\n const outlineRef = useRef<HTMLDivElement>(null);\n useImperativeHandle(ref, () => outlineRef.current as HTMLDivElement, []);\n const componentProps: Record<string, unknown> = { ...ELEMENT_PROP_DEFAULTS };\n const sequenceProps: Record<string, unknown> = {};\n for (const [key, value] of Object.entries(rest)) {\n if (ELEMENT_PROP_KEYS.has(key)) {\n if (value !== undefined) componentProps[key] = value;\n } else {\n sequenceProps[key] = value;\n }\n }\n return (\n <Sequence\n layout=\"none\"\n {...sequenceProps}\n controls={controls}\n name={name ?? \"<ShaderLightTunnel>\"}\n outlineRef={outlineRef}\n >\n <div\n ref={outlineRef}\n style={{\n position: \"relative\",\n width: \"100%\",\n height: \"100%\",\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n ...style,\n }}\n >\n <ShaderLightTunnelBase\n {...(componentProps as unknown as ComponentProps<typeof ShaderLightTunnelBase>)}\n />\n </div>\n </Sequence>\n );\n});\n\nexport const ShaderLightTunnel = Interactive.withSchema({\n Component: ShaderLightTunnelInner,\n componentName: \"<ShaderLightTunnel>\",\n componentIdentity: null,\n schema: elementSchema,\n supportsEffects: false,\n});\n"
+ },
+ "durationInFrames": 90
+}
diff --git a/registry-artifacts/elements/shader-text-reveal.json b/registry-artifacts/elements/shader-text-reveal.json
new file mode 100644
index 00000000..17e8eb65
--- /dev/null
+++ b/registry-artifacts/elements/shader-text-reveal.json
@@ -0,0 +1,14 @@
+{
+ "type": "remotion-element",
+ "version": 1,
+ "element": {
+ "dependencies": [],
+ "dimensions": null,
+ "displayName": "Shader Text Reveal",
+ "durationInFrames": 48,
+ "installationMode": "component-owned-sequence",
+ "slug": "shader-text-reveal",
+ "sourceCode": "import { forwardRef, useImperativeHandle, useLayoutEffect, useRef, type ComponentProps } from \"react\";\nimport { Interactive, Sequence, useCurrentFrame, useDelayRender, useVideoConfig, type InteractiveBaseProps, type InteractiveTransformProps, type InteractivitySchema, type SequenceControls } from \"remotion\";\n\ntype ShaderTextRevealProps = {\n /** Words appear one at a time. Separate phrases with newlines to keep them together. */\n text?: string;\n fontSize?: number;\n fontFamily?: string;\n fontWeight?: number;\n /** Frames per word, including its entrance and exit. The final word stays visible. */\n wordDuration?: number;\n /** Strength of the original hero shader inside the letters, from 0 to 1. */\n intensity?: number;\n};\n\nconst clamp = (n: number, min = 0, max = 1) => Math.min(max, Math.max(min, n));\n\nfunction getShaderTextState(\n frame: number,\n wordCount: number,\n wordDuration: number,\n) {\n const duration = Math.max(12, Math.round(wordDuration));\n const count = Math.max(1, wordCount);\n const f = Math.max(0, frame);\n const index = Math.min(count - 1, Math.floor(f / duration));\n const local = f - index * duration;\n const enter = clamp((local / duration + 0.16) / 0.76);\n const exit =\n index === count - 1 ? 0 : clamp((local / duration - 0.65) / 0.35);\n return {\n index,\n enter,\n exit: exit * exit * (3 - 2 * exit),\n scale: 1 + 0.12 * (1 - enter) ** 3,\n };\n}\n\nconst VERTEX = `#version 300 es\nvoid main() {\n vec2 p = vec2(float((gl_VertexID << 1) & 2), float(gl_VertexID & 2));\n gl_Position = vec4(p * 2.0 - 1.0, 0.0, 1.0);\n}`;\n\n/* @remocn · OpenShaders — https://openshaders.com/@remocn\n * Original hero field and halftone GLSL. Only its clock is driven by Remotion.\n */\nconst HERO_FIELD = `#version 300 es\nprecision highp float;\n\nuniform vec2 iResolution;\nuniform float iTime;\nuniform float uLightMode;\nuniform vec3 uDarkBackground;\nuniform vec3 uLightBackground;\nout vec4 fragColor;\n\nconst float HUE = 0.663466752;\nconst float HUE_SPREAD = 0.314346701;\nconst float HUE_TRAVEL = 1.65112376;\nconst float CHROMA = 0.160295546;\nconst float LIGHTNESS = 0.537409723;\nconst float COLOUR_CYCLE = 0.124862425;\nconst float THETA = 2.12986207;\nconst float SHEAR = 0.968176901;\nconst float SHRINK = 0.955401778;\nconst float LAYERS = 72.0;\nconst float WARP_FREQ_X = 0.439311415;\nconst float WARP_FREQ_Y = 2.87923527;\nconst float WARP_AMP_X = 0.156202048;\nconst float WARP_AMP_Y = 0.0256033838;\nconst float ASPECT_X = 2.23183894;\nconst float ASPECT_Y = 0.15731883;\nconst float OFFSET_X = 0.375628948;\nconst float OFFSET_Y = -0.017801486;\nconst float TILT = 1.63293767;\nconst float ZOOM = 0.93135649;\nconst float CENTRE_X = -0.0956316143;\nconst float CENTRE_Y = -0.520057321;\nconst float GLOW_SIZE = 0.00201825937;\nconst float FALLOFF = 0.352821857;\nconst float VIGNETTE = 0.136085436;\nconst float FLOW_SPEED = 0.391012281;\nconst float FLOW_DIRECTION = 1.0;\nconst float BREATH_RATE = 0.382053256;\nconst float BREATH_AMOUNT = 0.0873704553;\nconst float PHASE = 56.3862724;\nconst float ECHO = 0.0;\nconst float ECHO_SHIFT = 0.178754866;\nconst float SOFTNESS = 0.00164903817;\nconst float LIGHT_SWING = 0.149726808;\n\nconst float TAU = 6.28318530718;\n\nvec3 oklchToLinear(float L, float C, float h) {\n float a = C * cos(h), b = C * sin(h);\n float l_ = L + 0.3963377774 * a + 0.2158037573 * b;\n float m_ = L - 0.1055613458 * a - 0.0638541728 * b;\n float s_ = L - 0.0894841775 * a - 1.2914855480 * b;\n vec3 lms = vec3(l_, m_, s_);\n lms = lms * lms * lms;\n return mat3(4.0767416621, -1.2684380046, -0.0041960863,\n -3.3077115913, 2.6097574011, -0.7034186147,\n 0.2309699292, -0.3413193965, 1.7076147010) * lms;\n}\n\nfloat blueNoise(vec2 p, float frame) {\n p += 5.588238 * mod(frame, 64.0);\n return fract(52.9829189 * fract(0.06711056 * p.x + 0.00583715 * p.y));\n}\n\nvoid main() {\n vec2 R = iResolution.xy;\n vec2 pos = (gl_FragCoord.xy - 0.5 * R) / R.y;\n float t = iTime * FLOW_SPEED * FLOW_DIRECTION + PHASE;\n float breath = (-sin(iTime * BREATH_RATE * 1.5) + sin(iTime * BREATH_RATE + 1.0)) * 0.25 + 0.5;\n\n vec2 u = (pos - vec2(CENTRE_X, CENTRE_Y)) * (ZOOM - breath * BREATH_AMOUNT);\n float ct = cos(TILT), st = sin(TILT);\n u = mat2(ct, st, -st, ct) * u;\n\n mat2 fold = mat2(cos(THETA), sin(THETA), -SHEAR, cos(THETA));\n\n float hue0 = HUE * TAU;\n float hue1 = hue0 + HUE_SPREAD * TAU;\n vec3 color = vec3(0.0);\n\n for (float i = 1.0; i <= 96.0; i += 1.0) {\n if (i > LAYERS) break;\n u.x += -sin(u.y * WARP_FREQ_X + t + i * 0.007) * WARP_AMP_X;\n u.y += -sin(u.x * WARP_FREQ_Y - t + i * 0.02) * WARP_AMP_Y;\n u = fold * u * SHRINK;\n\n vec2 q = u - vec2(OFFSET_X + breath * 0.1, OFFSET_Y);\n vec2 s = vec2(q.x * ASPECT_X, q.y * ASPECT_Y);\n float glow = GLOW_SIZE / (dot(s, s) + SOFTNESS);\n#ifndef SKIP_ECHO\n vec2 e = vec2((q.x - ECHO_SHIFT) * ASPECT_X, s.y);\n glow += ECHO * GLOW_SIZE / (dot(e, e) + SOFTNESS);\n#endif\n glow *= 0.25 + breath * 0.4;\n\n float r = length(u);\n float k = sin(i * COLOUR_CYCLE + t * 1.2 + r * HUE_TRAVEL) * 0.5 + 0.5;\n vec3 tint = clamp(oklchToLinear(LIGHTNESS + LIGHT_SWING * k, CHROMA * (0.75 + 0.35 * k), mix(hue0, hue1, k)), 0.0, 1.0);\n color += glow * tint * exp2(-r * FALLOFF);\n }\n\n vec3 x = max(color, 0.0);\n color = (x * (2.51 * x + 0.03)) / (x * (2.43 * x + 0.59) + 0.14);\n color = pow(clamp(color, 0.0, 1.0), vec3(0.85, 0.92, 0.98));\n\n float edge = smoothstep(0.5, 1.6, length(pos));\n color *= 1.0 - edge * VIGNETTE;\n\n vec3 dark = uDarkBackground + color * (1.0 - uDarkBackground);\n float strength = max(color.r, max(color.g, color.b));\n vec3 light = uLightBackground * (1.0 - strength) + color * 0.96;\n color = mix(dark, light, uLightMode);\n\n color += (blueNoise(gl_FragCoord.xy, floor(iTime * 24.0)) - 0.5) / 255.0;\n fragColor = vec4(clamp(color, 0.0, 1.0), 1.0);\n}\n`;\n\nconst HERO_HALFTONE = `#version 300 es\nprecision highp float;\n\nuniform sampler2D tScene;\nuniform vec2 iResolution;\nuniform float iTime;\nuniform float uLightMode;\nuniform vec3 uDarkBackground;\nuniform vec3 uLightBackground;\nuniform float uPixelRatio;\nout vec4 fragColor;\n\nconst float uStrength = 0.797335207;\nconst float uScale = 0.985214949;\nconst float uSeed = 0.435611069;\n\nconst float TAU = 6.28318530718;\nconst vec3 LUMA = vec3(0.2126, 0.7152, 0.0722);\n\nvec3 toInk(vec3 c) { return mix(c - uDarkBackground, uLightBackground - c, uLightMode); }\nvec3 fromInk(vec3 ink) { return mix(uDarkBackground + ink, uLightBackground - ink, uLightMode); }\nvec3 sceneInk(vec2 uv) { return toInk(texture(tScene, clamp(uv, 0.0, 1.0)).rgb); }\n\nfloat blueNoise(vec2 p, float frame) {\n p += 5.588238 * mod(frame, 64.0);\n return fract(52.9829189 * fract(0.06711056 * p.x + 0.00583715 * p.y));\n}\n\nvec3 halftone(vec2 frag) {\n float cell = max(3.0, uScale * 3.6 * uPixelRatio);\n float angle = 0.26 + uSeed * 0.3;\n mat2 turn = mat2(cos(angle), -sin(angle), sin(angle), cos(angle));\n vec2 rotated = turn * frag;\n vec2 grid = floor(rotated / cell);\n vec2 centre = (grid + 0.5) * cell;\n vec2 source = transpose(turn) * centre;\n vec3 soft = sceneInk(frag / iResolution);\n vec3 ink = sceneInk(source / iResolution);\n float level = clamp(dot(ink, LUMA), 0.0, 1.0);\n float radius = cell * sqrt(pow(level, 0.9) / 3.14159265);\n float dist = length(rotated - centre);\n float aa = 0.7 * uPixelRatio;\n float dot_ = 1.0 - smoothstep(radius - aa, radius + aa, dist);\n vec3 dots = ink * min(0.8 / max(level, 1e-3), 2.2) * dot_;\n float presence = smoothstep(0.03, 0.16, level) * (0.3 + 0.14 * uStrength);\n return mix(soft, dots, presence);\n}\n\nvoid main() {\n vec2 frag = gl_FragCoord.xy;\n vec3 ink = halftone(frag);\n vec3 color = fromInk(clamp(ink, 0.0, 1.0));\n color += (blueNoise(frag, floor(iTime * 24.0)) - 0.5) / 255.0;\n fragColor = vec4(clamp(color, 0.0, 1.0), 1.0);\n}\n`;\n\nconst FRAGMENT = `#version 300 es\nprecision highp float;\nuniform sampler2D uText;\nuniform sampler2D uHero;\nuniform vec2 uResolution;\nuniform vec4 uBounds;\nuniform float uEnter;\nuniform float uExit;\nuniform float uScale;\nuniform float uTime;\nuniform float uIntensity;\nout vec4 fragColor;\n\nvoid main() {\n vec2 uv = (gl_FragCoord.xy / uResolution - 0.5) / uScale + 0.5;\n vec2 q = (uv - uBounds.xy) / uBounds.zw;\n float flow = sin(q.x * 7.0 + q.y * 5.0 - uTime * 3.2) * 0.065\n + sin(q.x * 13.0 - q.y * 8.0 + uTime * 2.1) * 0.025;\n float rank = q.x * 0.64 + (1.0 - q.y) * 0.36 + flow;\n float d = rank - mix(-0.15, 1.65, uEnter);\n float edge = exp(-pow((d + 0.1) * 6.0, 2.0));\n // Refraction affects the glyph itself, concentrated inside the wet leading edge.\n vec3 field = texture(uHero, uv).rgb;\n vec2 warp = vec2(field.r - field.b, field.g - field.r);\n vec2 sampleUV = uv + warp * edge * uIntensity * 2.5 / uResolution;\n float glyph = texture(uText, sampleUV).a;\n float appear = 1.0 - smoothstep(-0.025, 0.09, d);\n float exitRank = q.x * 0.65 + (1.0 - q.y) * 0.5 + flow;\n float leave = smoothstep(-0.12, 0.06, exitRank - mix(-0.25, 1.45, uExit));\n\n vec3 liquid = texture(uHero, sampleUV).rgb;\n vec3 silver = vec3(0.96, 0.925, 1.0);\n float settled = 1.0 - smoothstep(-0.58, -0.16, d);\n vec3 color = mix(liquid, silver, settled);\n color = mix(silver, color, uIntensity);\n float alpha = glyph * appear * leave;\n fragColor = vec4(color * alpha, alpha);\n}`;\n\nfunction createRenderer(canvas: HTMLCanvasElement) {\n const gl = canvas.getContext(\"webgl2\", {\n alpha: true,\n premultipliedAlpha: true,\n antialias: false,\n depth: false,\n });\n if (!gl) throw new Error(\"Shader Text Reveal requires WebGL2.\");\n const shaders: WebGLShader[] = [];\n const programs: WebGLProgram[] = [];\n const textures: WebGLTexture[] = [];\n const buffers: WebGLFramebuffer[] = [];\n const dispose = () => {\n for (const shader of shaders) gl.deleteShader(shader);\n for (const program of programs) gl.deleteProgram(program);\n for (const texture of textures) gl.deleteTexture(texture);\n for (const buffer of buffers) gl.deleteFramebuffer(buffer);\n };\n const compile = (fragment: string) => {\n const program = gl.createProgram();\n if (!program) throw new Error(\"Shader Text Reveal: GPU allocation failed.\");\n programs.push(program);\n for (const [type, source] of [\n [gl.VERTEX_SHADER, VERTEX],\n [gl.FRAGMENT_SHADER, fragment],\n ] as const) {\n const shader = gl.createShader(type);\n if (!shader)\n throw new Error(\"Shader Text Reveal: shader allocation failed.\");\n shaders.push(shader);\n gl.shaderSource(shader, source);\n gl.compileShader(shader);\n if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS))\n throw new Error(\n gl.getShaderInfoLog(shader) ?? \"Shader compilation failed.\",\n );\n gl.attachShader(program, shader);\n }\n gl.linkProgram(program);\n if (!gl.getProgramParameter(program, gl.LINK_STATUS))\n throw new Error(gl.getProgramInfoLog(program) ?? \"Shader link failed.\");\n const locations = new Map<string, WebGLUniformLocation | null>();\n const uniform = (name: string) => {\n if (!locations.has(name))\n locations.set(name, gl.getUniformLocation(program, name));\n return locations.get(name) ?? null;\n };\n return {\n uniform,\n begin: (time: number) => {\n gl.useProgram(program);\n gl.viewport(0, 0, canvas.width, canvas.height);\n gl.uniform2f(uniform(\"iResolution\"), canvas.width, canvas.height);\n gl.uniform1f(uniform(\"iTime\"), time);\n gl.uniform1f(uniform(\"uLightMode\"), 0);\n gl.uniform3f(uniform(\"uDarkBackground\"), 9 / 255, 9 / 255, 9 / 255);\n gl.uniform3f(uniform(\"uLightBackground\"), 1, 1, 1);\n gl.uniform1f(uniform(\"uPixelRatio\"), 1);\n },\n };\n };\n const texture = () => {\n const value = gl.createTexture();\n if (!value)\n throw new Error(\"Shader Text Reveal: texture allocation failed.\");\n textures.push(value);\n gl.activeTexture(gl.TEXTURE0);\n gl.bindTexture(gl.TEXTURE_2D, value);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);\n return value;\n };\n const target = () => {\n const value = texture();\n const buffer = gl.createFramebuffer();\n if (!buffer)\n throw new Error(\"Shader Text Reveal: framebuffer allocation failed.\");\n buffers.push(buffer);\n gl.bindFramebuffer(gl.FRAMEBUFFER, buffer);\n gl.texImage2D(\n gl.TEXTURE_2D,\n 0,\n gl.RGBA,\n canvas.width,\n canvas.height,\n 0,\n gl.RGBA,\n gl.UNSIGNED_BYTE,\n null,\n );\n gl.framebufferTexture2D(\n gl.FRAMEBUFFER,\n gl.COLOR_ATTACHMENT0,\n gl.TEXTURE_2D,\n value,\n 0,\n );\n if (gl.checkFramebufferStatus(gl.FRAMEBUFFER) !== gl.FRAMEBUFFER_COMPLETE)\n throw new Error(\"Shader Text Reveal: incomplete framebuffer.\");\n return { value, buffer };\n };\n const bind = (value: WebGLTexture, unit: number) => {\n gl.activeTexture(gl.TEXTURE0 + unit);\n gl.bindTexture(gl.TEXTURE_2D, value);\n };\n try {\n const field = compile(HERO_FIELD);\n const halftone = compile(HERO_HALFTONE);\n const composite = compile(FRAGMENT);\n const text = texture();\n const raw = target();\n const hero = target();\n gl.bindFramebuffer(gl.FRAMEBUFFER, null);\n gl.clearColor(0, 0, 0, 0);\n gl.clear(gl.COLOR_BUFFER_BIT);\n let previous: HTMLCanvasElement | null = null;\n return {\n dispose,\n draw: (\n word: TextTexture,\n state: ReturnType<typeof getShaderTextState>,\n time: number,\n intensity: number,\n ) => {\n if (gl.isContextLost())\n throw new Error(\"Shader Text Reveal: WebGL context lost.\");\n // Render the hero's original field, then its original halftone pass.\n gl.bindFramebuffer(gl.FRAMEBUFFER, raw.buffer);\n field.begin(time);\n gl.drawArrays(gl.TRIANGLES, 0, 3);\n gl.bindFramebuffer(gl.FRAMEBUFFER, hero.buffer);\n halftone.begin(time);\n bind(raw.value, 0);\n gl.uniform1i(halftone.uniform(\"tScene\"), 0);\n gl.drawArrays(gl.TRIANGLES, 0, 3);\n\n gl.bindFramebuffer(gl.FRAMEBUFFER, null);\n composite.begin(time);\n bind(text, 0);\n if (previous !== word.canvas) {\n gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, true);\n gl.texImage2D(\n gl.TEXTURE_2D,\n 0,\n gl.RGBA,\n gl.RGBA,\n gl.UNSIGNED_BYTE,\n word.canvas,\n );\n gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, false);\n previous = word.canvas;\n }\n bind(hero.value, 1);\n gl.uniform1i(composite.uniform(\"uText\"), 0);\n gl.uniform1i(composite.uniform(\"uHero\"), 1);\n gl.uniform2f(\n composite.uniform(\"uResolution\"),\n canvas.width,\n canvas.height,\n );\n gl.uniform4f(composite.uniform(\"uBounds\"), ...word.bounds);\n gl.uniform1f(composite.uniform(\"uEnter\"), state.enter);\n gl.uniform1f(composite.uniform(\"uExit\"), state.exit);\n gl.uniform1f(composite.uniform(\"uScale\"), state.scale);\n gl.uniform1f(composite.uniform(\"uTime\"), time);\n gl.uniform1f(composite.uniform(\"uIntensity\"), clamp(intensity));\n gl.drawArrays(gl.TRIANGLES, 0, 3);\n },\n };\n } catch (error) {\n dispose();\n throw error;\n }\n}\n\ntype TextTexture = {\n canvas: HTMLCanvasElement;\n bounds: [number, number, number, number];\n};\n\nfunction textTexture(\n text: string,\n width: number,\n height: number,\n fontSize: number,\n fontWeight: number,\n fontFamily: string,\n): TextTexture {\n const canvas = document.createElement(\"canvas\");\n canvas.width = width;\n canvas.height = height;\n const ctx = canvas.getContext(\"2d\");\n if (!ctx) throw new Error(\"Shader Text Reveal: cannot rasterize text.\");\n let size = Math.min(Math.max(1, fontSize), height * 0.58);\n ctx.font = `${fontWeight} ${size}px ${fontFamily}`;\n size *= Math.min(\n 1,\n (width * 0.72) / Math.max(1, ctx.measureText(text).width),\n );\n ctx.font = `${fontWeight} ${size}px ${fontFamily}`;\n const metrics = ctx.measureText(text);\n const left = (width - metrics.width) / 2;\n const ascent = metrics.actualBoundingBoxAscent;\n const descent = metrics.actualBoundingBoxDescent;\n const baseline = (height + ascent - descent) / 2;\n ctx.fillStyle = \"white\";\n ctx.fillText(text, left, baseline);\n return {\n canvas,\n bounds: [\n left / width,\n (height - baseline - descent) / height,\n Math.max(1, metrics.width) / width,\n Math.max(1, ascent + descent) / height,\n ],\n };\n}\n\nfunction ShaderTextRevealBase({\n text = \"Your product\",\n fontSize = 400,\n fontFamily = \"Arial, sans-serif\",\n fontWeight = 500,\n wordDuration = 30,\n intensity = 1,\n}: ShaderTextRevealProps) {\n const frame = useCurrentFrame();\n const { width, height, fps } = useVideoConfig();\n const { delayRender, continueRender, cancelRender } = useDelayRender();\n const canvas = useRef<HTMLCanvasElement>(null);\n const resources = useRef<{\n renderer: ReturnType<typeof createRenderer>;\n words: TextTexture[];\n } | null>(null);\n const current = useRef({ frame, fps, wordDuration, intensity });\n current.current = { frame, fps, wordDuration, intensity };\n\n useLayoutEffect(() => {\n const element = canvas.current;\n if (!element) return;\n let cancelled = false;\n const handle = delayRender(\"Load Shader Text Reveal font\");\n const phrases = text.includes(\"\\n\") ? text.split(\"\\n\") : text.split(/\\s+/);\n const words = phrases.map((word) => word.trim()).filter(Boolean);\n const draw = () => {\n const resource = resources.current;\n if (!resource || resource.words.length === 0) return;\n const clock = current.current;\n const state = getShaderTextState(\n clock.frame,\n resource.words.length,\n clock.wordDuration,\n );\n resource.renderer.draw(\n resource.words[state.index],\n state,\n clock.frame / clock.fps,\n clock.intensity,\n );\n };\n void document.fonts\n .load(`${fontWeight} ${fontSize}px ${fontFamily}`, text || \" \")\n .then(() => {\n if (cancelled) return;\n const textures = words.map((word) =>\n textTexture(word, width, height, fontSize, fontWeight, fontFamily),\n );\n const renderer = createRenderer(element);\n resources.current = { renderer, words: textures };\n draw();\n continueRender(handle);\n })\n .catch((error: unknown) => {\n if (!cancelled)\n cancelRender(\n error instanceof Error ? error : new Error(String(error)),\n );\n });\n return () => {\n cancelled = true;\n continueRender(handle);\n resources.current?.renderer.dispose();\n resources.current = null;\n };\n }, [\n text,\n width,\n height,\n fontSize,\n fontWeight,\n fontFamily,\n delayRender,\n continueRender,\n cancelRender,\n ]);\n\n useLayoutEffect(() => {\n const resource = resources.current;\n if (!resource || resource.words.length === 0) return;\n try {\n const state = getShaderTextState(\n frame,\n resource.words.length,\n wordDuration,\n );\n resource.renderer.draw(\n resource.words[state.index],\n state,\n frame / fps,\n intensity,\n );\n } catch (error) {\n cancelRender(error instanceof Error ? error : new Error(String(error)));\n }\n }, [frame, fps, wordDuration, intensity, cancelRender]);\n\n return (\n <canvas\n ref={canvas}\n width={width}\n height={height}\n role=\"img\"\n aria-label={text}\n style={{\n position: \"absolute\",\n inset: 0,\n width: \"100%\",\n height: \"100%\",\n pointerEvents: \"none\",\n }}\n />\n );\n}\n\nconst elementSchema = {\n ...Interactive.baseSchema,\n text: {\n type: \"text-content\",\n default: \"Your product\",\n description: \"Text\",\n },\n fontSize: {\n type: \"number\",\n default: 400,\n min: 24,\n max: 500,\n step: 1,\n description: \"Font size\",\n hiddenFromList: false,\n },\n wordDuration: {\n type: \"number\",\n default: 30,\n min: 12,\n max: 90,\n step: 1,\n description: \"Frames per word\",\n hiddenFromList: false,\n },\n intensity: {\n type: \"number\",\n default: 1,\n min: 0,\n max: 1,\n step: 0.01,\n description: \"Hero shader strength\",\n hiddenFromList: false,\n },\n speed: {\n type: \"number\",\n default: 1,\n min: 0.25,\n max: 4,\n step: 0.25,\n description: \"Speed\",\n hiddenFromList: false,\n },\n ...Interactive.transformSchema,\n} as const satisfies InteractivitySchema;\n\nconst ELEMENT_PROP_KEYS = new Set([\"text\",\"fontSize\",\"wordDuration\",\"intensity\",\"speed\"]);\n\nconst ELEMENT_PROP_DEFAULTS: Record<string, unknown> = {\n text: \"Your product\",\n fontSize: 400,\n wordDuration: 30,\n intensity: 1,\n speed: 1,\n};\n\ntype ShaderTextRevealElementProps = InteractiveBaseProps &\n InteractiveTransformProps &\n ComponentProps<typeof ShaderTextRevealBase>;\n\nconst ShaderTextRevealInner = forwardRef<\n HTMLDivElement,\n ShaderTextRevealElementProps & { readonly controls: SequenceControls | undefined }\n>(({ controls, name, style, ...rest }, ref) => {\n const outlineRef = useRef<HTMLDivElement>(null);\n useImperativeHandle(ref, () => outlineRef.current as HTMLDivElement, []);\n const componentProps: Record<string, unknown> = { ...ELEMENT_PROP_DEFAULTS };\n const sequenceProps: Record<string, unknown> = {};\n for (const [key, value] of Object.entries(rest)) {\n if (ELEMENT_PROP_KEYS.has(key)) {\n if (value !== undefined) componentProps[key] = value;\n } else {\n sequenceProps[key] = value;\n }\n }\n return (\n <Sequence\n layout=\"none\"\n {...sequenceProps}\n controls={controls}\n name={name ?? \"<ShaderTextReveal>\"}\n outlineRef={outlineRef}\n >\n <div\n ref={outlineRef}\n style={{\n position: \"relative\",\n width: \"100%\",\n height: \"100%\",\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n ...style,\n }}\n >\n <ShaderTextRevealBase\n {...(componentProps as unknown as ComponentProps<typeof ShaderTextRevealBase>)}\n />\n </div>\n </Sequence>\n );\n});\n\nexport const ShaderTextReveal = Interactive.withSchema({\n Component: ShaderTextRevealInner,\n componentName: \"<ShaderTextReveal>\",\n componentIdentity: null,\n schema: elementSchema,\n supportsEffects: false,\n});\n"
+ },
+ "durationInFrames": 48
+}
diff --git a/registry-artifacts/inline-word-roll.json b/registry-artifacts/inline-word-roll.json
new file mode 100644
index 00000000..a2bdb4c7
--- /dev/null
+++ b/registry-artifacts/inline-word-roll.json
@@ -0,0 +1,16 @@
+{
+ "$schema": "https://ui.shadcn.com/schema/registry-item.json",
+ "name": "inline-word-roll",
+ "title": "Inline Word Roll",
+ "description": "Roll through words beside a fixed prefix with accelerating timing and smoothly centered width.",
+ "dependencies": ["remotion"],
+ "files": [
+ {
+ "path": "registry/remocn/inline-word-roll/index.tsx",
+ "content": "\"use client\";\n\nimport { useLayoutEffect, useRef, useState } from \"react\";\nimport {\n Easing,\n useCurrentFrame,\n useDelayRender,\n useVideoConfig,\n} from \"remotion\";\n\nexport interface InlineWordRollProps {\n prefix?: string;\n /** Separate words or phrases with | or newlines. */\n text?: string;\n suffix?: string;\n fontSize?: number;\n fontFamily?: string;\n fontWeight?: number;\n color?: string;\n /** Initial interval between switches, in frames. */\n interval?: number;\n /** Each following interval is multiplied by this number; 1 keeps a steady pace. */\n acceleration?: number;\n transitionFrames?: number;\n}\n\nexport const inlineWordRollDefaultText =\n \"leads | customers | subscribers | appointments | demos | quotes | registrants | trials | conversions\";\n\nexport const parseInlineWords = (text: string) =>\n text\n .split(/[|\\n\\r]+/)\n .map((word) => word.trim())\n .filter(Boolean);\n\nconst finite = (value: number, fallback: number) =>\n Number.isFinite(value) ? value : fallback;\nconst clamp = (n: number) => Math.max(0, Math.min(1, n));\nconst ease = Easing.bezier(0.22, 0.75, 0.25, 1);\n\nexport function getInlineWordRollState(\n frame: number,\n count: number,\n interval = 12,\n acceleration = 0.9,\n transitionFrames = 6,\n) {\n const transition = Math.max(1, finite(transitionFrames, 6));\n const gap = Math.max(transition, finite(interval, 12));\n const rate = Math.min(1, Math.max(0.5, finite(acceleration, 0.9)));\n const f = Math.max(0, finite(frame, 0));\n let start = 0;\n for (let index = 1; index < count; index++) {\n start += Math.max(transition, gap * rate ** (index - 1));\n if (f < start) return { from: index - 1, to: index - 1, progress: 1 };\n if (f < start + transition)\n return {\n from: index - 1,\n to: index,\n progress: clamp((f - start) / transition),\n };\n }\n const last = Math.max(0, count - 1);\n return { from: last, to: last, progress: 1 };\n}\n\nexport function getInlineWordRollDuration({\n text = inlineWordRollDefaultText,\n interval = 12,\n acceleration = 0.9,\n transitionFrames = 6,\n}: Pick<\n InlineWordRollProps,\n \"text\" | \"interval\" | \"acceleration\" | \"transitionFrames\"\n> = {}) {\n const count = parseInlineWords(text).length;\n const transition = Math.max(1, finite(transitionFrames, 6));\n const gap = Math.max(transition, finite(interval, 12));\n const rate = Math.min(1, Math.max(0.5, finite(acceleration, 0.9)));\n let total = 0;\n for (let index = 0; index < count - 1; index++)\n total += Math.max(transition, gap * rate ** index);\n return count < 2 ? 0 : Math.ceil(total + transition);\n}\n\nexport function InlineWordRoll({\n prefix = \"Looking for\",\n text = inlineWordRollDefaultText,\n suffix = \"?\",\n fontSize = 60,\n fontFamily = \"Arial, Helvetica, sans-serif\",\n fontWeight = 400,\n color = \"#f5f5f5\",\n interval = 12,\n acceleration = 0.9,\n transitionFrames = 6,\n}: InlineWordRollProps) {\n const frame = useCurrentFrame();\n const { width, height } = useVideoConfig();\n const { delayRender, continueRender, cancelRender } = useDelayRender();\n const words = parseInlineWords(text);\n const measurement = useRef<HTMLDivElement>(null);\n const pending = useRef<number | null>(null);\n const [metrics, setMetrics] = useState<{\n prefix: number;\n words: number[];\n } | null>(null);\n const size = Math.max(1, finite(fontSize, 60));\n const typography = {\n fontFamily,\n fontSize: size,\n fontWeight,\n letterSpacing: \"-0.035em\",\n lineHeight: 1.2,\n whiteSpace: \"pre\" as const,\n };\n\n useLayoutEffect(() => {\n let cancelled = false;\n const handle = delayRender(\"Measure Inline Word Roll font\");\n pending.current = handle;\n void document.fonts\n .load(\n `${fontWeight} ${size}px ${fontFamily}`,\n `${prefix} ${text}${suffix}`,\n )\n .then(() => {\n if (cancelled || !measurement.current) return;\n const children = Array.from(measurement.current.children);\n // Computed widths are in composition pixels. Bounding rectangles include\n // the Player's preview scale and would shrink our layout a second time.\n const measure = (node: Element) =>\n Number.parseFloat(getComputedStyle(node).width);\n setMetrics({\n prefix: measure(children[0]),\n words: children.slice(1).map(measure),\n });\n })\n .catch((error: unknown) => {\n if (!cancelled)\n cancelRender(\n error instanceof Error ? error : new Error(String(error)),\n );\n });\n return () => {\n cancelled = true;\n continueRender(handle);\n if (pending.current === handle) pending.current = null;\n };\n }, [\n prefix,\n text,\n suffix,\n size,\n fontFamily,\n fontWeight,\n delayRender,\n continueRender,\n cancelRender,\n ]);\n\n useLayoutEffect(() => {\n if (metrics && pending.current !== null) {\n continueRender(pending.current);\n pending.current = null;\n }\n }, [metrics, continueRender]);\n\n const state = getInlineWordRollState(\n frame,\n words.length,\n interval,\n acceleration,\n transitionFrames,\n );\n const moving = state.from !== state.to;\n const p = ease(state.progress);\n const gap = prefix ? size * 0.23 : 0;\n const prefixWidth = metrics?.prefix ?? 0;\n const fromWidth = metrics?.words[state.from] ?? 0;\n const toWidth = metrics?.words[state.to] ?? 0;\n const slotWidth = fromWidth + (toWidth - fromWidth) * p;\n const totalWidth = prefixWidth + gap + slotWidth;\n const widest = prefixWidth + gap + Math.max(0, ...(metrics?.words ?? []));\n const fit = Math.min(\n 1,\n (width * 0.84) / Math.max(1, widest),\n (height * 0.5) / (size * 1.2),\n );\n const rowHeight = size * 1.2;\n\n return (\n <div\n role=\"img\"\n aria-label={[prefix, words[state.to] ? `${words[state.to]}${suffix}` : \"\"]\n .filter(Boolean)\n .join(\" \")}\n style={{ position: \"absolute\", inset: 0, overflow: \"hidden\", color }}\n >\n <div\n ref={measurement}\n aria-hidden=\"true\"\n style={{\n ...typography,\n position: \"absolute\",\n visibility: \"hidden\",\n pointerEvents: \"none\",\n }}\n >\n <span style={{ display: \"inline-block\" }}>{prefix}</span>\n {words.map((word, index) => (\n <span key={`${index}:${word}`} style={{ display: \"inline-block\" }}>\n {word}\n {suffix}\n </span>\n ))}\n </div>\n <div\n aria-hidden=\"true\"\n style={{\n position: \"absolute\",\n left: \"50%\",\n top: \"50%\",\n scale: fit,\n visibility: metrics && words.length ? \"visible\" : \"hidden\",\n }}\n >\n <div\n style={{\n ...typography,\n position: \"absolute\",\n left: -totalWidth / 2,\n top: -rowHeight / 2,\n height: rowHeight,\n }}\n >\n <span style={{ position: \"absolute\", left: 0 }}>{prefix}</span>\n <div\n style={{\n position: \"absolute\",\n left: prefixWidth + gap,\n top: 0,\n width: Math.max(fromWidth, toWidth) + size * 0.12,\n height: rowHeight,\n overflow: \"hidden\",\n maskImage:\n \"linear-gradient(to bottom, transparent, black 12%, black 88%, transparent)\",\n }}\n >\n <span\n style={{\n position: \"absolute\",\n left: 0,\n top: 0,\n translate: `0 ${moving ? -p * rowHeight : 0}px`,\n opacity: moving ? 1 - clamp(p * 1.2) : 1,\n }}\n >\n {words[state.from]}\n {words.length ? suffix : \"\"}\n </span>\n {moving ? (\n <span\n style={{\n position: \"absolute\",\n left: 0,\n top: 0,\n translate: `0 ${(1 - p) * rowHeight}px`,\n opacity: clamp(p * 1.6),\n }}\n >\n {words[state.to]}\n {suffix}\n </span>\n ) : null}\n </div>\n </div>\n </div>\n </div>\n );\n}\n",
+ "type": "registry:component",
+ "target": "components/remocn/inline-word-roll.tsx"
+ }
+ ],
+ "type": "registry:component"
+}
diff --git a/registry-artifacts/registry.json b/registry-artifacts/registry.json
index 76341fc6..00bf2193 100644
--- a/registry-artifacts/registry.json
+++ b/registry-artifacts/registry.json
@@ -2235,6 +2235,77 @@
],
"type": "registry:component"
},
+ {
+ "name": "shader-seam",
+ "title": "Shader Seam",
+ "description": "Dissolve a stationary OpenShaders material to uncover the next scene.",
+ "dependencies": ["remotion", "@remotion/transitions"],
+ "files": [
+ {
+ "path": "registry/remocn/shader-seam/index.tsx",
+ "type": "registry:component",
+ "target": "components/remocn/shader-seam.tsx"
+ }
+ ],
+ "type": "registry:component"
+ },
+ {
+ "name": "shader-text-reveal",
+ "title": "Shader Text Reveal",
+ "description": "Reveal words through the original OpenShaders hero shader, then settle into white type.",
+ "dependencies": ["remotion"],
+ "files": [
+ {
+ "path": "registry/remocn/shader-text-reveal/index.tsx",
+ "type": "registry:component",
+ "target": "components/remocn/shader-text-reveal.tsx"
+ }
+ ],
+ "type": "registry:component"
+ },
+ {
+ "name": "inline-word-roll",
+ "title": "Inline Word Roll",
+ "description": "Roll through words beside a fixed prefix with accelerating timing and smoothly centered width.",
+ "dependencies": ["remotion"],
+ "files": [
+ {
+ "path": "registry/remocn/inline-word-roll/index.tsx",
+ "type": "registry:component",
+ "target": "components/remocn/inline-word-roll.tsx"
+ }
+ ],
+ "type": "registry:component"
+ },
+ {
+ "name": "shader-light-tunnel",
+ "title": "Light Tunnel",
+ "description": "Fly straight through a tunnel made from the original OpenShaders hero shader.",
+ "dependencies": ["remotion"],
+ "files": [
+ {
+ "path": "registry/remocn/shader-light-tunnel/index.tsx",
+ "type": "registry:component",
+ "target": "components/remocn/shader-light-tunnel.tsx"
+ }
+ ],
+ "type": "registry:component"
+ },
+ {
+ "name": "shader-spiral-pass",
+ "title": "Shader Spiral Pass",
+ "description": "Accelerate into the hero spiral and emerge through its soft center into the next scene.",
+ "dependencies": ["remotion", "@remotion/transitions"],
+ "registryDependencies": ["@remocn/shader-light-tunnel"],
+ "files": [
+ {
+ "path": "registry/remocn/shader-spiral-pass/index.tsx",
+ "type": "registry:component",
+ "target": "components/remocn/shader-spiral-pass.tsx"
+ }
+ ],
+ "type": "registry:component"
+ },
{
"name": "remocn-ui",
"title": "remocn UI Core",
diff --git a/registry-artifacts/shader-light-tunnel.json b/registry-artifacts/shader-light-tunnel.json
new file mode 100644
index 00000000..23e2c48a
--- /dev/null
+++ b/registry-artifacts/shader-light-tunnel.json
@@ -0,0 +1,16 @@
+{
+ "$schema": "https://ui.shadcn.com/schema/registry-item.json",
+ "name": "shader-light-tunnel",
+ "title": "Light Tunnel",
+ "description": "Fly straight through a tunnel made from the original OpenShaders hero shader.",
+ "dependencies": ["remotion"],
+ "files": [
+ {
+ "path": "registry/remocn/shader-light-tunnel/index.tsx",
+ "content": "\"use client\";\n\nimport { useLayoutEffect, useRef } from \"react\";\nimport { useCurrentFrame, useDelayRender, useVideoConfig } from \"remotion\";\n\nexport interface ShaderLightTunnelProps {\n speed?: number;\n /** Spiral winding and circular motion of the material, from 0 to 2. */\n twist?: number;\n /** Repetitions of the hero ribbons around the tunnel, integer from 1 to 6. */\n spirals?: number;\n /** Exposure of the original hero material, from 0 to 3. */\n glow?: number;\n /** Camera perspective, from 0.5 to 2. */\n depth?: number;\n /** Starting shader time, in seconds. */\n timeOffset?: number;\n}\n\nconst VERTEX = `#version 300 es\nvoid main() {\n vec2 p = vec2(float((gl_VertexID << 1) & 2), float(gl_VertexID & 2));\n gl_Position = vec4(p * 2.0 - 1.0, 0.0, 1.0);\n}`;\n\n/* @remocn · OpenShaders — https://openshaders.com/@remocn\n * Original hero field and halftone source. The tunnel adapter only remaps\n * sampling coordinates, holds the material phase, and applies exposure.\n */\nconst HERO_FIELD = `#version 300 es\nprecision highp float;\n\nuniform vec2 iResolution;\nuniform float iTime;\nuniform float uLightMode;\nuniform vec3 uDarkBackground;\nuniform vec3 uLightBackground;\nout vec4 fragColor;\n\nconst float HUE = 0.663466752;\nconst float HUE_SPREAD = 0.314346701;\nconst float HUE_TRAVEL = 1.65112376;\nconst float CHROMA = 0.160295546;\nconst float LIGHTNESS = 0.537409723;\nconst float COLOUR_CYCLE = 0.124862425;\nconst float THETA = 2.12986207;\nconst float SHEAR = 0.968176901;\nconst float SHRINK = 0.955401778;\nconst float LAYERS = 72.0;\nconst float WARP_FREQ_X = 0.439311415;\nconst float WARP_FREQ_Y = 2.87923527;\nconst float WARP_AMP_X = 0.156202048;\nconst float WARP_AMP_Y = 0.0256033838;\nconst float ASPECT_X = 2.23183894;\nconst float ASPECT_Y = 0.15731883;\nconst float OFFSET_X = 0.375628948;\nconst float OFFSET_Y = -0.017801486;\nconst float TILT = 1.63293767;\nconst float ZOOM = 0.93135649;\nconst float CENTRE_X = -0.0956316143;\nconst float CENTRE_Y = -0.520057321;\nconst float GLOW_SIZE = 0.00201825937;\nconst float FALLOFF = 0.352821857;\nconst float VIGNETTE = 0.136085436;\nconst float FLOW_SPEED = 0.391012281;\nconst float FLOW_DIRECTION = 1.0;\nconst float BREATH_RATE = 0.382053256;\nconst float BREATH_AMOUNT = 0.0873704553;\nconst float PHASE = 56.3862724;\nconst float ECHO = 0.0;\nconst float ECHO_SHIFT = 0.178754866;\nconst float SOFTNESS = 0.00164903817;\nconst float LIGHT_SWING = 0.149726808;\n\nconst float TAU = 6.28318530718;\n\nvec3 oklchToLinear(float L, float C, float h) {\n float a = C * cos(h), b = C * sin(h);\n float l_ = L + 0.3963377774 * a + 0.2158037573 * b;\n float m_ = L - 0.1055613458 * a - 0.0638541728 * b;\n float s_ = L - 0.0894841775 * a - 1.2914855480 * b;\n vec3 lms = vec3(l_, m_, s_);\n lms = lms * lms * lms;\n return mat3(4.0767416621, -1.2684380046, -0.0041960863,\n -3.3077115913, 2.6097574011, -0.7034186147,\n 0.2309699292, -0.3413193965, 1.7076147010) * lms;\n}\n\nfloat blueNoise(vec2 p, float frame) {\n p += 5.588238 * mod(frame, 64.0);\n return fract(52.9829189 * fract(0.06711056 * p.x + 0.00583715 * p.y));\n}\n\nvoid main() {\n vec2 R = iResolution.xy;\n vec2 pos = (gl_FragCoord.xy - 0.5 * R) / R.y;\n float t = iTime * FLOW_SPEED * FLOW_DIRECTION + PHASE;\n float breath = (-sin(iTime * BREATH_RATE * 1.5) + sin(iTime * BREATH_RATE + 1.0)) * 0.25 + 0.5;\n\n vec2 u = (pos - vec2(CENTRE_X, CENTRE_Y)) * (ZOOM - breath * BREATH_AMOUNT);\n float ct = cos(TILT), st = sin(TILT);\n u = mat2(ct, st, -st, ct) * u;\n\n mat2 fold = mat2(cos(THETA), sin(THETA), -SHEAR, cos(THETA));\n\n float hue0 = HUE * TAU;\n float hue1 = hue0 + HUE_SPREAD * TAU;\n vec3 color = vec3(0.0);\n\n for (float i = 1.0; i <= 96.0; i += 1.0) {\n if (i > LAYERS) break;\n u.x += -sin(u.y * WARP_FREQ_X + t + i * 0.007) * WARP_AMP_X;\n u.y += -sin(u.x * WARP_FREQ_Y - t + i * 0.02) * WARP_AMP_Y;\n u = fold * u * SHRINK;\n\n vec2 q = u - vec2(OFFSET_X + breath * 0.1, OFFSET_Y);\n vec2 s = vec2(q.x * ASPECT_X, q.y * ASPECT_Y);\n float glow = GLOW_SIZE / (dot(s, s) + SOFTNESS);\n#ifndef SKIP_ECHO\n vec2 e = vec2((q.x - ECHO_SHIFT) * ASPECT_X, s.y);\n glow += ECHO * GLOW_SIZE / (dot(e, e) + SOFTNESS);\n#endif\n glow *= 0.25 + breath * 0.4;\n\n float r = length(u);\n float k = sin(i * COLOUR_CYCLE + t * 1.2 + r * HUE_TRAVEL) * 0.5 + 0.5;\n vec3 tint = clamp(oklchToLinear(LIGHTNESS + LIGHT_SWING * k, CHROMA * (0.75 + 0.35 * k), mix(hue0, hue1, k)), 0.0, 1.0);\n color += glow * tint * exp2(-r * FALLOFF);\n }\n\n vec3 x = max(color, 0.0);\n color = (x * (2.51 * x + 0.03)) / (x * (2.43 * x + 0.59) + 0.14);\n color = pow(clamp(color, 0.0, 1.0), vec3(0.85, 0.92, 0.98));\n\n float edge = smoothstep(0.5, 1.6, length(pos));\n color *= 1.0 - edge * VIGNETTE;\n\n vec3 dark = uDarkBackground + color * (1.0 - uDarkBackground);\n float strength = max(color.r, max(color.g, color.b));\n vec3 light = uLightBackground * (1.0 - strength) + color * 0.96;\n color = mix(dark, light, uLightMode);\n\n color += (blueNoise(gl_FragCoord.xy, floor(iTime * 24.0)) - 0.5) / 255.0;\n fragColor = vec4(clamp(color, 0.0, 1.0), 1.0);\n}\n`;\n\nconst HERO_HALFTONE = `#version 300 es\nprecision highp float;\n\nuniform sampler2D tScene;\nuniform vec2 iResolution;\nuniform float iTime;\nuniform float uLightMode;\nuniform vec3 uDarkBackground;\nuniform vec3 uLightBackground;\nuniform float uPixelRatio;\nout vec4 fragColor;\n\nconst float uStrength = 0.797335207;\nconst float uScale = 0.985214949;\nconst float uSeed = 0.435611069;\n\nconst float TAU = 6.28318530718;\nconst vec3 LUMA = vec3(0.2126, 0.7152, 0.0722);\n\nvec3 toInk(vec3 c) { return mix(c - uDarkBackground, uLightBackground - c, uLightMode); }\nvec3 fromInk(vec3 ink) { return mix(uDarkBackground + ink, uLightBackground - ink, uLightMode); }\nvec3 sceneInk(vec2 uv) { return toInk(texture(tScene, clamp(uv, 0.0, 1.0)).rgb); }\n\nfloat blueNoise(vec2 p, float frame) {\n p += 5.588238 * mod(frame, 64.0);\n return fract(52.9829189 * fract(0.06711056 * p.x + 0.00583715 * p.y));\n}\n\nvec3 halftone(vec2 frag) {\n float cell = max(3.0, uScale * 3.6 * uPixelRatio);\n float angle = 0.26 + uSeed * 0.3;\n mat2 turn = mat2(cos(angle), -sin(angle), sin(angle), cos(angle));\n vec2 rotated = turn * frag;\n vec2 grid = floor(rotated / cell);\n vec2 centre = (grid + 0.5) * cell;\n vec2 source = transpose(turn) * centre;\n vec3 soft = sceneInk(frag / iResolution);\n vec3 ink = sceneInk(source / iResolution);\n float level = clamp(dot(ink, LUMA), 0.0, 1.0);\n float radius = cell * sqrt(pow(level, 0.9) / 3.14159265);\n float dist = length(rotated - centre);\n float aa = 0.7 * uPixelRatio;\n float dot_ = 1.0 - smoothstep(radius - aa, radius + aa, dist);\n vec3 dots = ink * min(0.8 / max(level, 1e-3), 2.2) * dot_;\n float presence = smoothstep(0.03, 0.16, level) * (0.3 + 0.14 * uStrength);\n return mix(soft, dots, presence);\n}\n\nvoid main() {\n vec2 frag = gl_FragCoord.xy;\n vec3 ink = halftone(frag);\n vec3 color = fromInk(clamp(ink, 0.0, 1.0));\n color += (blueNoise(frag, floor(iTime * 24.0)) - 0.5) / 255.0;\n fragColor = vec4(clamp(color, 0.0, 1.0), 1.0);\n}\n`;\n\n// Project the unchanged hero field onto a seamless cylindrical surface.\n// Material flows inward along the tunnel; the camera never moves sideways.\n// Hold the hero's color/breath cycle at its initial phase. Only the tunnel\n// coordinates advance, so the ribbons do not enter the hero's darker phases.\nconst TUNNEL_FIELD = HERO_FIELD.replaceAll(\"iTime\", \"uMaterialTime\")\n .replace(\n \"uniform float uMaterialTime;\",\n `uniform float iTime;\n const float uMaterialTime = 0.0;\n uniform float uDepth;\n uniform float uTwist;\n uniform float uSpirals;\n uniform float uCameraZoom;\n vec2 tunnelPosition(vec2 frag) {\n vec2 view = (frag - iResolution * 0.5) / iResolution.y / uCameraZoom;\n float radius = max(length(view), 0.005);\n float z = 0.55 * uDepth / radius + iTime * 1.2;\n // Rotate the material explicitly so circular motion reads at every depth.\n // The camera and its centered projection remain fixed.\n // Integer angular repeats add ribbons without a seam or extra field passes.\n float angle = (atan(view.y, view.x)\n + (z * 0.3 + iTime * 1.5) * uTwist) * uSpirals;\n // Constant phase travels to smaller radii: r(t) = r(0) * exp(-2.4 * t).\n // Log spacing keeps the inward folds readable across the whole tunnel.\n float inward = log(radius / (0.55 * uDepth)) * 5.0 + iTime * 12.0;\n float ring = 0.68 + 0.1 * sin(inward);\n return vec2(cos(angle), sin(angle)) * ring\n + vec2(sin(inward) * 0.08, cos(inward) * 0.06 - 0.25);\n }`,\n )\n .replace(\n \"vec2 pos = (gl_FragCoord.xy - 0.5 * R) / R.y;\",\n \"vec2 pos = tunnelPosition(gl_FragCoord.xy);\",\n );\n\nconst TUNNEL_HALFTONE = HERO_HALFTONE.replace(\n \"uniform vec2 iResolution;\",\n \"uniform vec2 iResolution;\\nuniform float uGlow;\",\n).replace(\n \"fragColor = vec4(clamp(color, 0.0, 1.0), 1.0);\",\n `vec2 center = (gl_FragCoord.xy - iResolution * 0.5) / iResolution.y;\n // Defocus the actual field at the vanishing point instead of cutting a dark\n // circle into it. A Gaussian blend has no visible boundary around the center.\n float centerWeight = exp(-dot(center, center) / (2.0 * 0.065 * 0.065));\n if (centerWeight > 0.001) {\n vec3 blurred = vec3(0.0);\n float totalWeight = 0.0;\n vec2 spread = vec2(iResolution.y * 0.025) / iResolution;\n // Prefilter each tap so tight spiral turns do not reappear as ghost images.\n float blurLod = max(0.0, log2(iResolution.y * 0.025));\n vec2 uv = gl_FragCoord.xy / iResolution;\n for (int y = -2; y <= 2; y++) {\n for (int x = -2; x <= 2; x++) {\n vec2 offset = vec2(float(x), float(y));\n float weight = exp(-dot(offset, offset) * 0.5);\n blurred += textureLod(tScene, clamp(uv + offset * spread, 0.0, 1.0), blurLod).rgb * weight;\n totalWeight += weight;\n }\n }\n color = mix(color, blurred / totalWeight, centerWeight);\n }\n fragColor = vec4(clamp(color * uGlow, 0.0, 1.0), 1.0);`,\n);\n\nconst bounded = (value: number, fallback: number, min: number, max: number) =>\n Math.min(max, Math.max(min, Number.isFinite(value) ? value : fallback));\n\n/** Shared GPU renderer for the background and the spiral-pass transition. */\nexport function createTunnelRenderer(canvas: HTMLCanvasElement) {\n const gl = canvas.getContext(\"webgl2\", {\n alpha: false,\n antialias: false,\n depth: false,\n stencil: false,\n });\n if (!gl) throw new Error(\"Shader Light Tunnel requires WebGL2.\");\n const shaders: WebGLShader[] = [];\n const programs: WebGLProgram[] = [];\n let texture: WebGLTexture | null = null;\n let framebuffer: WebGLFramebuffer | null = null;\n const dispose = () => {\n for (const shader of shaders) gl.deleteShader(shader);\n for (const program of programs) gl.deleteProgram(program);\n gl.deleteTexture(texture);\n gl.deleteFramebuffer(framebuffer);\n };\n const compile = (fragment: string) => {\n const program = gl.createProgram();\n if (!program)\n throw new Error(\"Shader Light Tunnel: GPU allocation failed.\");\n programs.push(program);\n for (const [type, source] of [\n [gl.VERTEX_SHADER, VERTEX],\n [gl.FRAGMENT_SHADER, fragment],\n ] as const) {\n const shader = gl.createShader(type);\n if (!shader)\n throw new Error(\"Shader Light Tunnel: shader allocation failed.\");\n shaders.push(shader);\n gl.shaderSource(shader, source);\n gl.compileShader(shader);\n if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS))\n throw new Error(\n gl.getShaderInfoLog(shader) ?? \"Tunnel shader compilation failed.\",\n );\n gl.attachShader(program, shader);\n }\n gl.linkProgram(program);\n if (!gl.getProgramParameter(program, gl.LINK_STATUS))\n throw new Error(\n gl.getProgramInfoLog(program) ?? \"Tunnel shader link failed.\",\n );\n const locations = new Map<string, WebGLUniformLocation | null>();\n const uniform = (name: string) => {\n if (!locations.has(name))\n locations.set(name, gl.getUniformLocation(program, name));\n return locations.get(name) ?? null;\n };\n return {\n begin: (\n time: number,\n twist: number,\n glow: number,\n depth: number,\n spirals: number,\n cameraZoom = 1,\n ) => {\n gl.useProgram(program);\n gl.viewport(0, 0, canvas.width, canvas.height);\n gl.uniform2f(uniform(\"iResolution\"), canvas.width, canvas.height);\n gl.uniform1f(uniform(\"iTime\"), time);\n gl.uniform1f(uniform(\"uLightMode\"), 0);\n gl.uniform3f(uniform(\"uDarkBackground\"), 9 / 255, 9 / 255, 9 / 255);\n gl.uniform3f(uniform(\"uLightBackground\"), 1, 1, 1);\n gl.uniform1f(uniform(\"uPixelRatio\"), 1);\n gl.uniform1f(uniform(\"uTwist\"), bounded(twist, 0.7, 0, 2));\n gl.uniform1f(\n uniform(\"uSpirals\"),\n Math.round(bounded(spirals, 3, 1, 6)),\n );\n gl.uniform1f(uniform(\"uGlow\"), bounded(glow, 1, 0, 3));\n gl.uniform1f(uniform(\"uDepth\"), bounded(depth, 1, 0.5, 2));\n gl.uniform1f(uniform(\"uCameraZoom\"), bounded(cameraZoom, 1, 1, 32));\n gl.uniform1i(uniform(\"tScene\"), 0);\n },\n };\n };\n try {\n const field = compile(TUNNEL_FIELD);\n const halftone = compile(TUNNEL_HALFTONE);\n texture = gl.createTexture();\n framebuffer = gl.createFramebuffer();\n if (!texture || !framebuffer)\n throw new Error(\"Shader Light Tunnel: render target allocation failed.\");\n gl.activeTexture(gl.TEXTURE0);\n gl.bindTexture(gl.TEXTURE_2D, texture);\n gl.texParameteri(\n gl.TEXTURE_2D,\n gl.TEXTURE_MIN_FILTER,\n gl.LINEAR_MIPMAP_LINEAR,\n );\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);\n let targetWidth = 0,\n targetHeight = 0;\n return {\n dispose,\n draw: (\n time: number,\n twist: number,\n glow: number,\n depth: number,\n spirals: number,\n cameraZoom = 1,\n ) => {\n if (gl.isContextLost())\n throw new Error(\"Shader Light Tunnel: WebGL context lost.\");\n gl.bindFramebuffer(gl.FRAMEBUFFER, framebuffer);\n gl.bindTexture(gl.TEXTURE_2D, texture);\n if (targetWidth !== canvas.width || targetHeight !== canvas.height) {\n gl.texImage2D(\n gl.TEXTURE_2D,\n 0,\n gl.RGBA,\n canvas.width,\n canvas.height,\n 0,\n gl.RGBA,\n gl.UNSIGNED_BYTE,\n null,\n );\n gl.framebufferTexture2D(\n gl.FRAMEBUFFER,\n gl.COLOR_ATTACHMENT0,\n gl.TEXTURE_2D,\n texture,\n 0,\n );\n if (\n gl.checkFramebufferStatus(gl.FRAMEBUFFER) !==\n gl.FRAMEBUFFER_COMPLETE\n )\n throw new Error(\"Shader Light Tunnel: incomplete framebuffer.\");\n targetWidth = canvas.width;\n targetHeight = canvas.height;\n }\n field.begin(time, twist, glow, depth, spirals, cameraZoom);\n gl.drawArrays(gl.TRIANGLES, 0, 3);\n gl.bindFramebuffer(gl.FRAMEBUFFER, null);\n gl.generateMipmap(gl.TEXTURE_2D);\n halftone.begin(time, twist, glow, depth, spirals);\n gl.drawArrays(gl.TRIANGLES, 0, 3);\n },\n };\n } catch (error) {\n dispose();\n throw error;\n }\n}\n\nexport function ShaderLightTunnel({\n speed = 1,\n twist = 0.7,\n spirals = 3,\n glow = 1,\n depth = 1,\n timeOffset = 0,\n}: ShaderLightTunnelProps) {\n const frame = useCurrentFrame();\n const { width, height, fps } = useVideoConfig();\n const { delayRender, continueRender, cancelRender } = useDelayRender();\n const canvas = useRef<HTMLCanvasElement>(null);\n const renderer = useRef<ReturnType<typeof createTunnelRenderer> | null>(null);\n\n useLayoutEffect(() => {\n if (!canvas.current) return;\n const handle = delayRender(\"Initialize Shader Light Tunnel\");\n try {\n renderer.current = createTunnelRenderer(canvas.current);\n continueRender(handle);\n } catch (error) {\n cancelRender(error instanceof Error ? error : new Error(String(error)));\n }\n return () => {\n renderer.current?.dispose();\n renderer.current = null;\n };\n }, [delayRender, continueRender, cancelRender]);\n\n // biome-ignore lint/correctness/useExhaustiveDependencies: canvas resizing clears its buffer, including on paused frames.\n useLayoutEffect(() => {\n try {\n const time =\n bounded(timeOffset, 0, -10000, 10000) +\n (frame / fps) * bounded(speed, 1, 0, 5);\n renderer.current?.draw(time, twist, glow, depth, spirals);\n } catch (error) {\n cancelRender(error instanceof Error ? error : new Error(String(error)));\n }\n }, [\n frame,\n fps,\n width,\n height,\n speed,\n twist,\n spirals,\n glow,\n depth,\n timeOffset,\n cancelRender,\n ]);\n\n return (\n <canvas\n ref={canvas}\n width={width}\n height={height}\n aria-hidden=\"true\"\n tabIndex={-1}\n style={{\n position: \"absolute\",\n inset: 0,\n width: \"100%\",\n height: \"100%\",\n pointerEvents: \"none\",\n }}\n />\n );\n}\n",
+ "type": "registry:component",
+ "target": "components/remocn/shader-light-tunnel.tsx"
+ }
+ ],
+ "type": "registry:component"
+}
diff --git a/registry-artifacts/shader-seam.json b/registry-artifacts/shader-seam.json
new file mode 100644
index 00000000..28a83f5d
--- /dev/null
+++ b/registry-artifacts/shader-seam.json
@@ -0,0 +1,16 @@
+{
+ "$schema": "https://ui.shadcn.com/schema/registry-item.json",
+ "name": "shader-seam",
+ "title": "Shader Seam",
+ "description": "Dissolve a stationary OpenShaders material to uncover the next scene.",
+ "dependencies": ["remotion", "@remotion/transitions"],
+ "files": [
+ {
+ "path": "registry/remocn/shader-seam/index.tsx",
+ "content": "\"use client\";\n\nimport type {\n TransitionPresentation,\n TransitionPresentationComponentProps,\n} from \"@remotion/transitions\";\nimport { useLayoutEffect, useRef } from \"react\";\nimport { AbsoluteFill, useDelayRender, useVideoConfig } from \"remotion\";\n\n/* @remocn · OpenShaders — https://openshaders.com/@remocn\n * Original field and halftone GLSL from the site's React · WebGL export.\n * The frame-driven renderer, dissolve compositing and scene exchange are remocn's.\n */\n\nconst VERTEX_SHADER = `#version 300 es\nvoid main() {\n vec2 position = vec2(float((gl_VertexID << 1) & 2), float(gl_VertexID & 2));\n gl_Position = vec4(position * 2.0 - 1.0, 0.0, 1.0);\n}\n`;\n\nconst FIELD_SHADER = `#version 300 es\nprecision highp float;\n\nuniform vec2 iResolution;\nuniform float iTime;\nuniform float uLightMode;\nuniform vec3 uDarkBackground;\nuniform vec3 uLightBackground;\nout vec4 fragColor;\n\nconst float HUE = 0.663466752;\nconst float HUE_SPREAD = 0.314346701;\nconst float HUE_TRAVEL = 1.65112376;\nconst float CHROMA = 0.160295546;\nconst float LIGHTNESS = 0.537409723;\nconst float COLOUR_CYCLE = 0.124862425;\nconst float THETA = 2.12986207;\nconst float SHEAR = 0.968176901;\nconst float SHRINK = 0.955401778;\nconst float LAYERS = 72.0;\nconst float WARP_FREQ_X = 0.439311415;\nconst float WARP_FREQ_Y = 2.87923527;\nconst float WARP_AMP_X = 0.156202048;\nconst float WARP_AMP_Y = 0.0256033838;\nconst float ASPECT_X = 2.23183894;\nconst float ASPECT_Y = 0.15731883;\nconst float OFFSET_X = 0.375628948;\nconst float OFFSET_Y = -0.017801486;\nconst float TILT = 1.63293767;\nconst float ZOOM = 0.93135649;\nconst float CENTRE_X = -0.0956316143;\nconst float CENTRE_Y = -0.520057321;\nconst float GLOW_SIZE = 0.00201825937;\nconst float FALLOFF = 0.352821857;\nconst float VIGNETTE = 0.136085436;\nconst float FLOW_SPEED = 0.391012281;\nconst float FLOW_DIRECTION = 1.0;\nconst float BREATH_RATE = 0.382053256;\nconst float BREATH_AMOUNT = 0.0873704553;\nconst float PHASE = 56.3862724;\nconst float ECHO = 0.0;\nconst float ECHO_SHIFT = 0.178754866;\nconst float SOFTNESS = 0.00164903817;\nconst float LIGHT_SWING = 0.149726808;\n\nconst float TAU = 6.28318530718;\n\nvec3 oklchToLinear(float L, float C, float h) {\n float a = C * cos(h), b = C * sin(h);\n float l_ = L + 0.3963377774 * a + 0.2158037573 * b;\n float m_ = L - 0.1055613458 * a - 0.0638541728 * b;\n float s_ = L - 0.0894841775 * a - 1.2914855480 * b;\n vec3 lms = vec3(l_, m_, s_);\n lms = lms * lms * lms;\n return mat3(4.0767416621, -1.2684380046, -0.0041960863,\n -3.3077115913, 2.6097574011, -0.7034186147,\n 0.2309699292, -0.3413193965, 1.7076147010) * lms;\n}\n\nfloat blueNoise(vec2 p, float frame) {\n p += 5.588238 * mod(frame, 64.0);\n return fract(52.9829189 * fract(0.06711056 * p.x + 0.00583715 * p.y));\n}\n\nvoid main() {\n vec2 R = iResolution.xy;\n vec2 pos = (gl_FragCoord.xy - 0.5 * R) / R.y;\n float t = iTime * FLOW_SPEED * FLOW_DIRECTION + PHASE;\n float breath = (-sin(iTime * BREATH_RATE * 1.5) + sin(iTime * BREATH_RATE + 1.0)) * 0.25 + 0.5;\n\n vec2 u = (pos - vec2(CENTRE_X, CENTRE_Y)) * (ZOOM - breath * BREATH_AMOUNT);\n float ct = cos(TILT), st = sin(TILT);\n u = mat2(ct, st, -st, ct) * u;\n\n mat2 fold = mat2(cos(THETA), sin(THETA), -SHEAR, cos(THETA));\n\n float hue0 = HUE * TAU;\n float hue1 = hue0 + HUE_SPREAD * TAU;\n vec3 color = vec3(0.0);\n\n for (float i = 1.0; i <= 96.0; i += 1.0) {\n if (i > LAYERS) break;\n u.x += -sin(u.y * WARP_FREQ_X + t + i * 0.007) * WARP_AMP_X;\n u.y += -sin(u.x * WARP_FREQ_Y - t + i * 0.02) * WARP_AMP_Y;\n u = fold * u * SHRINK;\n\n vec2 q = u - vec2(OFFSET_X + breath * 0.1, OFFSET_Y);\n vec2 s = vec2(q.x * ASPECT_X, q.y * ASPECT_Y);\n float glow = GLOW_SIZE / (dot(s, s) + SOFTNESS);\n#ifndef SKIP_ECHO\n vec2 e = vec2((q.x - ECHO_SHIFT) * ASPECT_X, s.y);\n glow += ECHO * GLOW_SIZE / (dot(e, e) + SOFTNESS);\n#endif\n glow *= 0.25 + breath * 0.4;\n\n float r = length(u);\n float k = sin(i * COLOUR_CYCLE + t * 1.2 + r * HUE_TRAVEL) * 0.5 + 0.5;\n vec3 tint = clamp(oklchToLinear(LIGHTNESS + LIGHT_SWING * k, CHROMA * (0.75 + 0.35 * k), mix(hue0, hue1, k)), 0.0, 1.0);\n color += glow * tint * exp2(-r * FALLOFF);\n }\n\n vec3 x = max(color, 0.0);\n color = (x * (2.51 * x + 0.03)) / (x * (2.43 * x + 0.59) + 0.14);\n color = pow(clamp(color, 0.0, 1.0), vec3(0.85, 0.92, 0.98));\n\n float edge = smoothstep(0.5, 1.6, length(pos));\n color *= 1.0 - edge * VIGNETTE;\n\n vec3 dark = uDarkBackground + color * (1.0 - uDarkBackground);\n float strength = max(color.r, max(color.g, color.b));\n vec3 light = uLightBackground * (1.0 - strength) + color * 0.96;\n color = mix(dark, light, uLightMode);\n\n color += (blueNoise(gl_FragCoord.xy, floor(iTime * 24.0)) - 0.5) / 255.0;\n fragColor = vec4(clamp(color, 0.0, 1.0), 1.0);\n}\n`;\n\nconst RARITY_SHADER = `#version 300 es\nprecision highp float;\n\nuniform sampler2D tScene;\nuniform vec2 iResolution;\nuniform float iTime;\nuniform float uLightMode;\nuniform vec3 uDarkBackground;\nuniform vec3 uLightBackground;\nuniform float uPixelRatio;\nout vec4 fragColor;\n\nconst float uStrength = 0.797335207;\nconst float uScale = 0.985214949;\nconst float uSeed = 0.435611069;\n\nconst float TAU = 6.28318530718;\nconst vec3 LUMA = vec3(0.2126, 0.7152, 0.0722);\n\nvec3 toInk(vec3 c) { return mix(c - uDarkBackground, uLightBackground - c, uLightMode); }\nvec3 fromInk(vec3 ink) { return mix(uDarkBackground + ink, uLightBackground - ink, uLightMode); }\nvec3 sceneInk(vec2 uv) { return toInk(texture(tScene, clamp(uv, 0.0, 1.0)).rgb); }\n\nfloat blueNoise(vec2 p, float frame) {\n p += 5.588238 * mod(frame, 64.0);\n return fract(52.9829189 * fract(0.06711056 * p.x + 0.00583715 * p.y));\n}\n\nvec3 halftone(vec2 frag) {\n float cell = max(3.0, uScale * 3.6 * uPixelRatio);\n float angle = 0.26 + uSeed * 0.3;\n mat2 turn = mat2(cos(angle), -sin(angle), sin(angle), cos(angle));\n vec2 rotated = turn * frag;\n vec2 grid = floor(rotated / cell);\n vec2 centre = (grid + 0.5) * cell;\n vec2 source = transpose(turn) * centre;\n vec3 soft = sceneInk(frag / iResolution);\n vec3 ink = sceneInk(source / iResolution);\n float level = clamp(dot(ink, LUMA), 0.0, 1.0);\n float radius = cell * sqrt(pow(level, 0.9) / 3.14159265);\n float dist = length(rotated - centre);\n float aa = 0.7 * uPixelRatio;\n float dot_ = 1.0 - smoothstep(radius - aa, radius + aa, dist);\n vec3 dots = ink * min(0.8 / max(level, 1e-3), 2.2) * dot_;\n float presence = smoothstep(0.03, 0.16, level) * (0.3 + 0.14 * uStrength);\n return mix(soft, dots, presence);\n}\n\nvoid main() {\n vec2 frag = gl_FragCoord.xy;\n vec3 ink = halftone(frag);\n vec3 color = fromInk(clamp(ink, 0.0, 1.0));\n color += (blueNoise(frag, floor(iTime * 24.0)) - 0.5) / 255.0;\n fragColor = vec4(clamp(color, 0.0, 1.0), 1.0);\n}\n`;\n\nexport type OpenShaderSource = {\n /** OpenShaders' exported FIELD_SHADER, including #version 300 es. */\n field: string;\n /** Optional RARITY_SHADER using tScene. Extra texture inputs need an adapter. */\n postprocess?: string;\n};\n\nexport const remocnOpenShader: OpenShaderSource = {\n field: FIELD_SHADER,\n postprocess: RARITY_SHADER,\n};\n\nexport type ShaderSeamProps = {\n /** Softness of the material's dissolve edge, clamped to 0.02–0.4. */\n softness?: number;\n /** Organic variation mixed into the material's brightness, from 0 to 1. */\n detail?: number;\n /** Internal field animation speed. The default 0 keeps the material still. */\n speed?: number;\n /** Starting time in seconds in the selected shader. */\n timeOffset?: number;\n shader?: OpenShaderSource;\n};\n\nconst clamp = (value: number, min: number, max: number) =>\n Math.min(max, Math.max(min, value));\n\n// Exchange the scenes only while the shader is opaque across the entire frame.\nexport function getShaderSeamPhase(progress: number) {\n const p = clamp(progress, 0, 1);\n const smoother = (t: number) => t * t * t * (t * (t * 6 - 15) + 10);\n return {\n presence: smoother(clamp(p / 0.34, 0, 1)),\n dissolve: smoother(clamp((p - 0.46) / 0.54, 0, 1)),\n showNext: p >= 0.4,\n };\n}\n\ntype SeamPhase = ReturnType<typeof getShaderSeamPhase>;\n\nconst DISSOLVE_COMPOSITE = `#version 300 es\nprecision highp float;\nuniform vec2 iResolution;\nuniform sampler2D tScene;\nuniform sampler2D tField;\nuniform float uPresence;\nuniform float uDissolve;\nuniform float uSoftness;\nuniform float uDetail;\nout vec4 fragColor;\n\nfloat hash(vec2 p) {\n return fract(sin(dot(p, vec2(127.1, 311.7))) * 43758.5453);\n}\nfloat noise(vec2 p) {\n vec2 i = floor(p), f = fract(p);\n f = f * f * (3.0 - 2.0 * f);\n return mix(mix(hash(i), hash(i + vec2(1, 0)), f.x),\n mix(hash(i + vec2(0, 1)), hash(i + vec2(1, 1)), f.x), f.y);\n}\nvoid main() {\n vec2 uv = gl_FragCoord.xy / iResolution;\n vec2 p = gl_FragCoord.xy / iResolution.y;\n vec3 field = texture(tField, uv).rgb;\n float energy = max(field.r, max(field.g, field.b));\n // Static, continuous noise breaks up the field without making it travel.\n float grain = noise(p * 7.0) * 0.6 + noise(p * 19.0) * 0.28\n + noise(p * 43.0) * 0.12;\n float density = mix(smoothstep(0.025, 0.95, energy), grain, uDetail * 0.55);\n float appear = mix(1.0 + uSoftness, -uSoftness, uPresence);\n float disappear = mix(-uSoftness, 1.0 + uSoftness, uDissolve);\n float alpha = smoothstep(appear - uSoftness, appear + uSoftness, density)\n * smoothstep(disappear - uSoftness, disappear + uSoftness, density);\n vec3 material = texture(tScene, uv).rgb;\n fragColor = vec4(material * alpha, alpha);\n}\n`;\n\nfunction createSeamRenderer(\n canvas: HTMLCanvasElement,\n source: OpenShaderSource,\n) {\n const gl = canvas.getContext(\"webgl2\", {\n alpha: true,\n premultipliedAlpha: true,\n antialias: false,\n depth: false,\n stencil: false,\n });\n if (!gl) throw new Error(\"Shader Seam requires WebGL2.\");\n const programs: WebGLProgram[] = [];\n const textures: WebGLTexture[] = [];\n const buffers: WebGLFramebuffer[] = [];\n const shaders: WebGLShader[] = [];\n const dispose = () => {\n for (const program of programs) gl.deleteProgram(program);\n for (const texture of textures) gl.deleteTexture(texture);\n for (const buffer of buffers) gl.deleteFramebuffer(buffer);\n for (const shader of shaders) gl.deleteShader(shader);\n };\n const program = (fragment: string, sceneInput = false, flowInput = false) => {\n const result = gl.createProgram();\n if (!result) throw new Error(\"Shader Seam: could not create a program.\");\n programs.push(result);\n for (const [type, code] of [\n [gl.VERTEX_SHADER, VERTEX_SHADER],\n [gl.FRAGMENT_SHADER, fragment],\n ] as const) {\n const shader = gl.createShader(type);\n if (!shader) throw new Error(\"Shader Seam: could not allocate a shader.\");\n shaders.push(shader);\n gl.shaderSource(shader, code);\n gl.compileShader(shader);\n if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) {\n throw new Error(`Shader Seam: ${gl.getShaderInfoLog(shader)}`);\n }\n gl.attachShader(result, shader);\n }\n gl.linkProgram(result);\n if (!gl.getProgramParameter(result, gl.LINK_STATUS)) {\n throw new Error(`Shader Seam: ${gl.getProgramInfoLog(result)}`);\n }\n const locations = new Map<string, WebGLUniformLocation | null>();\n const uniform = (name: string) => {\n if (!locations.has(name))\n locations.set(name, gl.getUniformLocation(result, name));\n return locations.get(name) ?? null;\n };\n // Fail explicitly for exports requiring assets this adapter cannot supply.\n for (\n let i = 0;\n i < gl.getProgramParameter(result, gl.ACTIVE_UNIFORMS);\n i++\n ) {\n const info = gl.getActiveUniform(result, i);\n if (\n info &&\n (info.type === gl.SAMPLER_2D || info.type === gl.SAMPLER_CUBE) &&\n !(sceneInput && info.name === \"tScene\") &&\n !(flowInput && info.name === \"tField\")\n ) {\n throw new Error(\n `Shader Seam: ${info.name} needs an additional texture adapter.`,\n );\n }\n }\n return {\n begin: (\n w: number,\n h: number,\n time: number,\n phase: SeamPhase,\n softness: number,\n detail: number,\n ) => {\n gl.useProgram(result);\n gl.viewport(0, 0, w, h);\n gl.uniform2f(uniform(\"iResolution\"), w, h);\n gl.uniform1f(uniform(\"iTime\"), time);\n gl.uniform1f(uniform(\"uLightMode\"), 0);\n gl.uniform3f(uniform(\"uDarkBackground\"), 9 / 255, 9 / 255, 9 / 255);\n gl.uniform3f(uniform(\"uLightBackground\"), 1, 1, 1);\n gl.uniform1f(uniform(\"uPixelRatio\"), 1);\n gl.uniform2f(uniform(\"uTilt\"), 0, 0);\n gl.uniform1i(uniform(\"tScene\"), 0);\n gl.uniform1i(uniform(\"tField\"), 1);\n gl.uniform1f(uniform(\"uPresence\"), phase.presence);\n gl.uniform1f(uniform(\"uDissolve\"), phase.dissolve);\n gl.uniform1f(uniform(\"uSoftness\"), softness);\n gl.uniform1f(uniform(\"uDetail\"), detail);\n },\n };\n };\n const target = () => {\n const texture = gl.createTexture();\n const framebuffer = gl.createFramebuffer();\n if (texture) textures.push(texture);\n if (framebuffer) buffers.push(framebuffer);\n if (!texture || !framebuffer)\n throw new Error(\"Shader Seam: could not create render target.\");\n gl.activeTexture(gl.TEXTURE0);\n gl.bindTexture(gl.TEXTURE_2D, texture);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);\n let size = \"\";\n return {\n texture,\n bind: (width: number, height: number) => {\n gl.bindFramebuffer(gl.FRAMEBUFFER, framebuffer);\n if (size !== `${width}:${height}`) {\n gl.activeTexture(gl.TEXTURE0);\n gl.bindTexture(gl.TEXTURE_2D, texture);\n gl.texImage2D(\n gl.TEXTURE_2D,\n 0,\n gl.RGBA,\n width,\n height,\n 0,\n gl.RGBA,\n gl.UNSIGNED_BYTE,\n null,\n );\n gl.framebufferTexture2D(\n gl.FRAMEBUFFER,\n gl.COLOR_ATTACHMENT0,\n gl.TEXTURE_2D,\n texture,\n 0,\n );\n if (\n gl.checkFramebufferStatus(gl.FRAMEBUFFER) !==\n gl.FRAMEBUFFER_COMPLETE\n ) {\n throw new Error(\"Shader Seam: incomplete render target.\");\n }\n size = `${width}:${height}`;\n }\n },\n };\n };\n try {\n const field = program(source.field);\n const post = source.postprocess ? program(source.postprocess, true) : null;\n const composite = program(DISSOLVE_COMPOSITE, true, true);\n const full = target();\n const material = target();\n const bindTexture = (texture: WebGLTexture, unit: number) => {\n gl.activeTexture(unit === 0 ? gl.TEXTURE0 : gl.TEXTURE1);\n gl.bindTexture(gl.TEXTURE_2D, texture);\n };\n return {\n dispose,\n draw: (\n width: number,\n height: number,\n time: number,\n phase: SeamPhase,\n softness: number,\n detail: number,\n ) => {\n if (gl.isContextLost())\n throw new Error(\"Shader Seam: WebGL context was lost.\");\n if (canvas.width !== width) canvas.width = width;\n if (canvas.height !== height) canvas.height = height;\n full.bind(width, height);\n field.begin(width, height, time, phase, softness, detail);\n gl.drawArrays(gl.TRIANGLES, 0, 3);\n if (post) {\n material.bind(width, height);\n post.begin(width, height, time, phase, softness, detail);\n bindTexture(full.texture, 0);\n gl.drawArrays(gl.TRIANGLES, 0, 3);\n }\n gl.bindFramebuffer(gl.FRAMEBUFFER, null);\n composite.begin(width, height, time, phase, softness, detail);\n bindTexture(post ? material.texture : full.texture, 0);\n bindTexture(full.texture, 1);\n gl.drawArrays(gl.TRIANGLES, 0, 3);\n },\n };\n } catch (error) {\n dispose();\n throw error;\n }\n}\n\nfunction ShaderSeamPresentation({\n children,\n presentationProgress,\n presentationDirection,\n presentationDurationInFrames,\n passedProps,\n}: TransitionPresentationComponentProps<ShaderSeamProps>) {\n const { width, height, fps } = useVideoConfig();\n const { delayRender, continueRender, cancelRender } = useDelayRender();\n const canvas = useRef<HTMLCanvasElement>(null);\n const renderer = useRef<ReturnType<typeof createSeamRenderer> | null>(null);\n const entering = presentationDirection === \"entering\";\n const {\n softness = 0.18,\n detail = 0.65,\n speed = 0,\n timeOffset = 0,\n shader = remocnOpenShader,\n } = passedProps;\n const { field, postprocess } = shader;\n const p = clamp(presentationProgress, 0, 1);\n const active = entering && p > 0 && p < 1;\n const phase = getShaderSeamPhase(p);\n\n useLayoutEffect(() => {\n if (!active || !canvas.current) return;\n const handle = delayRender(\"Initialize Shader Seam\");\n try {\n renderer.current = createSeamRenderer(canvas.current, {\n field,\n postprocess,\n });\n continueRender(handle);\n } catch (error) {\n cancelRender(error instanceof Error ? error : new Error(String(error)));\n }\n return () => {\n renderer.current?.dispose();\n renderer.current = null;\n };\n }, [active, field, postprocess, delayRender, continueRender, cancelRender]);\n\n // biome-ignore lint/correctness/useExhaustiveDependencies: redraw a newly compiled source even when the playhead is paused.\n useLayoutEffect(() => {\n if (!active || !canvas.current) return;\n try {\n const time =\n timeOffset + ((p * presentationDurationInFrames) / fps) * speed;\n renderer.current?.draw(\n width,\n height,\n time,\n getShaderSeamPhase(p),\n clamp(softness, 0.02, 0.4),\n clamp(detail, 0, 1),\n );\n } catch (error) {\n cancelRender(error instanceof Error ? error : new Error(String(error)));\n }\n }, [\n p,\n active,\n width,\n height,\n fps,\n softness,\n detail,\n speed,\n timeOffset,\n presentationDurationInFrames,\n entering,\n field,\n postprocess,\n cancelRender,\n ]);\n\n return (\n <AbsoluteFill style={{ overflow: \"hidden\" }}>\n <AbsoluteFill\n style={{\n visibility: entering !== phase.showNext ? \"hidden\" : \"visible\",\n }}\n >\n {children}\n </AbsoluteFill>\n <canvas\n ref={canvas}\n aria-hidden=\"true\"\n tabIndex={-1}\n style={{\n position: \"absolute\",\n inset: 0,\n width: \"100%\",\n height: \"100%\",\n visibility: entering && active ? \"visible\" : \"hidden\",\n pointerEvents: \"none\",\n }}\n />\n </AbsoluteFill>\n );\n}\n\nexport function shaderSeam(\n props: ShaderSeamProps = {},\n): TransitionPresentation<ShaderSeamProps> {\n return { component: ShaderSeamPresentation, props };\n}\n",
+ "type": "registry:component",
+ "target": "components/remocn/shader-seam.tsx"
+ }
+ ],
+ "type": "registry:component"
+}
diff --git a/registry-artifacts/shader-spiral-pass.json b/registry-artifacts/shader-spiral-pass.json
new file mode 100644
index 00000000..8c8fa4c0
--- /dev/null
+++ b/registry-artifacts/shader-spiral-pass.json
@@ -0,0 +1,17 @@
+{
+ "$schema": "https://ui.shadcn.com/schema/registry-item.json",
+ "name": "shader-spiral-pass",
+ "title": "Shader Spiral Pass",
+ "description": "Accelerate into the hero spiral and emerge through its soft center into the next scene.",
+ "dependencies": ["remotion", "@remotion/transitions"],
+ "registryDependencies": ["@remocn/shader-light-tunnel"],
+ "files": [
+ {
+ "path": "registry/remocn/shader-spiral-pass/index.tsx",
+ "content": "\"use client\";\n\nimport type {\n TransitionPresentation,\n TransitionPresentationComponentProps,\n} from \"@remotion/transitions\";\nimport { useLayoutEffect, useRef } from \"react\";\nimport { AbsoluteFill, useDelayRender, useVideoConfig } from \"remotion\";\nimport { createTunnelRenderer } from \"@/components/remocn/shader-light-tunnel\";\n\nexport type ShaderSpiralPassProps = {\n /** Shader motion multiplier; transition duration is controlled by timing. */\n speed?: number;\n spirals?: number;\n twist?: number;\n /** Magnification reached while passing through the center, from 2 to 24. */\n zoom?: number;\n /** Feather width as a fraction of the shorter composition dimension. */\n softness?: number;\n timeOffset?: number;\n};\n\nconst clamp = (value: number, min: number, max: number) =>\n Math.min(max, Math.max(min, value));\nconst finite = (value: number, fallback: number, min: number, max: number) =>\n clamp(Number.isFinite(value) ? value : fallback, min, max);\nconst smooth = (start: number, end: number, value: number) => {\n const t = clamp((value - start) / (end - start), 0, 1);\n return t * t * (3 - 2 * t);\n};\n\n/** Pure phase calculation also used to verify endpoint and coverage behavior. */\nexport function getSpiralPassPhase(progress: number, zoom = 14) {\n const p = finite(progress, 0, 0, 1);\n const dive = clamp((p - 0.08) / 0.84, 0, 1);\n return {\n cover: smooth(0, 0.18, p),\n showNext: p >= 0.2,\n zoom: Math.exp(Math.log(finite(zoom, 14, 2, 24)) * dive * dive),\n aperture: smooth(0.64, 1, p) ** 2,\n outgoingZoom: 1 + 0.5 * smooth(0, 0.22, p),\n incomingZoom: 1 + 0.12 * (1 - smooth(0.55, 1, p)),\n };\n}\n\nfunction ShaderSpiralPassPresentation({\n children,\n presentationProgress,\n presentationDirection,\n presentationDurationInFrames,\n passedProps,\n}: TransitionPresentationComponentProps<ShaderSpiralPassProps>) {\n const { width, height, fps } = useVideoConfig();\n const { delayRender, continueRender, cancelRender } = useDelayRender();\n const canvas = useRef<HTMLCanvasElement>(null);\n const renderer = useRef<ReturnType<typeof createTunnelRenderer> | null>(null);\n const {\n speed = 1,\n spirals = 3,\n twist = 0.7,\n zoom = 14,\n softness = 0.12,\n timeOffset = 0,\n } = passedProps;\n const p = finite(presentationProgress, 0, 0, 1);\n const entering = presentationDirection === \"entering\";\n const active = entering && p > 0 && p < 1;\n const phase = getSpiralPassPhase(p, zoom);\n const feather = Math.min(width, height) * finite(softness, 0.12, 0.02, 0.3);\n const radius = (Math.hypot(width, height) / 2 + feather) * phase.aperture;\n // Clip the incoming scene itself, in screen space. Its content must never\n // extend through the shader outside the exit, even when the scene is scaled.\n const edge = Math.min(feather, radius * 0.12);\n const sceneMask =\n entering && p < 1\n ? `radial-gradient(circle at center, black ${Math.max(0, radius - edge)}px, transparent ${radius}px)`\n : undefined;\n\n useLayoutEffect(() => {\n if (!active || !canvas.current) return;\n const handle = delayRender(\"Initialize Shader Spiral Pass\");\n try {\n renderer.current = createTunnelRenderer(canvas.current);\n continueRender(handle);\n } catch (error) {\n cancelRender(error instanceof Error ? error : new Error(String(error)));\n }\n return () => {\n renderer.current?.dispose();\n renderer.current = null;\n };\n }, [active, delayRender, continueRender, cancelRender]);\n\n // biome-ignore lint/correctness/useExhaustiveDependencies: canvas resizing clears its pixels, including while paused.\n useLayoutEffect(() => {\n if (!active) return;\n try {\n // Integrate acceleration so shader motion speeds up without a time jump.\n const seconds = (p * presentationDurationInFrames) / fps;\n const time =\n finite(timeOffset, 0, -10000, 10000) +\n seconds * (1 + 0.8 * p * p) * finite(speed, 1, 0, 5);\n renderer.current?.draw(time, twist, 1, 1, spirals, phase.zoom);\n } catch (error) {\n cancelRender(error instanceof Error ? error : new Error(String(error)));\n }\n }, [\n active,\n p,\n presentationDurationInFrames,\n fps,\n speed,\n timeOffset,\n twist,\n spirals,\n phase.zoom,\n width,\n height,\n cancelRender,\n ]);\n\n return (\n <AbsoluteFill style={{ overflow: \"hidden\" }}>\n {active && (\n <AbsoluteFill\n style={{\n opacity: phase.cover,\n pointerEvents: \"none\",\n }}\n >\n <canvas\n ref={canvas}\n width={width}\n height={height}\n aria-hidden=\"true\"\n tabIndex={-1}\n style={{\n position: \"absolute\",\n inset: 0,\n width: \"100%\",\n height: \"100%\",\n }}\n />\n </AbsoluteFill>\n )}\n <AbsoluteFill\n style={{\n visibility: entering !== phase.showNext ? \"hidden\" : \"visible\",\n opacity: entering && p < 1 ? smooth(0.64, 0.72, p) : 1,\n maskImage: sceneMask,\n WebkitMaskImage: sceneMask,\n }}\n >\n <AbsoluteFill\n style={{\n transform: `scale(${entering ? phase.incomingZoom : phase.outgoingZoom})`,\n transformOrigin: \"center\",\n }}\n >\n {children}\n </AbsoluteFill>\n </AbsoluteFill>\n </AbsoluteFill>\n );\n}\n\nexport function shaderSpiralPass(\n props: ShaderSpiralPassProps = {},\n): TransitionPresentation<ShaderSpiralPassProps> {\n return { component: ShaderSpiralPassPresentation, props };\n}\n",
+ "type": "registry:component",
+ "target": "components/remocn/shader-spiral-pass.tsx"
+ }
+ ],
+ "type": "registry:component"
+}
diff --git a/registry-artifacts/shader-text-reveal.json b/registry-artifacts/shader-text-reveal.json
new file mode 100644
index 00000000..4b11cd78
--- /dev/null
+++ b/registry-artifacts/shader-text-reveal.json
@@ -0,0 +1,16 @@
+{
+ "$schema": "https://ui.shadcn.com/schema/registry-item.json",
+ "name": "shader-text-reveal",
+ "title": "Shader Text Reveal",
+ "description": "Reveal words through the original OpenShaders hero shader, then settle into white type.",
+ "dependencies": ["remotion"],
+ "files": [
+ {
+ "path": "registry/remocn/shader-text-reveal/index.tsx",
+ "content": "\"use client\";\n\nimport { useLayoutEffect, useRef } from \"react\";\nimport { useCurrentFrame, useDelayRender, useVideoConfig } from \"remotion\";\n\nexport type ShaderTextRevealProps = {\n /** Words appear one at a time. Separate phrases with newlines to keep them together. */\n text?: string;\n fontSize?: number;\n fontFamily?: string;\n fontWeight?: number;\n /** Frames per word, including its entrance and exit. The final word stays visible. */\n wordDuration?: number;\n /** Strength of the original hero shader inside the letters, from 0 to 1. */\n intensity?: number;\n};\n\nconst clamp = (n: number, min = 0, max = 1) => Math.min(max, Math.max(min, n));\n\nexport function getShaderTextState(\n frame: number,\n wordCount: number,\n wordDuration: number,\n) {\n const duration = Math.max(12, Math.round(wordDuration));\n const count = Math.max(1, wordCount);\n const f = Math.max(0, frame);\n const index = Math.min(count - 1, Math.floor(f / duration));\n const local = f - index * duration;\n const enter = clamp((local / duration + 0.16) / 0.76);\n const exit =\n index === count - 1 ? 0 : clamp((local / duration - 0.65) / 0.35);\n return {\n index,\n enter,\n exit: exit * exit * (3 - 2 * exit),\n scale: 1 + 0.12 * (1 - enter) ** 3,\n };\n}\n\nconst VERTEX = `#version 300 es\nvoid main() {\n vec2 p = vec2(float((gl_VertexID << 1) & 2), float(gl_VertexID & 2));\n gl_Position = vec4(p * 2.0 - 1.0, 0.0, 1.0);\n}`;\n\n/* @remocn · OpenShaders — https://openshaders.com/@remocn\n * Original hero field and halftone GLSL. Only its clock is driven by Remotion.\n */\nconst HERO_FIELD = `#version 300 es\nprecision highp float;\n\nuniform vec2 iResolution;\nuniform float iTime;\nuniform float uLightMode;\nuniform vec3 uDarkBackground;\nuniform vec3 uLightBackground;\nout vec4 fragColor;\n\nconst float HUE = 0.663466752;\nconst float HUE_SPREAD = 0.314346701;\nconst float HUE_TRAVEL = 1.65112376;\nconst float CHROMA = 0.160295546;\nconst float LIGHTNESS = 0.537409723;\nconst float COLOUR_CYCLE = 0.124862425;\nconst float THETA = 2.12986207;\nconst float SHEAR = 0.968176901;\nconst float SHRINK = 0.955401778;\nconst float LAYERS = 72.0;\nconst float WARP_FREQ_X = 0.439311415;\nconst float WARP_FREQ_Y = 2.87923527;\nconst float WARP_AMP_X = 0.156202048;\nconst float WARP_AMP_Y = 0.0256033838;\nconst float ASPECT_X = 2.23183894;\nconst float ASPECT_Y = 0.15731883;\nconst float OFFSET_X = 0.375628948;\nconst float OFFSET_Y = -0.017801486;\nconst float TILT = 1.63293767;\nconst float ZOOM = 0.93135649;\nconst float CENTRE_X = -0.0956316143;\nconst float CENTRE_Y = -0.520057321;\nconst float GLOW_SIZE = 0.00201825937;\nconst float FALLOFF = 0.352821857;\nconst float VIGNETTE = 0.136085436;\nconst float FLOW_SPEED = 0.391012281;\nconst float FLOW_DIRECTION = 1.0;\nconst float BREATH_RATE = 0.382053256;\nconst float BREATH_AMOUNT = 0.0873704553;\nconst float PHASE = 56.3862724;\nconst float ECHO = 0.0;\nconst float ECHO_SHIFT = 0.178754866;\nconst float SOFTNESS = 0.00164903817;\nconst float LIGHT_SWING = 0.149726808;\n\nconst float TAU = 6.28318530718;\n\nvec3 oklchToLinear(float L, float C, float h) {\n float a = C * cos(h), b = C * sin(h);\n float l_ = L + 0.3963377774 * a + 0.2158037573 * b;\n float m_ = L - 0.1055613458 * a - 0.0638541728 * b;\n float s_ = L - 0.0894841775 * a - 1.2914855480 * b;\n vec3 lms = vec3(l_, m_, s_);\n lms = lms * lms * lms;\n return mat3(4.0767416621, -1.2684380046, -0.0041960863,\n -3.3077115913, 2.6097574011, -0.7034186147,\n 0.2309699292, -0.3413193965, 1.7076147010) * lms;\n}\n\nfloat blueNoise(vec2 p, float frame) {\n p += 5.588238 * mod(frame, 64.0);\n return fract(52.9829189 * fract(0.06711056 * p.x + 0.00583715 * p.y));\n}\n\nvoid main() {\n vec2 R = iResolution.xy;\n vec2 pos = (gl_FragCoord.xy - 0.5 * R) / R.y;\n float t = iTime * FLOW_SPEED * FLOW_DIRECTION + PHASE;\n float breath = (-sin(iTime * BREATH_RATE * 1.5) + sin(iTime * BREATH_RATE + 1.0)) * 0.25 + 0.5;\n\n vec2 u = (pos - vec2(CENTRE_X, CENTRE_Y)) * (ZOOM - breath * BREATH_AMOUNT);\n float ct = cos(TILT), st = sin(TILT);\n u = mat2(ct, st, -st, ct) * u;\n\n mat2 fold = mat2(cos(THETA), sin(THETA), -SHEAR, cos(THETA));\n\n float hue0 = HUE * TAU;\n float hue1 = hue0 + HUE_SPREAD * TAU;\n vec3 color = vec3(0.0);\n\n for (float i = 1.0; i <= 96.0; i += 1.0) {\n if (i > LAYERS) break;\n u.x += -sin(u.y * WARP_FREQ_X + t + i * 0.007) * WARP_AMP_X;\n u.y += -sin(u.x * WARP_FREQ_Y - t + i * 0.02) * WARP_AMP_Y;\n u = fold * u * SHRINK;\n\n vec2 q = u - vec2(OFFSET_X + breath * 0.1, OFFSET_Y);\n vec2 s = vec2(q.x * ASPECT_X, q.y * ASPECT_Y);\n float glow = GLOW_SIZE / (dot(s, s) + SOFTNESS);\n#ifndef SKIP_ECHO\n vec2 e = vec2((q.x - ECHO_SHIFT) * ASPECT_X, s.y);\n glow += ECHO * GLOW_SIZE / (dot(e, e) + SOFTNESS);\n#endif\n glow *= 0.25 + breath * 0.4;\n\n float r = length(u);\n float k = sin(i * COLOUR_CYCLE + t * 1.2 + r * HUE_TRAVEL) * 0.5 + 0.5;\n vec3 tint = clamp(oklchToLinear(LIGHTNESS + LIGHT_SWING * k, CHROMA * (0.75 + 0.35 * k), mix(hue0, hue1, k)), 0.0, 1.0);\n color += glow * tint * exp2(-r * FALLOFF);\n }\n\n vec3 x = max(color, 0.0);\n color = (x * (2.51 * x + 0.03)) / (x * (2.43 * x + 0.59) + 0.14);\n color = pow(clamp(color, 0.0, 1.0), vec3(0.85, 0.92, 0.98));\n\n float edge = smoothstep(0.5, 1.6, length(pos));\n color *= 1.0 - edge * VIGNETTE;\n\n vec3 dark = uDarkBackground + color * (1.0 - uDarkBackground);\n float strength = max(color.r, max(color.g, color.b));\n vec3 light = uLightBackground * (1.0 - strength) + color * 0.96;\n color = mix(dark, light, uLightMode);\n\n color += (blueNoise(gl_FragCoord.xy, floor(iTime * 24.0)) - 0.5) / 255.0;\n fragColor = vec4(clamp(color, 0.0, 1.0), 1.0);\n}\n`;\n\nconst HERO_HALFTONE = `#version 300 es\nprecision highp float;\n\nuniform sampler2D tScene;\nuniform vec2 iResolution;\nuniform float iTime;\nuniform float uLightMode;\nuniform vec3 uDarkBackground;\nuniform vec3 uLightBackground;\nuniform float uPixelRatio;\nout vec4 fragColor;\n\nconst float uStrength = 0.797335207;\nconst float uScale = 0.985214949;\nconst float uSeed = 0.435611069;\n\nconst float TAU = 6.28318530718;\nconst vec3 LUMA = vec3(0.2126, 0.7152, 0.0722);\n\nvec3 toInk(vec3 c) { return mix(c - uDarkBackground, uLightBackground - c, uLightMode); }\nvec3 fromInk(vec3 ink) { return mix(uDarkBackground + ink, uLightBackground - ink, uLightMode); }\nvec3 sceneInk(vec2 uv) { return toInk(texture(tScene, clamp(uv, 0.0, 1.0)).rgb); }\n\nfloat blueNoise(vec2 p, float frame) {\n p += 5.588238 * mod(frame, 64.0);\n return fract(52.9829189 * fract(0.06711056 * p.x + 0.00583715 * p.y));\n}\n\nvec3 halftone(vec2 frag) {\n float cell = max(3.0, uScale * 3.6 * uPixelRatio);\n float angle = 0.26 + uSeed * 0.3;\n mat2 turn = mat2(cos(angle), -sin(angle), sin(angle), cos(angle));\n vec2 rotated = turn * frag;\n vec2 grid = floor(rotated / cell);\n vec2 centre = (grid + 0.5) * cell;\n vec2 source = transpose(turn) * centre;\n vec3 soft = sceneInk(frag / iResolution);\n vec3 ink = sceneInk(source / iResolution);\n float level = clamp(dot(ink, LUMA), 0.0, 1.0);\n float radius = cell * sqrt(pow(level, 0.9) / 3.14159265);\n float dist = length(rotated - centre);\n float aa = 0.7 * uPixelRatio;\n float dot_ = 1.0 - smoothstep(radius - aa, radius + aa, dist);\n vec3 dots = ink * min(0.8 / max(level, 1e-3), 2.2) * dot_;\n float presence = smoothstep(0.03, 0.16, level) * (0.3 + 0.14 * uStrength);\n return mix(soft, dots, presence);\n}\n\nvoid main() {\n vec2 frag = gl_FragCoord.xy;\n vec3 ink = halftone(frag);\n vec3 color = fromInk(clamp(ink, 0.0, 1.0));\n color += (blueNoise(frag, floor(iTime * 24.0)) - 0.5) / 255.0;\n fragColor = vec4(clamp(color, 0.0, 1.0), 1.0);\n}\n`;\n\nconst FRAGMENT = `#version 300 es\nprecision highp float;\nuniform sampler2D uText;\nuniform sampler2D uHero;\nuniform vec2 uResolution;\nuniform vec4 uBounds;\nuniform float uEnter;\nuniform float uExit;\nuniform float uScale;\nuniform float uTime;\nuniform float uIntensity;\nout vec4 fragColor;\n\nvoid main() {\n vec2 uv = (gl_FragCoord.xy / uResolution - 0.5) / uScale + 0.5;\n vec2 q = (uv - uBounds.xy) / uBounds.zw;\n float flow = sin(q.x * 7.0 + q.y * 5.0 - uTime * 3.2) * 0.065\n + sin(q.x * 13.0 - q.y * 8.0 + uTime * 2.1) * 0.025;\n float rank = q.x * 0.64 + (1.0 - q.y) * 0.36 + flow;\n float d = rank - mix(-0.15, 1.65, uEnter);\n float edge = exp(-pow((d + 0.1) * 6.0, 2.0));\n // Refraction affects the glyph itself, concentrated inside the wet leading edge.\n vec3 field = texture(uHero, uv).rgb;\n vec2 warp = vec2(field.r - field.b, field.g - field.r);\n vec2 sampleUV = uv + warp * edge * uIntensity * 2.5 / uResolution;\n float glyph = texture(uText, sampleUV).a;\n float appear = 1.0 - smoothstep(-0.025, 0.09, d);\n float exitRank = q.x * 0.65 + (1.0 - q.y) * 0.5 + flow;\n float leave = smoothstep(-0.12, 0.06, exitRank - mix(-0.25, 1.45, uExit));\n\n vec3 liquid = texture(uHero, sampleUV).rgb;\n vec3 silver = vec3(0.96, 0.925, 1.0);\n float settled = 1.0 - smoothstep(-0.58, -0.16, d);\n vec3 color = mix(liquid, silver, settled);\n color = mix(silver, color, uIntensity);\n float alpha = glyph * appear * leave;\n fragColor = vec4(color * alpha, alpha);\n}`;\n\nfunction createRenderer(canvas: HTMLCanvasElement) {\n const gl = canvas.getContext(\"webgl2\", {\n alpha: true,\n premultipliedAlpha: true,\n antialias: false,\n depth: false,\n });\n if (!gl) throw new Error(\"Shader Text Reveal requires WebGL2.\");\n const shaders: WebGLShader[] = [];\n const programs: WebGLProgram[] = [];\n const textures: WebGLTexture[] = [];\n const buffers: WebGLFramebuffer[] = [];\n const dispose = () => {\n for (const shader of shaders) gl.deleteShader(shader);\n for (const program of programs) gl.deleteProgram(program);\n for (const texture of textures) gl.deleteTexture(texture);\n for (const buffer of buffers) gl.deleteFramebuffer(buffer);\n };\n const compile = (fragment: string) => {\n const program = gl.createProgram();\n if (!program) throw new Error(\"Shader Text Reveal: GPU allocation failed.\");\n programs.push(program);\n for (const [type, source] of [\n [gl.VERTEX_SHADER, VERTEX],\n [gl.FRAGMENT_SHADER, fragment],\n ] as const) {\n const shader = gl.createShader(type);\n if (!shader)\n throw new Error(\"Shader Text Reveal: shader allocation failed.\");\n shaders.push(shader);\n gl.shaderSource(shader, source);\n gl.compileShader(shader);\n if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS))\n throw new Error(\n gl.getShaderInfoLog(shader) ?? \"Shader compilation failed.\",\n );\n gl.attachShader(program, shader);\n }\n gl.linkProgram(program);\n if (!gl.getProgramParameter(program, gl.LINK_STATUS))\n throw new Error(gl.getProgramInfoLog(program) ?? \"Shader link failed.\");\n const locations = new Map<string, WebGLUniformLocation | null>();\n const uniform = (name: string) => {\n if (!locations.has(name))\n locations.set(name, gl.getUniformLocation(program, name));\n return locations.get(name) ?? null;\n };\n return {\n uniform,\n begin: (time: number) => {\n gl.useProgram(program);\n gl.viewport(0, 0, canvas.width, canvas.height);\n gl.uniform2f(uniform(\"iResolution\"), canvas.width, canvas.height);\n gl.uniform1f(uniform(\"iTime\"), time);\n gl.uniform1f(uniform(\"uLightMode\"), 0);\n gl.uniform3f(uniform(\"uDarkBackground\"), 9 / 255, 9 / 255, 9 / 255);\n gl.uniform3f(uniform(\"uLightBackground\"), 1, 1, 1);\n gl.uniform1f(uniform(\"uPixelRatio\"), 1);\n },\n };\n };\n const texture = () => {\n const value = gl.createTexture();\n if (!value)\n throw new Error(\"Shader Text Reveal: texture allocation failed.\");\n textures.push(value);\n gl.activeTexture(gl.TEXTURE0);\n gl.bindTexture(gl.TEXTURE_2D, value);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);\n return value;\n };\n const target = () => {\n const value = texture();\n const buffer = gl.createFramebuffer();\n if (!buffer)\n throw new Error(\"Shader Text Reveal: framebuffer allocation failed.\");\n buffers.push(buffer);\n gl.bindFramebuffer(gl.FRAMEBUFFER, buffer);\n gl.texImage2D(\n gl.TEXTURE_2D,\n 0,\n gl.RGBA,\n canvas.width,\n canvas.height,\n 0,\n gl.RGBA,\n gl.UNSIGNED_BYTE,\n null,\n );\n gl.framebufferTexture2D(\n gl.FRAMEBUFFER,\n gl.COLOR_ATTACHMENT0,\n gl.TEXTURE_2D,\n value,\n 0,\n );\n if (gl.checkFramebufferStatus(gl.FRAMEBUFFER) !== gl.FRAMEBUFFER_COMPLETE)\n throw new Error(\"Shader Text Reveal: incomplete framebuffer.\");\n return { value, buffer };\n };\n const bind = (value: WebGLTexture, unit: number) => {\n gl.activeTexture(gl.TEXTURE0 + unit);\n gl.bindTexture(gl.TEXTURE_2D, value);\n };\n try {\n const field = compile(HERO_FIELD);\n const halftone = compile(HERO_HALFTONE);\n const composite = compile(FRAGMENT);\n const text = texture();\n const raw = target();\n const hero = target();\n gl.bindFramebuffer(gl.FRAMEBUFFER, null);\n gl.clearColor(0, 0, 0, 0);\n gl.clear(gl.COLOR_BUFFER_BIT);\n let previous: HTMLCanvasElement | null = null;\n return {\n dispose,\n draw: (\n word: TextTexture,\n state: ReturnType<typeof getShaderTextState>,\n time: number,\n intensity: number,\n ) => {\n if (gl.isContextLost())\n throw new Error(\"Shader Text Reveal: WebGL context lost.\");\n // Render the hero's original field, then its original halftone pass.\n gl.bindFramebuffer(gl.FRAMEBUFFER, raw.buffer);\n field.begin(time);\n gl.drawArrays(gl.TRIANGLES, 0, 3);\n gl.bindFramebuffer(gl.FRAMEBUFFER, hero.buffer);\n halftone.begin(time);\n bind(raw.value, 0);\n gl.uniform1i(halftone.uniform(\"tScene\"), 0);\n gl.drawArrays(gl.TRIANGLES, 0, 3);\n\n gl.bindFramebuffer(gl.FRAMEBUFFER, null);\n composite.begin(time);\n bind(text, 0);\n if (previous !== word.canvas) {\n gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, true);\n gl.texImage2D(\n gl.TEXTURE_2D,\n 0,\n gl.RGBA,\n gl.RGBA,\n gl.UNSIGNED_BYTE,\n word.canvas,\n );\n gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, false);\n previous = word.canvas;\n }\n bind(hero.value, 1);\n gl.uniform1i(composite.uniform(\"uText\"), 0);\n gl.uniform1i(composite.uniform(\"uHero\"), 1);\n gl.uniform2f(\n composite.uniform(\"uResolution\"),\n canvas.width,\n canvas.height,\n );\n gl.uniform4f(composite.uniform(\"uBounds\"), ...word.bounds);\n gl.uniform1f(composite.uniform(\"uEnter\"), state.enter);\n gl.uniform1f(composite.uniform(\"uExit\"), state.exit);\n gl.uniform1f(composite.uniform(\"uScale\"), state.scale);\n gl.uniform1f(composite.uniform(\"uTime\"), time);\n gl.uniform1f(composite.uniform(\"uIntensity\"), clamp(intensity));\n gl.drawArrays(gl.TRIANGLES, 0, 3);\n },\n };\n } catch (error) {\n dispose();\n throw error;\n }\n}\n\ntype TextTexture = {\n canvas: HTMLCanvasElement;\n bounds: [number, number, number, number];\n};\n\nfunction textTexture(\n text: string,\n width: number,\n height: number,\n fontSize: number,\n fontWeight: number,\n fontFamily: string,\n): TextTexture {\n const canvas = document.createElement(\"canvas\");\n canvas.width = width;\n canvas.height = height;\n const ctx = canvas.getContext(\"2d\");\n if (!ctx) throw new Error(\"Shader Text Reveal: cannot rasterize text.\");\n let size = Math.min(Math.max(1, fontSize), height * 0.58);\n ctx.font = `${fontWeight} ${size}px ${fontFamily}`;\n size *= Math.min(\n 1,\n (width * 0.72) / Math.max(1, ctx.measureText(text).width),\n );\n ctx.font = `${fontWeight} ${size}px ${fontFamily}`;\n const metrics = ctx.measureText(text);\n const left = (width - metrics.width) / 2;\n const ascent = metrics.actualBoundingBoxAscent;\n const descent = metrics.actualBoundingBoxDescent;\n const baseline = (height + ascent - descent) / 2;\n ctx.fillStyle = \"white\";\n ctx.fillText(text, left, baseline);\n return {\n canvas,\n bounds: [\n left / width,\n (height - baseline - descent) / height,\n Math.max(1, metrics.width) / width,\n Math.max(1, ascent + descent) / height,\n ],\n };\n}\n\nexport function ShaderTextReveal({\n text = \"Your product\",\n fontSize = 400,\n fontFamily = \"Arial, sans-serif\",\n fontWeight = 500,\n wordDuration = 30,\n intensity = 1,\n}: ShaderTextRevealProps) {\n const frame = useCurrentFrame();\n const { width, height, fps } = useVideoConfig();\n const { delayRender, continueRender, cancelRender } = useDelayRender();\n const canvas = useRef<HTMLCanvasElement>(null);\n const resources = useRef<{\n renderer: ReturnType<typeof createRenderer>;\n words: TextTexture[];\n } | null>(null);\n const current = useRef({ frame, fps, wordDuration, intensity });\n current.current = { frame, fps, wordDuration, intensity };\n\n useLayoutEffect(() => {\n const element = canvas.current;\n if (!element) return;\n let cancelled = false;\n const handle = delayRender(\"Load Shader Text Reveal font\");\n const phrases = text.includes(\"\\n\") ? text.split(\"\\n\") : text.split(/\\s+/);\n const words = phrases.map((word) => word.trim()).filter(Boolean);\n const draw = () => {\n const resource = resources.current;\n if (!resource || resource.words.length === 0) return;\n const clock = current.current;\n const state = getShaderTextState(\n clock.frame,\n resource.words.length,\n clock.wordDuration,\n );\n resource.renderer.draw(\n resource.words[state.index],\n state,\n clock.frame / clock.fps,\n clock.intensity,\n );\n };\n void document.fonts\n .load(`${fontWeight} ${fontSize}px ${fontFamily}`, text || \" \")\n .then(() => {\n if (cancelled) return;\n const textures = words.map((word) =>\n textTexture(word, width, height, fontSize, fontWeight, fontFamily),\n );\n const renderer = createRenderer(element);\n resources.current = { renderer, words: textures };\n draw();\n continueRender(handle);\n })\n .catch((error: unknown) => {\n if (!cancelled)\n cancelRender(\n error instanceof Error ? error : new Error(String(error)),\n );\n });\n return () => {\n cancelled = true;\n continueRender(handle);\n resources.current?.renderer.dispose();\n resources.current = null;\n };\n }, [\n text,\n width,\n height,\n fontSize,\n fontWeight,\n fontFamily,\n delayRender,\n continueRender,\n cancelRender,\n ]);\n\n useLayoutEffect(() => {\n const resource = resources.current;\n if (!resource || resource.words.length === 0) return;\n try {\n const state = getShaderTextState(\n frame,\n resource.words.length,\n wordDuration,\n );\n resource.renderer.draw(\n resource.words[state.index],\n state,\n frame / fps,\n intensity,\n );\n } catch (error) {\n cancelRender(error instanceof Error ? error : new Error(String(error)));\n }\n }, [frame, fps, wordDuration, intensity, cancelRender]);\n\n return (\n <canvas\n ref={canvas}\n width={width}\n height={height}\n role=\"img\"\n aria-label={text}\n style={{\n position: \"absolute\",\n inset: 0,\n width: \"100%\",\n height: \"100%\",\n pointerEvents: \"none\",\n }}\n />\n );\n}\n",
+ "type": "registry:component",
+ "target": "components/remocn/shader-text-reveal.tsx"
+ }
+ ],
+ "type": "registry:component"
+}
diff --git a/registry/__index__.tsx b/registry/__index__.tsx
index 6015ffc0..b272fa9b 100644
--- a/registry/__index__.tsx
+++ b/registry/__index__.tsx
@@ -12,6 +12,56 @@ export interface RegistryEntry {
}
const registry: Record<string, RegistryEntry> = {
+ "shader-spiral-pass": {
+ load: () =>
+ import("@/components/docs/examples/shader-spiral-pass-example").then(
+ (m) => ({ default: m.ShaderSpiralPassExampleScene }),
+ ),
+ loadConfig: () =>
+ import("@/registry/remocn/shader-spiral-pass/config").then(
+ (m) => m.shaderSpiralPassConfig,
+ ),
+ },
+ "shader-light-tunnel": {
+ load: () =>
+ import("@/registry/remocn/shader-light-tunnel").then((m) => ({
+ default: m.ShaderLightTunnel,
+ })),
+ loadConfig: () =>
+ import("@/registry/remocn/shader-light-tunnel/config").then(
+ (m) => m.shaderLightTunnelConfig,
+ ),
+ },
+ "inline-word-roll": {
+ load: () =>
+ import("@/registry/remocn/inline-word-roll").then((m) => ({
+ default: m.InlineWordRoll,
+ })),
+ loadConfig: () =>
+ import("@/registry/remocn/inline-word-roll/config").then(
+ (m) => m.inlineWordRollConfig,
+ ),
+ },
+ "shader-text-reveal": {
+ load: () =>
+ import("@/registry/remocn/shader-text-reveal").then((m) => ({
+ default: m.ShaderTextReveal,
+ })),
+ loadConfig: () =>
+ import("@/registry/remocn/shader-text-reveal/config").then(
+ (m) => m.shaderTextRevealConfig,
+ ),
+ },
+ "shader-seam": {
+ load: () =>
+ import("@/components/docs/examples/shader-seam-example").then((m) => ({
+ default: m.ShaderSeamExampleScene,
+ })),
+ loadConfig: () =>
+ import("@/registry/remocn/shader-seam/config").then(
+ (m) => m.shaderSeamConfig,
+ ),
+ },
"search-reveal": {
load: () =>
import("@/registry/remocn/search-reveal").then((m) => ({
diff --git a/registry/__manifest__.ts b/registry/__manifest__.ts
index 164432cf..e7e075d4 100644
--- a/registry/__manifest__.ts
+++ b/registry/__manifest__.ts
@@ -2624,6 +2624,27 @@ export const previewManifest: Record<string, PreviewManifestEntry> = {
speed: 1,
},
},
+ "inline-word-roll": {
+ durationInFrames: 105,
+ fps: 30,
+ compositionWidth: 1280,
+ compositionHeight: 720,
+ previewBackdrop: {
+ type: "color",
+ value: "#000000",
+ },
+ defaults: {
+ prefix: "Looking for",
+ text: "leads | customers | subscribers | appointments | demos | quotes | registrants | trials | conversions",
+ suffix: "?",
+ fontSize: 60,
+ interval: 12,
+ acceleration: 0.9,
+ transitionFrames: 6,
+ color: "#f5f5f5",
+ speed: 1,
+ },
+ },
input: {
durationInFrames: 120,
fps: 30,
@@ -3525,6 +3546,24 @@ export const previewManifest: Record<string, PreviewManifestEntry> = {
colorBack: "#12121a",
},
},
+ "shader-light-tunnel": {
+ durationInFrames: 90,
+ fps: 30,
+ compositionWidth: 1280,
+ compositionHeight: 720,
+ previewBackdrop: {
+ type: "color",
+ value: "#05050a",
+ },
+ defaults: {
+ speed: 1,
+ twist: 0.7,
+ spirals: 3,
+ glow: 1,
+ depth: 1,
+ timeOffset: 0,
+ },
+ },
"shader-liquid-metal": {
durationInFrames: 150,
fps: 30,
@@ -3601,6 +3640,22 @@ export const previewManifest: Record<string, PreviewManifestEntry> = {
colorBack: "#12121a",
},
},
+ "shader-seam": {
+ durationInFrames: 156,
+ fps: 30,
+ compositionWidth: 1280,
+ compositionHeight: 720,
+ previewBackdrop: {
+ type: "color",
+ value: "#14121c",
+ },
+ defaults: {
+ softness: 0.18,
+ detail: 0.65,
+ timeOffset: 0,
+ speed: 1,
+ },
+ },
"shader-simplex-noise": {
durationInFrames: 150,
fps: 30,
@@ -3638,6 +3693,24 @@ export const previewManifest: Record<string, PreviewManifestEntry> = {
colorBack: "#12121a",
},
},
+ "shader-spiral-pass": {
+ durationInFrames: 168,
+ fps: 30,
+ compositionWidth: 1280,
+ compositionHeight: 720,
+ previewBackdrop: {
+ type: "color",
+ value: "#15111c",
+ },
+ defaults: {
+ speed: 1,
+ spirals: 3,
+ twist: 0.7,
+ zoom: 14,
+ softness: 0.12,
+ timeOffset: 0,
+ },
+ },
"shader-strata": {
durationInFrames: 150,
fps: 30,
@@ -3664,6 +3737,23 @@ export const previewManifest: Record<string, PreviewManifestEntry> = {
colorBack: "#12121a",
},
},
+ "shader-text-reveal": {
+ durationInFrames: 75,
+ fps: 30,
+ compositionWidth: 1280,
+ compositionHeight: 720,
+ previewBackdrop: {
+ type: "color",
+ value: "#000000",
+ },
+ defaults: {
+ text: "Your product",
+ fontSize: 400,
+ wordDuration: 30,
+ intensity: 1,
+ speed: 1,
+ },
+ },
"shader-voronoi": {
durationInFrames: 150,
fps: 30,
diff --git a/registry/remocn/inline-word-roll/__tests__/inline-word-roll.test.ts b/registry/remocn/inline-word-roll/__tests__/inline-word-roll.test.ts
new file mode 100644
index 00000000..3096d3d2
--- /dev/null
+++ b/registry/remocn/inline-word-roll/__tests__/inline-word-roll.test.ts
@@ -0,0 +1,60 @@
+import { describe, expect, it } from "bun:test";
+import {
+ getInlineWordRollDuration,
+ getInlineWordRollState,
+ parseInlineWords,
+} from "..";
+
+describe("inline word roll", () => {
+ it("preserves phrases and ignores blank entries", () => {
+ expect(
+ parseInlineWords(" leads | new customers\n\n subscribers | "),
+ ).toEqual(["leads", "new customers", "subscribers"]);
+ });
+ it("holds the first word, rolls one pair, and holds the final word", () => {
+ expect(getInlineWordRollState(0, 3)).toEqual({
+ from: 0,
+ to: 0,
+ progress: 1,
+ });
+ expect(getInlineWordRollState(15, 3)).toEqual({
+ from: 0,
+ to: 1,
+ progress: 0.5,
+ });
+ expect(getInlineWordRollState(100, 3)).toEqual({
+ from: 2,
+ to: 2,
+ progress: 1,
+ });
+ });
+ it("accelerates intervals without overlapping rolls", () => {
+ let previous = 0;
+ for (let f = 0; f < 90; f += 0.1) {
+ const state = getInlineWordRollState(f, 9, 12, 0.5, 6);
+ expect(state.to - state.from).toBeLessThanOrEqual(1);
+ expect(state.to).toBeGreaterThanOrEqual(previous);
+ expect(state.progress).toBeGreaterThanOrEqual(0);
+ expect(state.progress).toBeLessThanOrEqual(1);
+ previous = state.to;
+ }
+ expect(
+ getInlineWordRollDuration({ text: "a|b|c|d", acceleration: 0.5 }),
+ ).toBeLessThan(
+ getInlineWordRollDuration({ text: "a|b|c|d", acceleration: 1 }),
+ );
+ });
+ it("duration ends on a settled final word and seeking is deterministic", () => {
+ const text = "one|two|three";
+ const duration = getInlineWordRollDuration({ text });
+ expect(getInlineWordRollState(duration, 3)).toEqual({
+ from: 2,
+ to: 2,
+ progress: 1,
+ });
+ expect(getInlineWordRollDuration({ text: "one" })).toBe(0);
+ const first = getInlineWordRollState(14, 3);
+ getInlineWordRollState(70, 3);
+ expect(getInlineWordRollState(14, 3)).toEqual(first);
+ });
+});
diff --git a/registry/remocn/inline-word-roll/config.ts b/registry/remocn/inline-word-roll/config.ts
new file mode 100644
index 00000000..cf054436
--- /dev/null
+++ b/registry/remocn/inline-word-roll/config.ts
@@ -0,0 +1,62 @@
+import { type ComponentConfig, FPS, H, W } from "@/lib/customizer-config";
+import { inlineWordRollDefaultText } from ".";
+
+export const inlineWordRollConfig: ComponentConfig = {
+ componentName: "InlineWordRoll",
+ importPath: "@/components/remocn/inline-word-roll",
+ controls: {
+ prefix: {
+ type: "text-content",
+ default: "Looking for",
+ description: "Fixed text",
+ },
+ text: {
+ type: "text-content",
+ default: inlineWordRollDefaultText,
+ description: "Words separated by |",
+ },
+ suffix: { type: "text-content", default: "?", description: "Word suffix" },
+ fontSize: {
+ type: "number",
+ default: 60,
+ min: 16,
+ max: 160,
+ step: 1,
+ description: "Font size",
+ hiddenFromList: false,
+ },
+ interval: {
+ type: "number",
+ default: 12,
+ min: 6,
+ max: 60,
+ step: 1,
+ description: "Initial frames per word",
+ hiddenFromList: false,
+ },
+ acceleration: {
+ type: "number",
+ default: 0.9,
+ min: 0.5,
+ max: 1,
+ step: 0.01,
+ description: "Interval multiplier",
+ hiddenFromList: false,
+ },
+ transitionFrames: {
+ type: "number",
+ default: 6,
+ min: 1,
+ max: 20,
+ step: 1,
+ description: "Roll duration",
+ hiddenFromList: false,
+ },
+ color: { type: "color", default: "#f5f5f5", description: "Color" },
+ },
+ durationInFrames: 105,
+ fps: FPS,
+ compositionWidth: W,
+ compositionHeight: H,
+ previewBackdrop: { type: "color", value: "#000000" },
+};
diff --git a/registry/remocn/inline-word-roll/index.tsx b/registry/remocn/inline-word-roll/index.tsx
new file mode 100644
index 00000000..27e98eb3
--- /dev/null
+++ b/registry/remocn/inline-word-roll/index.tsx
@@ -0,0 +1,281 @@
+"use client";
+
+import { useLayoutEffect, useRef, useState } from "react";
+import {
+ Easing,
+ useCurrentFrame,
+ useDelayRender,
+ useVideoConfig,
+} from "remotion";
+
+export interface InlineWordRollProps {
+ prefix?: string;
+ /** Separate words or phrases with | or newlines. */
+ text?: string;
+ suffix?: string;
+ fontSize?: number;
+ fontFamily?: string;
+ fontWeight?: number;
+ color?: string;
+ /** Initial interval between switches, in frames. */
+ interval?: number;
+ /** Each following interval is multiplied by this number; 1 keeps a steady pace. */
+ acceleration?: number;
+ transitionFrames?: number;
+}
+
+export const inlineWordRollDefaultText =
+ "leads | customers | subscribers | appointments | demos | quotes | registrants | trials | conversions";
+
+export const parseInlineWords = (text: string) =>
+ text
+ .split(/[|\n\r]+/)
+ .map((word) => word.trim())
+ .filter(Boolean);
+
+const finite = (value: number, fallback: number) =>
+ Number.isFinite(value) ? value : fallback;
+const clamp = (n: number) => Math.max(0, Math.min(1, n));
+const ease = Easing.bezier(0.22, 0.75, 0.25, 1);
+
+export function getInlineWordRollState(
+ frame: number,
+ count: number,
+ interval = 12,
+ acceleration = 0.9,
+ transitionFrames = 6,
+) {
+ const transition = Math.max(1, finite(transitionFrames, 6));
+ const gap = Math.max(transition, finite(interval, 12));
+ const rate = Math.min(1, Math.max(0.5, finite(acceleration, 0.9)));
+ const f = Math.max(0, finite(frame, 0));
+ let start = 0;
+ for (let index = 1; index < count; index++) {
+ start += Math.max(transition, gap * rate ** (index - 1));
+ if (f < start) return { from: index - 1, to: index - 1, progress: 1 };
+ if (f < start + transition)
+ return {
+ from: index - 1,
+ to: index,
+ progress: clamp((f - start) / transition),
+ };
+ }
+ const last = Math.max(0, count - 1);
+ return { from: last, to: last, progress: 1 };
+}
+
+export function getInlineWordRollDuration({
+ text = inlineWordRollDefaultText,
+ interval = 12,
+ acceleration = 0.9,
+ transitionFrames = 6,
+}: Pick<
+ InlineWordRollProps,
+ "text" | "interval" | "acceleration" | "transitionFrames"
+> = {}) {
+ const count = parseInlineWords(text).length;
+ const transition = Math.max(1, finite(transitionFrames, 6));
+ const gap = Math.max(transition, finite(interval, 12));
+ const rate = Math.min(1, Math.max(0.5, finite(acceleration, 0.9)));
+ let total = 0;
+ for (let index = 0; index < count - 1; index++)
+ total += Math.max(transition, gap * rate ** index);
+ return count < 2 ? 0 : Math.ceil(total + transition);
+}
+
+export function InlineWordRoll({
+ prefix = "Looking for",
+ text = inlineWordRollDefaultText,
+ suffix = "?",
+ fontSize = 60,
+ fontFamily = "Arial, Helvetica, sans-serif",
+ fontWeight = 400,
+ color = "#f5f5f5",
+ interval = 12,
+ acceleration = 0.9,
+ transitionFrames = 6,
+}: InlineWordRollProps) {
+ const frame = useCurrentFrame();
+ const { width, height } = useVideoConfig();
+ const { delayRender, continueRender, cancelRender } = useDelayRender();
+ const words = parseInlineWords(text);
+ const measurement = useRef<HTMLDivElement>(null);
+ const pending = useRef<number | null>(null);
+ const [metrics, setMetrics] = useState<{
+ prefix: number;
+ words: number[];
+ } | null>(null);
+ const size = Math.max(1, finite(fontSize, 60));
+ const typography = {
+ fontFamily,
+ fontSize: size,
+ fontWeight,
+ letterSpacing: "-0.035em",
+ lineHeight: 1.2,
+ whiteSpace: "pre" as const,
+ };
+
+ useLayoutEffect(() => {
+ let cancelled = false;
+ const handle = delayRender("Measure Inline Word Roll font");
+ pending.current = handle;
+ void document.fonts
+ .load(
+ `${fontWeight} ${size}px ${fontFamily}`,
+ `${prefix} ${text}${suffix}`,
+ )
+ .then(() => {
+ if (cancelled || !measurement.current) return;
+ const children = Array.from(measurement.current.children);
+ // Computed widths are in composition pixels. Bounding rectangles include
+ // the Player's preview scale and would shrink our layout a second time.
+ const measure = (node: Element) =>
+ Number.parseFloat(getComputedStyle(node).width);
+ setMetrics({
+ prefix: measure(children[0]),
+ words: children.slice(1).map(measure),
+ });
+ })
+ .catch((error: unknown) => {
+ if (!cancelled)
+ cancelRender(
+ error instanceof Error ? error : new Error(String(error)),
+ );
+ });
+ return () => {
+ cancelled = true;
+ continueRender(handle);
+ if (pending.current === handle) pending.current = null;
+ };
+ }, [
+ prefix,
+ text,
+ suffix,
+ size,
+ fontFamily,
+ fontWeight,
+ delayRender,
+ continueRender,
+ cancelRender,
+ ]);
+
+ useLayoutEffect(() => {
+ if (metrics && pending.current !== null) {
+ continueRender(pending.current);
+ pending.current = null;
+ }
+ }, [metrics, continueRender]);
+
+ const state = getInlineWordRollState(
+ frame,
+ words.length,
+ interval,
+ acceleration,
+ transitionFrames,
+ );
+ const moving = state.from !== state.to;
+ const p = ease(state.progress);
+ const gap = prefix ? size * 0.23 : 0;
+ const prefixWidth = metrics?.prefix ?? 0;
+ const fromWidth = metrics?.words[state.from] ?? 0;
+ const toWidth = metrics?.words[state.to] ?? 0;
+ const slotWidth = fromWidth + (toWidth - fromWidth) * p;
+ const totalWidth = prefixWidth + gap + slotWidth;
+ const widest = prefixWidth + gap + Math.max(0, ...(metrics?.words ?? []));
+ const fit = Math.min(
+ 1,
+ (width * 0.84) / Math.max(1, widest),
+ (height * 0.5) / (size * 1.2),
+ );
+ const rowHeight = size * 1.2;
+
+ return (
+ <div
+ role="img"
+ aria-label={[prefix, words[state.to] ? `${words[state.to]}${suffix}` : ""]
+ .filter(Boolean)
+ .join(" ")}
+ style={{ position: "absolute", inset: 0, overflow: "hidden", color }}
+ >
+ <div
+ ref={measurement}
+ aria-hidden="true"
+ style={{
+ ...typography,
+ position: "absolute",
+ visibility: "hidden",
+ pointerEvents: "none",
+ }}
+ >
+ <span style={{ display: "inline-block" }}>{prefix}</span>
+ {words.map((word, index) => (
+ <span key={`${index}:${word}`} style={{ display: "inline-block" }}>
+ {word}
+ {suffix}
+ </span>
+ ))}
+ </div>
+ <div
+ aria-hidden="true"
+ style={{
+ position: "absolute",
+ left: "50%",
+ top: "50%",
+ scale: fit,
+ visibility: metrics && words.length ? "visible" : "hidden",
+ }}
+ >
+ <div
+ style={{
+ ...typography,
+ position: "absolute",
+ left: -totalWidth / 2,
+ top: -rowHeight / 2,
+ height: rowHeight,
+ }}
+ >
+ <span style={{ position: "absolute", left: 0 }}>{prefix}</span>
+ <div
+ style={{
+ position: "absolute",
+ left: prefixWidth + gap,
+ top: 0,
+ width: Math.max(fromWidth, toWidth) + size * 0.12,
+ height: rowHeight,
+ overflow: "hidden",
+ maskImage:
+ "linear-gradient(to bottom, transparent, black 12%, black 88%, transparent)",
+ }}
+ >
+ <span
+ style={{
+ position: "absolute",
+ left: 0,
+ top: 0,
+ translate: `0 ${moving ? -p * rowHeight : 0}px`,
+ opacity: moving ? 1 - clamp(p * 1.2) : 1,
+ }}
+ >
+ {words[state.from]}
+ {words.length ? suffix : ""}
+ </span>
+ {moving ? (
+ <span
+ style={{
+ position: "absolute",
+ left: 0,
+ top: 0,
+ translate: `0 ${(1 - p) * rowHeight}px`,
+ opacity: clamp(p * 1.6),
+ }}
+ >
+ {words[state.to]}
+ {suffix}
+ </span>
+ ) : null}
+ </div>
+ </div>
+ </div>
+ </div>
+ );
+}
diff --git a/registry/remocn/registry.json b/registry/remocn/registry.json
index e92550b9..a7bb42c8 100644
--- a/registry/remocn/registry.json
+++ b/registry/remocn/registry.json
@@ -2234,6 +2234,77 @@
"target": "components/remocn/type-fossil.tsx"
}
]
+ },
+ {
+ "name": "shader-seam",
+ "type": "registry:component",
+ "title": "Shader Seam",
+ "description": "Dissolve a stationary OpenShaders material to uncover the next scene.",
+ "dependencies": ["remotion", "@remotion/transitions"],
+ "files": [
+ {
+ "path": "shader-seam/index.tsx",
+ "type": "registry:component",
+ "target": "components/remocn/shader-seam.tsx"
+ }
+ ]
+ },
+ {
+ "name": "shader-text-reveal",
+ "type": "registry:component",
+ "title": "Shader Text Reveal",
+ "description": "Reveal words through the original OpenShaders hero shader, then settle into white type.",
+ "dependencies": ["remotion"],
+ "files": [
+ {
+ "path": "shader-text-reveal/index.tsx",
+ "type": "registry:component",
+ "target": "components/remocn/shader-text-reveal.tsx"
+ }
+ ]
+ },
+ {
+ "name": "inline-word-roll",
+ "type": "registry:component",
+ "title": "Inline Word Roll",
+ "description": "Roll through words beside a fixed prefix with accelerating timing and smoothly centered width.",
+ "dependencies": ["remotion"],
+ "files": [
+ {
+ "path": "inline-word-roll/index.tsx",
+ "type": "registry:component",
+ "target": "components/remocn/inline-word-roll.tsx"
+ }
+ ]
+ },
+ {
+ "name": "shader-light-tunnel",
+ "type": "registry:component",
+ "title": "Light Tunnel",
+ "description": "Fly straight through a tunnel made from the original OpenShaders hero shader.",
+ "dependencies": ["remotion"],
+ "files": [
+ {
+ "path": "shader-light-tunnel/index.tsx",
+ "type": "registry:component",
+ "target": "components/remocn/shader-light-tunnel.tsx"
+ }
+ ]
+ },
+ {
+ "name": "shader-spiral-pass",
+ "type": "registry:component",
+ "title": "Shader Spiral Pass",
+ "description": "Accelerate into the hero spiral and emerge through its soft center into the next scene.",
+ "dependencies": ["remotion", "@remotion/transitions"],
+ "registryDependencies": ["@remocn/shader-light-tunnel"],
+ "files": [
+ {
+ "path": "shader-spiral-pass/index.tsx",
+ "type": "registry:component",
+ "target": "components/remocn/shader-spiral-pass.tsx"
+ }
+ ]
}
]
}
diff --git a/registry/remocn/shader-light-tunnel/config.ts b/registry/remocn/shader-light-tunnel/config.ts
new file mode 100644
index 00000000..df05e4e7
--- /dev/null
+++ b/registry/remocn/shader-light-tunnel/config.ts
@@ -0,0 +1,67 @@
+import { type ComponentConfig, FPS, H, W } from "@/lib/customizer-config";
+
+export const shaderLightTunnelConfig: ComponentConfig = {
+ componentName: "ShaderLightTunnel",
+ importPath: "@/components/remocn/shader-light-tunnel",
+ controls: {
+ speed: {
+ type: "number",
+ default: 1,
+ min: 0,
+ max: 5,
+ step: 0.1,
+ description: "Flight speed",
+ hiddenFromList: false,
+ },
+ twist: {
+ type: "number",
+ default: 0.7,
+ min: 0,
+ max: 2,
+ step: 0.05,
+ description: "Spiral motion",
+ hiddenFromList: false,
+ },
+ spirals: {
+ type: "number",
+ default: 3,
+ min: 1,
+ max: 6,
+ step: 1,
+ description: "Spiral count",
+ hiddenFromList: false,
+ },
+ glow: {
+ type: "number",
+ default: 1,
+ min: 0,
+ max: 3,
+ step: 0.05,
+ description: "Light exposure",
+ hiddenFromList: false,
+ },
+ depth: {
+ type: "number",
+ default: 1,
+ min: 0.5,
+ max: 2,
+ step: 0.05,
+ description: "Perspective",
+ hiddenFromList: false,
+ },
+ timeOffset: {
+ type: "number",
+ default: 0,
+ min: 0,
+ max: 60,
+ step: 0.1,
+ description: "Start time",
+ hiddenFromList: false,
+ },
+ },
+ durationInFrames: 90,
+ fps: FPS,
+ compositionWidth: W,
+ compositionHeight: H,
+ previewBackdrop: { type: "color", value: "#05050a" },
+};
diff --git a/registry/remocn/shader-light-tunnel/index.tsx b/registry/remocn/shader-light-tunnel/index.tsx
new file mode 100644
index 00000000..8977a6e2
--- /dev/null
+++ b/registry/remocn/shader-light-tunnel/index.tsx
@@ -0,0 +1,495 @@
+"use client";
+
+import { useLayoutEffect, useRef } from "react";
+import { useCurrentFrame, useDelayRender, useVideoConfig } from "remotion";
+
+export interface ShaderLightTunnelProps {
+ speed?: number;
+ /** Spiral winding and circular motion of the material, from 0 to 2. */
+ twist?: number;
+ /** Repetitions of the hero ribbons around the tunnel, integer from 1 to 6. */
+ spirals?: number;
+ /** Exposure of the original hero material, from 0 to 3. */
+ glow?: number;
+ /** Camera perspective, from 0.5 to 2. */
+ depth?: number;
+ /** Starting shader time, in seconds. */
+ timeOffset?: number;
+}
+
+const VERTEX = `#version 300 es
+void main() {
+ vec2 p = vec2(float((gl_VertexID << 1) & 2), float(gl_VertexID & 2));
+ gl_Position = vec4(p * 2.0 - 1.0, 0.0, 1.0);
+}`;
+
+/* @remocn · OpenShaders — https://openshaders.com/@remocn
+ * Original hero field and halftone source. The tunnel adapter only remaps
+ * sampling coordinates, holds the material phase, and applies exposure.
+ */
+const HERO_FIELD = `#version 300 es
+precision highp float;
+
+uniform vec2 iResolution;
+uniform float iTime;
+uniform float uLightMode;
+uniform vec3 uDarkBackground;
+uniform vec3 uLightBackground;
+out vec4 fragColor;
+
+const float HUE = 0.663466752;
+const float HUE_SPREAD = 0.314346701;
+const float HUE_TRAVEL = 1.65112376;
+const float CHROMA = 0.160295546;
+const float LIGHTNESS = 0.537409723;
+const float COLOUR_CYCLE = 0.124862425;
+const float THETA = 2.12986207;
+const float SHEAR = 0.968176901;
+const float SHRINK = 0.955401778;
+const float LAYERS = 72.0;
+const float WARP_FREQ_X = 0.439311415;
+const float WARP_FREQ_Y = 2.87923527;
+const float WARP_AMP_X = 0.156202048;
+const float WARP_AMP_Y = 0.0256033838;
+const float ASPECT_X = 2.23183894;
+const float ASPECT_Y = 0.15731883;
+const float OFFSET_X = 0.375628948;
+const float OFFSET_Y = -0.017801486;
+const float TILT = 1.63293767;
+const float ZOOM = 0.93135649;
+const float CENTRE_X = -0.0956316143;
+const float CENTRE_Y = -0.520057321;
+const float GLOW_SIZE = 0.00201825937;
+const float FALLOFF = 0.352821857;
+const float VIGNETTE = 0.136085436;
+const float FLOW_SPEED = 0.391012281;
+const float FLOW_DIRECTION = 1.0;
+const float BREATH_RATE = 0.382053256;
+const float BREATH_AMOUNT = 0.0873704553;
+const float PHASE = 56.3862724;
+const float ECHO = 0.0;
+const float ECHO_SHIFT = 0.178754866;
+const float SOFTNESS = 0.00164903817;
+const float LIGHT_SWING = 0.149726808;
+
+const float TAU = 6.28318530718;
+
+vec3 oklchToLinear(float L, float C, float h) {
+ float a = C * cos(h), b = C * sin(h);
+ float l_ = L + 0.3963377774 * a + 0.2158037573 * b;
+ float m_ = L - 0.1055613458 * a - 0.0638541728 * b;
+ float s_ = L - 0.0894841775 * a - 1.2914855480 * b;
+ vec3 lms = vec3(l_, m_, s_);
+ lms = lms * lms * lms;
+ return mat3(4.0767416621, -1.2684380046, -0.0041960863,
+ -3.3077115913, 2.6097574011, -0.7034186147,
+ 0.2309699292, -0.3413193965, 1.7076147010) * lms;
+}
+
+float blueNoise(vec2 p, float frame) {
+ p += 5.588238 * mod(frame, 64.0);
+ return fract(52.9829189 * fract(0.06711056 * p.x + 0.00583715 * p.y));
+}
+
+void main() {
+ vec2 R = iResolution.xy;
+ vec2 pos = (gl_FragCoord.xy - 0.5 * R) / R.y;
+ float t = iTime * FLOW_SPEED * FLOW_DIRECTION + PHASE;
+ float breath = (-sin(iTime * BREATH_RATE * 1.5) + sin(iTime * BREATH_RATE + 1.0)) * 0.25 + 0.5;
+
+ vec2 u = (pos - vec2(CENTRE_X, CENTRE_Y)) * (ZOOM - breath * BREATH_AMOUNT);
+ float ct = cos(TILT), st = sin(TILT);
+ u = mat2(ct, st, -st, ct) * u;
+
+ mat2 fold = mat2(cos(THETA), sin(THETA), -SHEAR, cos(THETA));
+
+ float hue0 = HUE * TAU;
+ float hue1 = hue0 + HUE_SPREAD * TAU;
+ vec3 color = vec3(0.0);
+
+ for (float i = 1.0; i <= 96.0; i += 1.0) {
+ if (i > LAYERS) break;
+ u.x += -sin(u.y * WARP_FREQ_X + t + i * 0.007) * WARP_AMP_X;
+ u.y += -sin(u.x * WARP_FREQ_Y - t + i * 0.02) * WARP_AMP_Y;
+ u = fold * u * SHRINK;
+
+ vec2 q = u - vec2(OFFSET_X + breath * 0.1, OFFSET_Y);
+ vec2 s = vec2(q.x * ASPECT_X, q.y * ASPECT_Y);
+ float glow = GLOW_SIZE / (dot(s, s) + SOFTNESS);
+#ifndef SKIP_ECHO
+ vec2 e = vec2((q.x - ECHO_SHIFT) * ASPECT_X, s.y);
+ glow += ECHO * GLOW_SIZE / (dot(e, e) + SOFTNESS);
+#endif
+ glow *= 0.25 + breath * 0.4;
+
+ float r = length(u);
+ float k = sin(i * COLOUR_CYCLE + t * 1.2 + r * HUE_TRAVEL) * 0.5 + 0.5;
+ vec3 tint = clamp(oklchToLinear(LIGHTNESS + LIGHT_SWING * k, CHROMA * (0.75 + 0.35 * k), mix(hue0, hue1, k)), 0.0, 1.0);
+ color += glow * tint * exp2(-r * FALLOFF);
+ }
+
+ vec3 x = max(color, 0.0);
+ color = (x * (2.51 * x + 0.03)) / (x * (2.43 * x + 0.59) + 0.14);
+ color = pow(clamp(color, 0.0, 1.0), vec3(0.85, 0.92, 0.98));
+
+ float edge = smoothstep(0.5, 1.6, length(pos));
+ color *= 1.0 - edge * VIGNETTE;
+
+ vec3 dark = uDarkBackground + color * (1.0 - uDarkBackground);
+ float strength = max(color.r, max(color.g, color.b));
+ vec3 light = uLightBackground * (1.0 - strength) + color * 0.96;
+ color = mix(dark, light, uLightMode);
+
+ color += (blueNoise(gl_FragCoord.xy, floor(iTime * 24.0)) - 0.5) / 255.0;
+ fragColor = vec4(clamp(color, 0.0, 1.0), 1.0);
+}
+`;
+
+const HERO_HALFTONE = `#version 300 es
+precision highp float;
+
+uniform sampler2D tScene;
+uniform vec2 iResolution;
+uniform float iTime;
+uniform float uLightMode;
+uniform vec3 uDarkBackground;
+uniform vec3 uLightBackground;
+uniform float uPixelRatio;
+out vec4 fragColor;
+
+const float uStrength = 0.797335207;
+const float uScale = 0.985214949;
+const float uSeed = 0.435611069;
+
+const float TAU = 6.28318530718;
+const vec3 LUMA = vec3(0.2126, 0.7152, 0.0722);
+
+vec3 toInk(vec3 c) { return mix(c - uDarkBackground, uLightBackground - c, uLightMode); }
+vec3 fromInk(vec3 ink) { return mix(uDarkBackground + ink, uLightBackground - ink, uLightMode); }
+vec3 sceneInk(vec2 uv) { return toInk(texture(tScene, clamp(uv, 0.0, 1.0)).rgb); }
+
+float blueNoise(vec2 p, float frame) {
+ p += 5.588238 * mod(frame, 64.0);
+ return fract(52.9829189 * fract(0.06711056 * p.x + 0.00583715 * p.y));
+}
+
+vec3 halftone(vec2 frag) {
+ float cell = max(3.0, uScale * 3.6 * uPixelRatio);
+ float angle = 0.26 + uSeed * 0.3;
+ mat2 turn = mat2(cos(angle), -sin(angle), sin(angle), cos(angle));
+ vec2 rotated = turn * frag;
+ vec2 grid = floor(rotated / cell);
+ vec2 centre = (grid + 0.5) * cell;
+ vec2 source = transpose(turn) * centre;
+ vec3 soft = sceneInk(frag / iResolution);
+ vec3 ink = sceneInk(source / iResolution);
+ float level = clamp(dot(ink, LUMA), 0.0, 1.0);
+ float radius = cell * sqrt(pow(level, 0.9) / 3.14159265);
+ float dist = length(rotated - centre);
+ float aa = 0.7 * uPixelRatio;
+ float dot_ = 1.0 - smoothstep(radius - aa, radius + aa, dist);
+ vec3 dots = ink * min(0.8 / max(level, 1e-3), 2.2) * dot_;
+ float presence = smoothstep(0.03, 0.16, level) * (0.3 + 0.14 * uStrength);
+ return mix(soft, dots, presence);
+}
+
+void main() {
+ vec2 frag = gl_FragCoord.xy;
+ vec3 ink = halftone(frag);
+ vec3 color = fromInk(clamp(ink, 0.0, 1.0));
+ color += (blueNoise(frag, floor(iTime * 24.0)) - 0.5) / 255.0;
+ fragColor = vec4(clamp(color, 0.0, 1.0), 1.0);
+}
+`;
+
+// Project the unchanged hero field onto a seamless cylindrical surface.
+// Material flows inward along the tunnel; the camera never moves sideways.
+// Hold the hero's color/breath cycle at its initial phase. Only the tunnel
+// coordinates advance, so the ribbons do not enter the hero's darker phases.
+const TUNNEL_FIELD = HERO_FIELD.replaceAll("iTime", "uMaterialTime")
+ .replace(
+ "uniform float uMaterialTime;",
+ `uniform float iTime;
+ const float uMaterialTime = 0.0;
+ uniform float uDepth;
+ uniform float uTwist;
+ uniform float uSpirals;
+ uniform float uCameraZoom;
+ vec2 tunnelPosition(vec2 frag) {
+ vec2 view = (frag - iResolution * 0.5) / iResolution.y / uCameraZoom;
+ float radius = max(length(view), 0.005);
+ float z = 0.55 * uDepth / radius + iTime * 1.2;
+ // Rotate the material explicitly so circular motion reads at every depth.
+ // The camera and its centered projection remain fixed.
+ // Integer angular repeats add ribbons without a seam or extra field passes.
+ float angle = (atan(view.y, view.x)
+ + (z * 0.3 + iTime * 1.5) * uTwist) * uSpirals;
+ // Constant phase travels to smaller radii: r(t) = r(0) * exp(-2.4 * t).
+ // Log spacing keeps the inward folds readable across the whole tunnel.
+ float inward = log(radius / (0.55 * uDepth)) * 5.0 + iTime * 12.0;
+ float ring = 0.68 + 0.1 * sin(inward);
+ return vec2(cos(angle), sin(angle)) * ring
+ + vec2(sin(inward) * 0.08, cos(inward) * 0.06 - 0.25);
+ }`,
+ )
+ .replace(
+ "vec2 pos = (gl_FragCoord.xy - 0.5 * R) / R.y;",
+ "vec2 pos = tunnelPosition(gl_FragCoord.xy);",
+ );
+
+const TUNNEL_HALFTONE = HERO_HALFTONE.replace(
+ "uniform vec2 iResolution;",
+ "uniform vec2 iResolution;\nuniform float uGlow;",
+).replace(
+ "fragColor = vec4(clamp(color, 0.0, 1.0), 1.0);",
+ `vec2 center = (gl_FragCoord.xy - iResolution * 0.5) / iResolution.y;
+ // Defocus the actual field at the vanishing point instead of cutting a dark
+ // circle into it. A Gaussian blend has no visible boundary around the center.
+ float centerWeight = exp(-dot(center, center) / (2.0 * 0.065 * 0.065));
+ if (centerWeight > 0.001) {
+ vec3 blurred = vec3(0.0);
+ float totalWeight = 0.0;
+ vec2 spread = vec2(iResolution.y * 0.025) / iResolution;
+ // Prefilter each tap so tight spiral turns do not reappear as ghost images.
+ float blurLod = max(0.0, log2(iResolution.y * 0.025));
+ vec2 uv = gl_FragCoord.xy / iResolution;
+ for (int y = -2; y <= 2; y++) {
+ for (int x = -2; x <= 2; x++) {
+ vec2 offset = vec2(float(x), float(y));
+ float weight = exp(-dot(offset, offset) * 0.5);
+ blurred += textureLod(tScene, clamp(uv + offset * spread, 0.0, 1.0), blurLod).rgb * weight;
+ totalWeight += weight;
+ }
+ }
+ color = mix(color, blurred / totalWeight, centerWeight);
+ }
+ fragColor = vec4(clamp(color * uGlow, 0.0, 1.0), 1.0);`,
+);
+
+const bounded = (value: number, fallback: number, min: number, max: number) =>
+ Math.min(max, Math.max(min, Number.isFinite(value) ? value : fallback));
+
+/** Shared GPU renderer for the background and the spiral-pass transition. */
+export function createTunnelRenderer(canvas: HTMLCanvasElement) {
+ const gl = canvas.getContext("webgl2", {
+ alpha: false,
+ antialias: false,
+ depth: false,
+ stencil: false,
+ });
+ if (!gl) throw new Error("Shader Light Tunnel requires WebGL2.");
+ const shaders: WebGLShader[] = [];
+ const programs: WebGLProgram[] = [];
+ let texture: WebGLTexture | null = null;
+ let framebuffer: WebGLFramebuffer | null = null;
+ const dispose = () => {
+ for (const shader of shaders) gl.deleteShader(shader);
+ for (const program of programs) gl.deleteProgram(program);
+ gl.deleteTexture(texture);
+ gl.deleteFramebuffer(framebuffer);
+ };
+ const compile = (fragment: string) => {
+ const program = gl.createProgram();
+ if (!program)
+ throw new Error("Shader Light Tunnel: GPU allocation failed.");
+ programs.push(program);
+ for (const [type, source] of [
+ [gl.VERTEX_SHADER, VERTEX],
+ [gl.FRAGMENT_SHADER, fragment],
+ ] as const) {
+ const shader = gl.createShader(type);
+ if (!shader)
+ throw new Error("Shader Light Tunnel: shader allocation failed.");
+ shaders.push(shader);
+ gl.shaderSource(shader, source);
+ gl.compileShader(shader);
+ if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS))
+ throw new Error(
+ gl.getShaderInfoLog(shader) ?? "Tunnel shader compilation failed.",
+ );
+ gl.attachShader(program, shader);
+ }
+ gl.linkProgram(program);
+ if (!gl.getProgramParameter(program, gl.LINK_STATUS))
+ throw new Error(
+ gl.getProgramInfoLog(program) ?? "Tunnel shader link failed.",
+ );
+ const locations = new Map<string, WebGLUniformLocation | null>();
+ const uniform = (name: string) => {
+ if (!locations.has(name))
+ locations.set(name, gl.getUniformLocation(program, name));
+ return locations.get(name) ?? null;
+ };
+ return {
+ begin: (
+ time: number,
+ twist: number,
+ glow: number,
+ depth: number,
+ spirals: number,
+ cameraZoom = 1,
+ ) => {
+ gl.useProgram(program);
+ gl.viewport(0, 0, canvas.width, canvas.height);
+ gl.uniform2f(uniform("iResolution"), canvas.width, canvas.height);
+ gl.uniform1f(uniform("iTime"), time);
+ gl.uniform1f(uniform("uLightMode"), 0);
+ gl.uniform3f(uniform("uDarkBackground"), 9 / 255, 9 / 255, 9 / 255);
+ gl.uniform3f(uniform("uLightBackground"), 1, 1, 1);
+ gl.uniform1f(uniform("uPixelRatio"), 1);
+ gl.uniform1f(uniform("uTwist"), bounded(twist, 0.7, 0, 2));
+ gl.uniform1f(
+ uniform("uSpirals"),
+ Math.round(bounded(spirals, 3, 1, 6)),
+ );
+ gl.uniform1f(uniform("uGlow"), bounded(glow, 1, 0, 3));
+ gl.uniform1f(uniform("uDepth"), bounded(depth, 1, 0.5, 2));
+ gl.uniform1f(uniform("uCameraZoom"), bounded(cameraZoom, 1, 1, 32));
+ gl.uniform1i(uniform("tScene"), 0);
+ },
+ };
+ };
+ try {
+ const field = compile(TUNNEL_FIELD);
+ const halftone = compile(TUNNEL_HALFTONE);
+ texture = gl.createTexture();
+ framebuffer = gl.createFramebuffer();
+ if (!texture || !framebuffer)
+ throw new Error("Shader Light Tunnel: render target allocation failed.");
+ gl.activeTexture(gl.TEXTURE0);
+ gl.bindTexture(gl.TEXTURE_2D, texture);
+ gl.texParameteri(
+ gl.TEXTURE_2D,
+ gl.TEXTURE_MIN_FILTER,
+ gl.LINEAR_MIPMAP_LINEAR,
+ );
+ gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);
+ gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
+ gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
+ let targetWidth = 0,
+ targetHeight = 0;
+ return {
+ dispose,
+ draw: (
+ time: number,
+ twist: number,
+ glow: number,
+ depth: number,
+ spirals: number,
+ cameraZoom = 1,
+ ) => {
+ if (gl.isContextLost())
+ throw new Error("Shader Light Tunnel: WebGL context lost.");
+ gl.bindFramebuffer(gl.FRAMEBUFFER, framebuffer);
+ gl.bindTexture(gl.TEXTURE_2D, texture);
+ if (targetWidth !== canvas.width || targetHeight !== canvas.height) {
+ gl.texImage2D(
+ gl.TEXTURE_2D,
+ 0,
+ gl.RGBA,
+ canvas.width,
+ canvas.height,
+ 0,
+ gl.RGBA,
+ gl.UNSIGNED_BYTE,
+ null,
+ );
+ gl.framebufferTexture2D(
+ gl.FRAMEBUFFER,
+ gl.COLOR_ATTACHMENT0,
+ gl.TEXTURE_2D,
+ texture,
+ 0,
+ );
+ if (
+ gl.checkFramebufferStatus(gl.FRAMEBUFFER) !==
+ gl.FRAMEBUFFER_COMPLETE
+ )
+ throw new Error("Shader Light Tunnel: incomplete framebuffer.");
+ targetWidth = canvas.width;
+ targetHeight = canvas.height;
+ }
+ field.begin(time, twist, glow, depth, spirals, cameraZoom);
+ gl.drawArrays(gl.TRIANGLES, 0, 3);
+ gl.bindFramebuffer(gl.FRAMEBUFFER, null);
+ gl.generateMipmap(gl.TEXTURE_2D);
+ halftone.begin(time, twist, glow, depth, spirals);
+ gl.drawArrays(gl.TRIANGLES, 0, 3);
+ },
+ };
+ } catch (error) {
+ dispose();
+ throw error;
+ }
+}
+
+export function ShaderLightTunnel({
+ speed = 1,
+ twist = 0.7,
+ spirals = 3,
+ glow = 1,
+ depth = 1,
+ timeOffset = 0,
+}: ShaderLightTunnelProps) {
+ const frame = useCurrentFrame();
+ const { width, height, fps } = useVideoConfig();
+ const { delayRender, continueRender, cancelRender } = useDelayRender();
+ const canvas = useRef<HTMLCanvasElement>(null);
+ const renderer = useRef<ReturnType<typeof createTunnelRenderer> | null>(null);
+
+ useLayoutEffect(() => {
+ if (!canvas.current) return;
+ const handle = delayRender("Initialize Shader Light Tunnel");
+ try {
+ renderer.current = createTunnelRenderer(canvas.current);
+ continueRender(handle);
+ } catch (error) {
+ cancelRender(error instanceof Error ? error : new Error(String(error)));
+ }
+ return () => {
+ renderer.current?.dispose();
+ renderer.current = null;
+ };
+ }, [delayRender, continueRender, cancelRender]);
+
+ // biome-ignore lint/correctness/useExhaustiveDependencies: canvas resizing clears its buffer, including on paused frames.
+ useLayoutEffect(() => {
+ try {
+ const time =
+ bounded(timeOffset, 0, -10000, 10000) +
+ (frame / fps) * bounded(speed, 1, 0, 5);
+ renderer.current?.draw(time, twist, glow, depth, spirals);
+ } catch (error) {
+ cancelRender(error instanceof Error ? error : new Error(String(error)));
+ }
+ }, [
+ frame,
+ fps,
+ width,
+ height,
+ speed,
+ twist,
+ spirals,
+ glow,
+ depth,
+ timeOffset,
+ cancelRender,
+ ]);
+
+ return (
+ <canvas
+ ref={canvas}
+ width={width}
+ height={height}
+ aria-hidden="true"
+ tabIndex={-1}
+ style={{
+ position: "absolute",
+ inset: 0,
+ width: "100%",
+ height: "100%",
+ pointerEvents: "none",
+ }}
+ />
+ );
+}
diff --git a/registry/remocn/shader-seam/__tests__/shader-seam.test.ts b/registry/remocn/shader-seam/__tests__/shader-seam.test.ts
new file mode 100644
index 00000000..503ff797
--- /dev/null
+++ b/registry/remocn/shader-seam/__tests__/shader-seam.test.ts
@@ -0,0 +1,39 @@
+import { describe, expect, it } from "bun:test";
+import { getShaderSeamPhase } from "..";
+
+describe("shader dissolve", () => {
+ it("clamps seeking outside the transition and has transparent endpoints", () => {
+ expect(getShaderSeamPhase(-0.1)).toEqual(getShaderSeamPhase(0));
+ expect(getShaderSeamPhase(1.1)).toEqual(getShaderSeamPhase(1));
+ expect(getShaderSeamPhase(0)).toEqual({
+ presence: 0,
+ dissolve: 0,
+ showNext: false,
+ });
+ expect(getShaderSeamPhase(1)).toEqual({
+ presence: 1,
+ dissolve: 1,
+ showNext: true,
+ });
+ });
+ it("exchanges scenes only beneath the fully opaque material", () => {
+ for (const p of [0.34, 0.399, 0.4, 0.401, 0.46]) {
+ const phase = getShaderSeamPhase(p);
+ expect(phase.presence).toBe(1);
+ expect(phase.dissolve).toBe(0);
+ }
+ expect(getShaderSeamPhase(0.399).showNext).toBe(false);
+ expect(getShaderSeamPhase(0.4).showNext).toBe(true);
+ });
+ it("reveals the next scene monotonically and deterministically", () => {
+ let previous = 0;
+ for (let i = 0; i <= 100; i++) {
+ const phase = getShaderSeamPhase(i / 100);
+ expect(phase.dissolve).toBeGreaterThanOrEqual(previous);
+ previous = phase.dissolve;
+ }
+ const first = getShaderSeamPhase(0.7);
+ getShaderSeamPhase(0.1);
+ expect(getShaderSeamPhase(0.7)).toEqual(first);
+ });
+});
diff --git a/registry/remocn/shader-seam/config.ts b/registry/remocn/shader-seam/config.ts
new file mode 100644
index 00000000..17c53a05
--- /dev/null
+++ b/registry/remocn/shader-seam/config.ts
@@ -0,0 +1,51 @@
+import { shaderSeamExampleCode } from "@/components/docs/examples/shader-seam-example";
+import { type ComponentConfig, FPS, H, W } from "@/lib/customizer-config";
+
+export const shaderSeamConfig: ComponentConfig = {
+ componentName: "shaderSeam",
+ importPath: "@/components/remocn/shader-seam",
+ controls: {
+ softness: {
+ type: "number",
+ default: 0.18,
+ min: 0.02,
+ max: 0.4,
+ step: 0.01,
+ description: "Dissolve softness",
+ hiddenFromList: false,
+ },
+ detail: {
+ type: "number",
+ default: 0.65,
+ min: 0,
+ max: 1,
+ step: 0.01,
+ description: "Organic detail",
+ hiddenFromList: false,
+ },
+ timeOffset: {
+ type: "number",
+ default: 0,
+ min: 0,
+ max: 30,
+ step: 0.5,
+ description: "Shader start time",
+ hiddenFromList: false,
+ },
+ speed: {
+ type: "number",
+ default: 0,
+ min: 0,
+ max: 3,
+ step: 0.25,
+ description: "Shader speed",
+ hiddenFromList: false,
+ },
+ },
+ durationInFrames: 156,
+ fps: FPS,
+ compositionWidth: W,
+ compositionHeight: H,
+ previewBackdrop: { type: "color", value: "#14121c" },
+ snippet: shaderSeamExampleCode,
+};
diff --git a/registry/remocn/shader-seam/index.tsx b/registry/remocn/shader-seam/index.tsx
new file mode 100644
index 00000000..453f2058
--- /dev/null
+++ b/registry/remocn/shader-seam/index.tsx
@@ -0,0 +1,572 @@
+"use client";
+
+import type {
+ TransitionPresentation,
+ TransitionPresentationComponentProps,
+} from "@remotion/transitions";
+import { useLayoutEffect, useRef } from "react";
+import { AbsoluteFill, useDelayRender, useVideoConfig } from "remotion";
+
+/* @remocn · OpenShaders — https://openshaders.com/@remocn
+ * Original field and halftone GLSL from the site's React · WebGL export.
+ * The frame-driven renderer, dissolve compositing and scene exchange are remocn's.
+ */
+
+const VERTEX_SHADER = `#version 300 es
+void main() {
+ vec2 position = vec2(float((gl_VertexID << 1) & 2), float(gl_VertexID & 2));
+ gl_Position = vec4(position * 2.0 - 1.0, 0.0, 1.0);
+}
+`;
+
+const FIELD_SHADER = `#version 300 es
+precision highp float;
+
+uniform vec2 iResolution;
+uniform float iTime;
+uniform float uLightMode;
+uniform vec3 uDarkBackground;
+uniform vec3 uLightBackground;
+out vec4 fragColor;
+
+const float HUE = 0.663466752;
+const float HUE_SPREAD = 0.314346701;
+const float HUE_TRAVEL = 1.65112376;
+const float CHROMA = 0.160295546;
+const float LIGHTNESS = 0.537409723;
+const float COLOUR_CYCLE = 0.124862425;
+const float THETA = 2.12986207;
+const float SHEAR = 0.968176901;
+const float SHRINK = 0.955401778;
+const float LAYERS = 72.0;
+const float WARP_FREQ_X = 0.439311415;
+const float WARP_FREQ_Y = 2.87923527;
+const float WARP_AMP_X = 0.156202048;
+const float WARP_AMP_Y = 0.0256033838;
+const float ASPECT_X = 2.23183894;
+const float ASPECT_Y = 0.15731883;
+const float OFFSET_X = 0.375628948;
+const float OFFSET_Y = -0.017801486;
+const float TILT = 1.63293767;
+const float ZOOM = 0.93135649;
+const float CENTRE_X = -0.0956316143;
+const float CENTRE_Y = -0.520057321;
+const float GLOW_SIZE = 0.00201825937;
+const float FALLOFF = 0.352821857;
+const float VIGNETTE = 0.136085436;
+const float FLOW_SPEED = 0.391012281;
+const float FLOW_DIRECTION = 1.0;
+const float BREATH_RATE = 0.382053256;
+const float BREATH_AMOUNT = 0.0873704553;
+const float PHASE = 56.3862724;
+const float ECHO = 0.0;
+const float ECHO_SHIFT = 0.178754866;
+const float SOFTNESS = 0.00164903817;
+const float LIGHT_SWING = 0.149726808;
+
+const float TAU = 6.28318530718;
+
+vec3 oklchToLinear(float L, float C, float h) {
+ float a = C * cos(h), b = C * sin(h);
+ float l_ = L + 0.3963377774 * a + 0.2158037573 * b;
+ float m_ = L - 0.1055613458 * a - 0.0638541728 * b;
+ float s_ = L - 0.0894841775 * a - 1.2914855480 * b;
+ vec3 lms = vec3(l_, m_, s_);
+ lms = lms * lms * lms;
+ return mat3(4.0767416621, -1.2684380046, -0.0041960863,
+ -3.3077115913, 2.6097574011, -0.7034186147,
+ 0.2309699292, -0.3413193965, 1.7076147010) * lms;
+}
+
+float blueNoise(vec2 p, float frame) {
+ p += 5.588238 * mod(frame, 64.0);
+ return fract(52.9829189 * fract(0.06711056 * p.x + 0.00583715 * p.y));
+}
+
+void main() {
+ vec2 R = iResolution.xy;
+ vec2 pos = (gl_FragCoord.xy - 0.5 * R) / R.y;
+ float t = iTime * FLOW_SPEED * FLOW_DIRECTION + PHASE;
+ float breath = (-sin(iTime * BREATH_RATE * 1.5) + sin(iTime * BREATH_RATE + 1.0)) * 0.25 + 0.5;
+
+ vec2 u = (pos - vec2(CENTRE_X, CENTRE_Y)) * (ZOOM - breath * BREATH_AMOUNT);
+ float ct = cos(TILT), st = sin(TILT);
+ u = mat2(ct, st, -st, ct) * u;
+
+ mat2 fold = mat2(cos(THETA), sin(THETA), -SHEAR, cos(THETA));
+
+ float hue0 = HUE * TAU;
+ float hue1 = hue0 + HUE_SPREAD * TAU;
+ vec3 color = vec3(0.0);
+
+ for (float i = 1.0; i <= 96.0; i += 1.0) {
+ if (i > LAYERS) break;
+ u.x += -sin(u.y * WARP_FREQ_X + t + i * 0.007) * WARP_AMP_X;
+ u.y += -sin(u.x * WARP_FREQ_Y - t + i * 0.02) * WARP_AMP_Y;
+ u = fold * u * SHRINK;
+
+ vec2 q = u - vec2(OFFSET_X + breath * 0.1, OFFSET_Y);
+ vec2 s = vec2(q.x * ASPECT_X, q.y * ASPECT_Y);
+ float glow = GLOW_SIZE / (dot(s, s) + SOFTNESS);
+#ifndef SKIP_ECHO
+ vec2 e = vec2((q.x - ECHO_SHIFT) * ASPECT_X, s.y);
+ glow += ECHO * GLOW_SIZE / (dot(e, e) + SOFTNESS);
+#endif
+ glow *= 0.25 + breath * 0.4;
+
+ float r = length(u);
+ float k = sin(i * COLOUR_CYCLE + t * 1.2 + r * HUE_TRAVEL) * 0.5 + 0.5;
+ vec3 tint = clamp(oklchToLinear(LIGHTNESS + LIGHT_SWING * k, CHROMA * (0.75 + 0.35 * k), mix(hue0, hue1, k)), 0.0, 1.0);
+ color += glow * tint * exp2(-r * FALLOFF);
+ }
+
+ vec3 x = max(color, 0.0);
+ color = (x * (2.51 * x + 0.03)) / (x * (2.43 * x + 0.59) + 0.14);
+ color = pow(clamp(color, 0.0, 1.0), vec3(0.85, 0.92, 0.98));
+
+ float edge = smoothstep(0.5, 1.6, length(pos));
+ color *= 1.0 - edge * VIGNETTE;
+
+ vec3 dark = uDarkBackground + color * (1.0 - uDarkBackground);
+ float strength = max(color.r, max(color.g, color.b));
+ vec3 light = uLightBackground * (1.0 - strength) + color * 0.96;
+ color = mix(dark, light, uLightMode);
+
+ color += (blueNoise(gl_FragCoord.xy, floor(iTime * 24.0)) - 0.5) / 255.0;
+ fragColor = vec4(clamp(color, 0.0, 1.0), 1.0);
+}
+`;
+
+const RARITY_SHADER = `#version 300 es
+precision highp float;
+
+uniform sampler2D tScene;
+uniform vec2 iResolution;
+uniform float iTime;
+uniform float uLightMode;
+uniform vec3 uDarkBackground;
+uniform vec3 uLightBackground;
+uniform float uPixelRatio;
+out vec4 fragColor;
+
+const float uStrength = 0.797335207;
+const float uScale = 0.985214949;
+const float uSeed = 0.435611069;
+
+const float TAU = 6.28318530718;
+const vec3 LUMA = vec3(0.2126, 0.7152, 0.0722);
+
+vec3 toInk(vec3 c) { return mix(c - uDarkBackground, uLightBackground - c, uLightMode); }
+vec3 fromInk(vec3 ink) { return mix(uDarkBackground + ink, uLightBackground - ink, uLightMode); }
+vec3 sceneInk(vec2 uv) { return toInk(texture(tScene, clamp(uv, 0.0, 1.0)).rgb); }
+
+float blueNoise(vec2 p, float frame) {
+ p += 5.588238 * mod(frame, 64.0);
+ return fract(52.9829189 * fract(0.06711056 * p.x + 0.00583715 * p.y));
+}
+
+vec3 halftone(vec2 frag) {
+ float cell = max(3.0, uScale * 3.6 * uPixelRatio);
+ float angle = 0.26 + uSeed * 0.3;
+ mat2 turn = mat2(cos(angle), -sin(angle), sin(angle), cos(angle));
+ vec2 rotated = turn * frag;
+ vec2 grid = floor(rotated / cell);
+ vec2 centre = (grid + 0.5) * cell;
+ vec2 source = transpose(turn) * centre;
+ vec3 soft = sceneInk(frag / iResolution);
+ vec3 ink = sceneInk(source / iResolution);
+ float level = clamp(dot(ink, LUMA), 0.0, 1.0);
+ float radius = cell * sqrt(pow(level, 0.9) / 3.14159265);
+ float dist = length(rotated - centre);
+ float aa = 0.7 * uPixelRatio;
+ float dot_ = 1.0 - smoothstep(radius - aa, radius + aa, dist);
+ vec3 dots = ink * min(0.8 / max(level, 1e-3), 2.2) * dot_;
+ float presence = smoothstep(0.03, 0.16, level) * (0.3 + 0.14 * uStrength);
+ return mix(soft, dots, presence);
+}
+
+void main() {
+ vec2 frag = gl_FragCoord.xy;
+ vec3 ink = halftone(frag);
+ vec3 color = fromInk(clamp(ink, 0.0, 1.0));
+ color += (blueNoise(frag, floor(iTime * 24.0)) - 0.5) / 255.0;
+ fragColor = vec4(clamp(color, 0.0, 1.0), 1.0);
+}
+`;
+
+export type OpenShaderSource = {
+ /** OpenShaders' exported FIELD_SHADER, including #version 300 es. */
+ field: string;
+ /** Optional RARITY_SHADER using tScene. Extra texture inputs need an adapter. */
+ postprocess?: string;
+};
+
+export const remocnOpenShader: OpenShaderSource = {
+ field: FIELD_SHADER,
+ postprocess: RARITY_SHADER,
+};
+
+export type ShaderSeamProps = {
+ /** Softness of the material's dissolve edge, clamped to 0.02–0.4. */
+ softness?: number;
+ /** Organic variation mixed into the material's brightness, from 0 to 1. */
+ detail?: number;
+ /** Internal field animation speed. The default 0 keeps the material still. */
+ speed?: number;
+ /** Starting time in seconds in the selected shader. */
+ timeOffset?: number;
+ shader?: OpenShaderSource;
+};
+
+const clamp = (value: number, min: number, max: number) =>
+ Math.min(max, Math.max(min, value));
+
+// Exchange the scenes only while the shader is opaque across the entire frame.
+export function getShaderSeamPhase(progress: number) {
+ const p = clamp(progress, 0, 1);
+ const smoother = (t: number) => t * t * t * (t * (t * 6 - 15) + 10);
+ return {
+ presence: smoother(clamp(p / 0.34, 0, 1)),
+ dissolve: smoother(clamp((p - 0.46) / 0.54, 0, 1)),
+ showNext: p >= 0.4,
+ };
+}
+
+type SeamPhase = ReturnType<typeof getShaderSeamPhase>;
+
+const DISSOLVE_COMPOSITE = `#version 300 es
+precision highp float;
+uniform vec2 iResolution;
+uniform sampler2D tScene;
+uniform sampler2D tField;
+uniform float uPresence;
+uniform float uDissolve;
+uniform float uSoftness;
+uniform float uDetail;
+out vec4 fragColor;
+
+float hash(vec2 p) {
+ return fract(sin(dot(p, vec2(127.1, 311.7))) * 43758.5453);
+}
+float noise(vec2 p) {
+ vec2 i = floor(p), f = fract(p);
+ f = f * f * (3.0 - 2.0 * f);
+ return mix(mix(hash(i), hash(i + vec2(1, 0)), f.x),
+ mix(hash(i + vec2(0, 1)), hash(i + vec2(1, 1)), f.x), f.y);
+}
+void main() {
+ vec2 uv = gl_FragCoord.xy / iResolution;
+ vec2 p = gl_FragCoord.xy / iResolution.y;
+ vec3 field = texture(tField, uv).rgb;
+ float energy = max(field.r, max(field.g, field.b));
+ // Static, continuous noise breaks up the field without making it travel.
+ float grain = noise(p * 7.0) * 0.6 + noise(p * 19.0) * 0.28
+ + noise(p * 43.0) * 0.12;
+ float density = mix(smoothstep(0.025, 0.95, energy), grain, uDetail * 0.55);
+ float appear = mix(1.0 + uSoftness, -uSoftness, uPresence);
+ float disappear = mix(-uSoftness, 1.0 + uSoftness, uDissolve);
+ float alpha = smoothstep(appear - uSoftness, appear + uSoftness, density)
+ * smoothstep(disappear - uSoftness, disappear + uSoftness, density);
+ vec3 material = texture(tScene, uv).rgb;
+ fragColor = vec4(material * alpha, alpha);
+}
+`;
+
+function createSeamRenderer(
+ canvas: HTMLCanvasElement,
+ source: OpenShaderSource,
+) {
+ const gl = canvas.getContext("webgl2", {
+ alpha: true,
+ premultipliedAlpha: true,
+ antialias: false,
+ depth: false,
+ stencil: false,
+ });
+ if (!gl) throw new Error("Shader Seam requires WebGL2.");
+ const programs: WebGLProgram[] = [];
+ const textures: WebGLTexture[] = [];
+ const buffers: WebGLFramebuffer[] = [];
+ const shaders: WebGLShader[] = [];
+ const dispose = () => {
+ for (const program of programs) gl.deleteProgram(program);
+ for (const texture of textures) gl.deleteTexture(texture);
+ for (const buffer of buffers) gl.deleteFramebuffer(buffer);
+ for (const shader of shaders) gl.deleteShader(shader);
+ };
+ const program = (fragment: string, sceneInput = false, flowInput = false) => {
+ const result = gl.createProgram();
+ if (!result) throw new Error("Shader Seam: could not create a program.");
+ programs.push(result);
+ for (const [type, code] of [
+ [gl.VERTEX_SHADER, VERTEX_SHADER],
+ [gl.FRAGMENT_SHADER, fragment],
+ ] as const) {
+ const shader = gl.createShader(type);
+ if (!shader) throw new Error("Shader Seam: could not allocate a shader.");
+ shaders.push(shader);
+ gl.shaderSource(shader, code);
+ gl.compileShader(shader);
+ if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) {
+ throw new Error(`Shader Seam: ${gl.getShaderInfoLog(shader)}`);
+ }
+ gl.attachShader(result, shader);
+ }
+ gl.linkProgram(result);
+ if (!gl.getProgramParameter(result, gl.LINK_STATUS)) {
+ throw new Error(`Shader Seam: ${gl.getProgramInfoLog(result)}`);
+ }
+ const locations = new Map<string, WebGLUniformLocation | null>();
+ const uniform = (name: string) => {
+ if (!locations.has(name))
+ locations.set(name, gl.getUniformLocation(result, name));
+ return locations.get(name) ?? null;
+ };
+ // Fail explicitly for exports requiring assets this adapter cannot supply.
+ for (
+ let i = 0;
+ i < gl.getProgramParameter(result, gl.ACTIVE_UNIFORMS);
+ i++
+ ) {
+ const info = gl.getActiveUniform(result, i);
+ if (
+ info &&
+ (info.type === gl.SAMPLER_2D || info.type === gl.SAMPLER_CUBE) &&
+ !(sceneInput && info.name === "tScene") &&
+ !(flowInput && info.name === "tField")
+ ) {
+ throw new Error(
+ `Shader Seam: ${info.name} needs an additional texture adapter.`,
+ );
+ }
+ }
+ return {
+ begin: (
+ w: number,
+ h: number,
+ time: number,
+ phase: SeamPhase,
+ softness: number,
+ detail: number,
+ ) => {
+ gl.useProgram(result);
+ gl.viewport(0, 0, w, h);
+ gl.uniform2f(uniform("iResolution"), w, h);
+ gl.uniform1f(uniform("iTime"), time);
+ gl.uniform1f(uniform("uLightMode"), 0);
+ gl.uniform3f(uniform("uDarkBackground"), 9 / 255, 9 / 255, 9 / 255);
+ gl.uniform3f(uniform("uLightBackground"), 1, 1, 1);
+ gl.uniform1f(uniform("uPixelRatio"), 1);
+ gl.uniform2f(uniform("uTilt"), 0, 0);
+ gl.uniform1i(uniform("tScene"), 0);
+ gl.uniform1i(uniform("tField"), 1);
+ gl.uniform1f(uniform("uPresence"), phase.presence);
+ gl.uniform1f(uniform("uDissolve"), phase.dissolve);
+ gl.uniform1f(uniform("uSoftness"), softness);
+ gl.uniform1f(uniform("uDetail"), detail);
+ },
+ };
+ };
+ const target = () => {
+ const texture = gl.createTexture();
+ const framebuffer = gl.createFramebuffer();
+ if (texture) textures.push(texture);
+ if (framebuffer) buffers.push(framebuffer);
+ if (!texture || !framebuffer)
+ throw new Error("Shader Seam: could not create render target.");
+ gl.activeTexture(gl.TEXTURE0);
+ gl.bindTexture(gl.TEXTURE_2D, texture);
+ gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);
+ gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);
+ gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
+ gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
+ let size = "";
+ return {
+ texture,
+ bind: (width: number, height: number) => {
+ gl.bindFramebuffer(gl.FRAMEBUFFER, framebuffer);
+ if (size !== `${width}:${height}`) {
+ gl.activeTexture(gl.TEXTURE0);
+ gl.bindTexture(gl.TEXTURE_2D, texture);
+ gl.texImage2D(
+ gl.TEXTURE_2D,
+ 0,
+ gl.RGBA,
+ width,
+ height,
+ 0,
+ gl.RGBA,
+ gl.UNSIGNED_BYTE,
+ null,
+ );
+ gl.framebufferTexture2D(
+ gl.FRAMEBUFFER,
+ gl.COLOR_ATTACHMENT0,
+ gl.TEXTURE_2D,
+ texture,
+ 0,
+ );
+ if (
+ gl.checkFramebufferStatus(gl.FRAMEBUFFER) !==
+ gl.FRAMEBUFFER_COMPLETE
+ ) {
+ throw new Error("Shader Seam: incomplete render target.");
+ }
+ size = `${width}:${height}`;
+ }
+ },
+ };
+ };
+ try {
+ const field = program(source.field);
+ const post = source.postprocess ? program(source.postprocess, true) : null;
+ const composite = program(DISSOLVE_COMPOSITE, true, true);
+ const full = target();
+ const material = target();
+ const bindTexture = (texture: WebGLTexture, unit: number) => {
+ gl.activeTexture(unit === 0 ? gl.TEXTURE0 : gl.TEXTURE1);
+ gl.bindTexture(gl.TEXTURE_2D, texture);
+ };
+ return {
+ dispose,
+ draw: (
+ width: number,
+ height: number,
+ time: number,
+ phase: SeamPhase,
+ softness: number,
+ detail: number,
+ ) => {
+ if (gl.isContextLost())
+ throw new Error("Shader Seam: WebGL context was lost.");
+ if (canvas.width !== width) canvas.width = width;
+ if (canvas.height !== height) canvas.height = height;
+ full.bind(width, height);
+ field.begin(width, height, time, phase, softness, detail);
+ gl.drawArrays(gl.TRIANGLES, 0, 3);
+ if (post) {
+ material.bind(width, height);
+ post.begin(width, height, time, phase, softness, detail);
+ bindTexture(full.texture, 0);
+ gl.drawArrays(gl.TRIANGLES, 0, 3);
+ }
+ gl.bindFramebuffer(gl.FRAMEBUFFER, null);
+ composite.begin(width, height, time, phase, softness, detail);
+ bindTexture(post ? material.texture : full.texture, 0);
+ bindTexture(full.texture, 1);
+ gl.drawArrays(gl.TRIANGLES, 0, 3);
+ },
+ };
+ } catch (error) {
+ dispose();
+ throw error;
+ }
+}
+
+function ShaderSeamPresentation({
+ children,
+ presentationProgress,
+ presentationDirection,
+ presentationDurationInFrames,
+ passedProps,
+}: TransitionPresentationComponentProps<ShaderSeamProps>) {
+ const { width, height, fps } = useVideoConfig();
+ const { delayRender, continueRender, cancelRender } = useDelayRender();
+ const canvas = useRef<HTMLCanvasElement>(null);
+ const renderer = useRef<ReturnType<typeof createSeamRenderer> | null>(null);
+ const entering = presentationDirection === "entering";
+ const {
+ softness = 0.18,
+ detail = 0.65,
+ speed = 0,
+ timeOffset = 0,
+ shader = remocnOpenShader,
+ } = passedProps;
+ const { field, postprocess } = shader;
+ const p = clamp(presentationProgress, 0, 1);
+ const active = entering && p > 0 && p < 1;
+ const phase = getShaderSeamPhase(p);
+
+ useLayoutEffect(() => {
+ if (!active || !canvas.current) return;
+ const handle = delayRender("Initialize Shader Seam");
+ try {
+ renderer.current = createSeamRenderer(canvas.current, {
+ field,
+ postprocess,
+ });
+ continueRender(handle);
+ } catch (error) {
+ cancelRender(error instanceof Error ? error : new Error(String(error)));
+ }
+ return () => {
+ renderer.current?.dispose();
+ renderer.current = null;
+ };
+ }, [active, field, postprocess, delayRender, continueRender, cancelRender]);
+
+ // biome-ignore lint/correctness/useExhaustiveDependencies: redraw a newly compiled source even when the playhead is paused.
+ useLayoutEffect(() => {
+ if (!active || !canvas.current) return;
+ try {
+ const time =
+ timeOffset + ((p * presentationDurationInFrames) / fps) * speed;
+ renderer.current?.draw(
+ width,
+ height,
+ time,
+ getShaderSeamPhase(p),
+ clamp(softness, 0.02, 0.4),
+ clamp(detail, 0, 1),
+ );
+ } catch (error) {
+ cancelRender(error instanceof Error ? error : new Error(String(error)));
+ }
+ }, [
+ p,
+ active,
+ width,
+ height,
+ fps,
+ softness,
+ detail,
+ speed,
+ timeOffset,
+ presentationDurationInFrames,
+ entering,
+ field,
+ postprocess,
+ cancelRender,
+ ]);
+
+ return (
+ <AbsoluteFill style={{ overflow: "hidden" }}>
+ <AbsoluteFill
+ style={{
+ visibility: entering !== phase.showNext ? "hidden" : "visible",
+ }}
+ >
+ {children}
+ </AbsoluteFill>
+ <canvas
+ ref={canvas}
+ aria-hidden="true"
+ tabIndex={-1}
+ style={{
+ position: "absolute",
+ inset: 0,
+ width: "100%",
+ height: "100%",
+ visibility: entering && active ? "visible" : "hidden",
+ pointerEvents: "none",
+ }}
+ />
+ </AbsoluteFill>
+ );
+}
+
+export function shaderSeam(
+ props: ShaderSeamProps = {},
+): TransitionPresentation<ShaderSeamProps> {
+ return { component: ShaderSeamPresentation, props };
+}
diff --git a/registry/remocn/shader-spiral-pass/__tests__/phase.test.ts b/registry/remocn/shader-spiral-pass/__tests__/phase.test.ts
new file mode 100644
index 00000000..aef8c49c
--- /dev/null
+++ b/registry/remocn/shader-spiral-pass/__tests__/phase.test.ts
@@ -0,0 +1,51 @@
+import { describe, expect, test } from "bun:test";
+import { getSpiralPassPhase } from "..";
+
+describe("spiral pass", () => {
+ test("exact endpoints contain the correct untransformed scene", () => {
+ const start = getSpiralPassPhase(0);
+ const end = getSpiralPassPhase(1);
+ expect(start.cover).toBe(0);
+ expect(start.showNext).toBe(false);
+ expect(start.outgoingZoom).toBe(1);
+ expect(end.showNext).toBe(true);
+ expect(end.aperture).toBe(1);
+ expect(end.incomingZoom).toBe(1);
+ });
+
+ test("scene exchange happens under full coverage before the exit opens", () => {
+ for (const p of [0.19999, 0.2, 0.20001]) {
+ const phase = getSpiralPassPhase(p);
+ expect(phase.cover).toBe(1);
+ expect(phase.aperture).toBe(0);
+ }
+ expect(getSpiralPassPhase(0.19999).showNext).toBe(false);
+ expect(getSpiralPassPhase(0.2).showNext).toBe(true);
+ });
+
+ test("camera advances and exit expands without reversal", () => {
+ let previous = getSpiralPassPhase(0);
+ for (let frame = 1; frame <= 120; frame++) {
+ const phase = getSpiralPassPhase(frame / 120);
+ expect(phase.zoom).toBeGreaterThanOrEqual(previous.zoom);
+ expect(phase.aperture).toBeGreaterThanOrEqual(previous.aperture);
+ previous = phase;
+ }
+ });
+
+ test("keeps the incoming scene behind the tunnel until the final approach", () => {
+ expect(getSpiralPassPhase(0.6).aperture).toBe(0);
+ expect(getSpiralPassPhase(0.64).aperture).toBe(0);
+ expect(getSpiralPassPhase(0.7).aperture).toBeLessThan(0.01);
+ expect(getSpiralPassPhase(0.9).aperture).toBeGreaterThan(0.5);
+ });
+
+ test("clamps overshoot and invalid input to renderable phases", () => {
+ expect(getSpiralPassPhase(-0.1)).toEqual(getSpiralPassPhase(0));
+ expect(getSpiralPassPhase(1.1)).toEqual(getSpiralPassPhase(1));
+ expect(getSpiralPassPhase(Number.NaN, Number.NaN)).toEqual(
+ getSpiralPassPhase(0),
+ );
+ expect(getSpiralPassPhase(1, Infinity).zoom).toBeCloseTo(14);
+ });
+});
diff --git a/registry/remocn/shader-spiral-pass/config.ts b/registry/remocn/shader-spiral-pass/config.ts
new file mode 100644
index 00000000..028f5e78
--- /dev/null
+++ b/registry/remocn/shader-spiral-pass/config.ts
@@ -0,0 +1,69 @@
+import { shaderSpiralPassExampleCode } from "@/components/docs/examples/shader-spiral-pass-example";
+import { type ComponentConfig, FPS, H, W } from "@/lib/customizer-config";
+
+export const shaderSpiralPassConfig: ComponentConfig = {
+ componentName: "shaderSpiralPass",
+ importPath: "@/components/remocn/shader-spiral-pass",
+ controls: {
+ speed: {
+ type: "number",
+ default: 1,
+ min: 0,
+ max: 5,
+ step: 0.1,
+ description: "Shader flow speed",
+ hiddenFromList: false,
+ },
+ spirals: {
+ type: "number",
+ default: 3,
+ min: 1,
+ max: 6,
+ step: 1,
+ description: "Spiral count",
+ hiddenFromList: false,
+ },
+ twist: {
+ type: "number",
+ default: 0.7,
+ min: 0,
+ max: 2,
+ step: 0.05,
+ description: "Spiral motion",
+ hiddenFromList: false,
+ },
+ zoom: {
+ type: "number",
+ default: 14,
+ min: 2,
+ max: 24,
+ step: 1,
+ description: "Camera push",
+ hiddenFromList: false,
+ },
+ softness: {
+ type: "number",
+ default: 0.12,
+ min: 0.02,
+ max: 0.3,
+ step: 0.01,
+ description: "Exit softness",
+ hiddenFromList: false,
+ },
+ timeOffset: {
+ type: "number",
+ default: 0,
+ min: 0,
+ max: 60,
+ step: 0.1,
+ description: "Start time",
+ hiddenFromList: false,
+ },
+ },
+ durationInFrames: 168,
+ fps: FPS,
+ compositionWidth: W,
+ compositionHeight: H,
+ previewBackdrop: { type: "color", value: "#15111c" },
+ snippet: shaderSpiralPassExampleCode,
+};
diff --git a/registry/remocn/shader-spiral-pass/index.tsx b/registry/remocn/shader-spiral-pass/index.tsx
new file mode 100644
index 00000000..f9812ad3
--- /dev/null
+++ b/registry/remocn/shader-spiral-pass/index.tsx
@@ -0,0 +1,171 @@
+"use client";
+
+import type {
+ TransitionPresentation,
+ TransitionPresentationComponentProps,
+} from "@remotion/transitions";
+import { useLayoutEffect, useRef } from "react";
+import { AbsoluteFill, useDelayRender, useVideoConfig } from "remotion";
+import { createTunnelRenderer } from "@/components/remocn/shader-light-tunnel";
+
+export type ShaderSpiralPassProps = {
+ /** Shader motion multiplier; transition duration is controlled by timing. */
+ speed?: number;
+ spirals?: number;
+ twist?: number;
+ /** Magnification reached while passing through the center, from 2 to 24. */
+ zoom?: number;
+ /** Feather width as a fraction of the shorter composition dimension. */
+ softness?: number;
+ timeOffset?: number;
+};
+
+const clamp = (value: number, min: number, max: number) =>
+ Math.min(max, Math.max(min, value));
+const finite = (value: number, fallback: number, min: number, max: number) =>
+ clamp(Number.isFinite(value) ? value : fallback, min, max);
+const smooth = (start: number, end: number, value: number) => {
+ const t = clamp((value - start) / (end - start), 0, 1);
+ return t * t * (3 - 2 * t);
+};
+
+/** Pure phase calculation also used to verify endpoint and coverage behavior. */
+export function getSpiralPassPhase(progress: number, zoom = 14) {
+ const p = finite(progress, 0, 0, 1);
+ const dive = clamp((p - 0.08) / 0.84, 0, 1);
+ return {
+ cover: smooth(0, 0.18, p),
+ showNext: p >= 0.2,
+ zoom: Math.exp(Math.log(finite(zoom, 14, 2, 24)) * dive * dive),
+ aperture: smooth(0.64, 1, p) ** 2,
+ outgoingZoom: 1 + 0.5 * smooth(0, 0.22, p),
+ incomingZoom: 1 + 0.12 * (1 - smooth(0.55, 1, p)),
+ };
+}
+
+function ShaderSpiralPassPresentation({
+ children,
+ presentationProgress,
+ presentationDirection,
+ presentationDurationInFrames,
+ passedProps,
+}: TransitionPresentationComponentProps<ShaderSpiralPassProps>) {
+ const { width, height, fps } = useVideoConfig();
+ const { delayRender, continueRender, cancelRender } = useDelayRender();
+ const canvas = useRef<HTMLCanvasElement>(null);
+ const renderer = useRef<ReturnType<typeof createTunnelRenderer> | null>(null);
+ const {
+ speed = 1,
+ spirals = 3,
+ twist = 0.7,
+ zoom = 14,
+ softness = 0.12,
+ timeOffset = 0,
+ } = passedProps;
+ const p = finite(presentationProgress, 0, 0, 1);
+ const entering = presentationDirection === "entering";
+ const active = entering && p > 0 && p < 1;
+ const phase = getSpiralPassPhase(p, zoom);
+ const feather = Math.min(width, height) * finite(softness, 0.12, 0.02, 0.3);
+ const radius = (Math.hypot(width, height) / 2 + feather) * phase.aperture;
+ // Clip the incoming scene itself, in screen space. Its content must never
+ // extend through the shader outside the exit, even when the scene is scaled.
+ const edge = Math.min(feather, radius * 0.12);
+ const sceneMask =
+ entering && p < 1
+ ? `radial-gradient(circle at center, black ${Math.max(0, radius - edge)}px, transparent ${radius}px)`
+ : undefined;
+
+ useLayoutEffect(() => {
+ if (!active || !canvas.current) return;
+ const handle = delayRender("Initialize Shader Spiral Pass");
+ try {
+ renderer.current = createTunnelRenderer(canvas.current);
+ continueRender(handle);
+ } catch (error) {
+ cancelRender(error instanceof Error ? error : new Error(String(error)));
+ }
+ return () => {
+ renderer.current?.dispose();
+ renderer.current = null;
+ };
+ }, [active, delayRender, continueRender, cancelRender]);
+
+ // biome-ignore lint/correctness/useExhaustiveDependencies: canvas resizing clears its pixels, including while paused.
+ useLayoutEffect(() => {
+ if (!active) return;
+ try {
+ // Integrate acceleration so shader motion speeds up without a time jump.
+ const seconds = (p * presentationDurationInFrames) / fps;
+ const time =
+ finite(timeOffset, 0, -10000, 10000) +
+ seconds * (1 + 0.8 * p * p) * finite(speed, 1, 0, 5);
+ renderer.current?.draw(time, twist, 1, 1, spirals, phase.zoom);
+ } catch (error) {
+ cancelRender(error instanceof Error ? error : new Error(String(error)));
+ }
+ }, [
+ active,
+ p,
+ presentationDurationInFrames,
+ fps,
+ speed,
+ timeOffset,
+ twist,
+ spirals,
+ phase.zoom,
+ width,
+ height,
+ cancelRender,
+ ]);
+
+ return (
+ <AbsoluteFill style={{ overflow: "hidden" }}>
+ {active && (
+ <AbsoluteFill
+ style={{
+ opacity: phase.cover,
+ pointerEvents: "none",
+ }}
+ >
+ <canvas
+ ref={canvas}
+ width={width}
+ height={height}
+ aria-hidden="true"
+ tabIndex={-1}
+ style={{
+ position: "absolute",
+ inset: 0,
+ width: "100%",
+ height: "100%",
+ }}
+ />
+ </AbsoluteFill>
+ )}
+ <AbsoluteFill
+ style={{
+ visibility: entering !== phase.showNext ? "hidden" : "visible",
+ opacity: entering && p < 1 ? smooth(0.64, 0.72, p) : 1,
+ maskImage: sceneMask,
+ WebkitMaskImage: sceneMask,
+ }}
+ >
+ <AbsoluteFill
+ style={{
+ transform: `scale(${entering ? phase.incomingZoom : phase.outgoingZoom})`,
+ transformOrigin: "center",
+ }}
+ >
+ {children}
+ </AbsoluteFill>
+ </AbsoluteFill>
+ </AbsoluteFill>
+ );
+}
+
+export function shaderSpiralPass(
+ props: ShaderSpiralPassProps = {},
+): TransitionPresentation<ShaderSpiralPassProps> {
+ return { component: ShaderSpiralPassPresentation, props };
+}
diff --git a/registry/remocn/shader-text-reveal/__tests__/shader-text-reveal.test.ts b/registry/remocn/shader-text-reveal/__tests__/shader-text-reveal.test.ts
new file mode 100644
index 00000000..814c00ca
--- /dev/null
+++ b/registry/remocn/shader-text-reveal/__tests__/shader-text-reveal.test.ts
@@ -0,0 +1,26 @@
+import { describe, expect, it } from "bun:test";
+import { getShaderTextState } from "..";
+
+describe("shader text word timing", () => {
+ it("uses one beat per word and keeps the final word visible", () => {
+ expect(getShaderTextState(29, 2, 30).index).toBe(0);
+ expect(getShaderTextState(30, 2, 30).index).toBe(1);
+ const hold = getShaderTextState(300, 2, 30);
+ expect(hold).toEqual({ index: 1, enter: 1, exit: 0, scale: 1 });
+ });
+ it("clears the outgoing word before beginning the next reveal", () => {
+ expect(getShaderTextState(29.99, 2, 30).exit).toBeGreaterThan(0.999);
+ const next = getShaderTextState(30, 2, 30);
+ expect(next.enter).toBeLessThan(0.25);
+ expect(next.exit).toBe(0);
+ });
+ it("clamps invalid duration and negative frames without invalid indices", () => {
+ expect(getShaderTextState(-5, 0, 0)).toEqual(getShaderTextState(0, 1, 12));
+ expect(getShaderTextState(12, 2, 2).index).toBe(1);
+ });
+ it("reproduces the same state when seeking backwards", () => {
+ const first = getShaderTextState(9, 2, 30);
+ getShaderTextState(50, 2, 30);
+ expect(getShaderTextState(9, 2, 30)).toEqual(first);
+ });
+});
diff --git a/registry/remocn/shader-text-reveal/config.ts b/registry/remocn/shader-text-reveal/config.ts
new file mode 100644
index 00000000..f837321b
--- /dev/null
+++ b/registry/remocn/shader-text-reveal/config.ts
@@ -0,0 +1,45 @@
+import { type ComponentConfig, FPS, H, W } from "@/lib/customizer-config";
+
+export const shaderTextRevealConfig: ComponentConfig = {
+ componentName: "ShaderTextReveal",
+ importPath: "@/components/remocn/shader-text-reveal",
+ controls: {
+ text: {
+ type: "text-content",
+ default: "Your product",
+ description: "Text",
+ },
+ fontSize: {
+ type: "number",
+ default: 400,
+ min: 24,
+ max: 500,
+ step: 1,
+ description: "Font size",
+ hiddenFromList: false,
+ },
+ wordDuration: {
+ type: "number",
+ default: 30,
+ min: 12,
+ max: 90,
+ step: 1,
+ description: "Frames per word",
+ hiddenFromList: false,
+ },
+ intensity: {
+ type: "number",
+ default: 1,
+ min: 0,
+ max: 1,
+ step: 0.01,
+ description: "Hero shader strength",
+ hiddenFromList: false,
+ },
+ },
+ durationInFrames: 75,
+ fps: FPS,
+ compositionWidth: W,
+ compositionHeight: H,
+ previewBackdrop: { type: "color", value: "#000000" },
+};
diff --git a/registry/remocn/shader-text-reveal/index.tsx b/registry/remocn/shader-text-reveal/index.tsx
new file mode 100644
index 00000000..c75bebc7
--- /dev/null
+++ b/registry/remocn/shader-text-reveal/index.tsx
@@ -0,0 +1,598 @@
+"use client";
+
+import { useLayoutEffect, useRef } from "react";
+import { useCurrentFrame, useDelayRender, useVideoConfig } from "remotion";
+
+export type ShaderTextRevealProps = {
+ /** Words appear one at a time. Separate phrases with newlines to keep them together. */
+ text?: string;
+ fontSize?: number;
+ fontFamily?: string;
+ fontWeight?: number;
+ /** Frames per word, including its entrance and exit. The final word stays visible. */
+ wordDuration?: number;
+ /** Strength of the original hero shader inside the letters, from 0 to 1. */
+ intensity?: number;
+};
+
+const clamp = (n: number, min = 0, max = 1) => Math.min(max, Math.max(min, n));
+
+export function getShaderTextState(
+ frame: number,
+ wordCount: number,
+ wordDuration: number,
+) {
+ const duration = Math.max(12, Math.round(wordDuration));
+ const count = Math.max(1, wordCount);
+ const f = Math.max(0, frame);
+ const index = Math.min(count - 1, Math.floor(f / duration));
+ const local = f - index * duration;
+ const enter = clamp((local / duration + 0.16) / 0.76);
+ const exit =
+ index === count - 1 ? 0 : clamp((local / duration - 0.65) / 0.35);
+ return {
+ index,
+ enter,
+ exit: exit * exit * (3 - 2 * exit),
+ scale: 1 + 0.12 * (1 - enter) ** 3,
+ };
+}
+
+const VERTEX = `#version 300 es
+void main() {
+ vec2 p = vec2(float((gl_VertexID << 1) & 2), float(gl_VertexID & 2));
+ gl_Position = vec4(p * 2.0 - 1.0, 0.0, 1.0);
+}`;
+
+/* @remocn · OpenShaders — https://openshaders.com/@remocn
+ * Original hero field and halftone GLSL. Only its clock is driven by Remotion.
+ */
+const HERO_FIELD = `#version 300 es
+precision highp float;
+
+uniform vec2 iResolution;
+uniform float iTime;
+uniform float uLightMode;
+uniform vec3 uDarkBackground;
+uniform vec3 uLightBackground;
+out vec4 fragColor;
+
+const float HUE = 0.663466752;
+const float HUE_SPREAD = 0.314346701;
+const float HUE_TRAVEL = 1.65112376;
+const float CHROMA = 0.160295546;
+const float LIGHTNESS = 0.537409723;
+const float COLOUR_CYCLE = 0.124862425;
+const float THETA = 2.12986207;
+const float SHEAR = 0.968176901;
+const float SHRINK = 0.955401778;
+const float LAYERS = 72.0;
+const float WARP_FREQ_X = 0.439311415;
+const float WARP_FREQ_Y = 2.87923527;
+const float WARP_AMP_X = 0.156202048;
+const float WARP_AMP_Y = 0.0256033838;
+const float ASPECT_X = 2.23183894;
+const float ASPECT_Y = 0.15731883;
+const float OFFSET_X = 0.375628948;
+const float OFFSET_Y = -0.017801486;
+const float TILT = 1.63293767;
+const float ZOOM = 0.93135649;
+const float CENTRE_X = -0.0956316143;
+const float CENTRE_Y = -0.520057321;
+const float GLOW_SIZE = 0.00201825937;
+const float FALLOFF = 0.352821857;
+const float VIGNETTE = 0.136085436;
+const float FLOW_SPEED = 0.391012281;
+const float FLOW_DIRECTION = 1.0;
+const float BREATH_RATE = 0.382053256;
+const float BREATH_AMOUNT = 0.0873704553;
+const float PHASE = 56.3862724;
+const float ECHO = 0.0;
+const float ECHO_SHIFT = 0.178754866;
+const float SOFTNESS = 0.00164903817;
+const float LIGHT_SWING = 0.149726808;
+
+const float TAU = 6.28318530718;
+
+vec3 oklchToLinear(float L, float C, float h) {
+ float a = C * cos(h), b = C * sin(h);
+ float l_ = L + 0.3963377774 * a + 0.2158037573 * b;
+ float m_ = L - 0.1055613458 * a - 0.0638541728 * b;
+ float s_ = L - 0.0894841775 * a - 1.2914855480 * b;
+ vec3 lms = vec3(l_, m_, s_);
+ lms = lms * lms * lms;
+ return mat3(4.0767416621, -1.2684380046, -0.0041960863,
+ -3.3077115913, 2.6097574011, -0.7034186147,
+ 0.2309699292, -0.3413193965, 1.7076147010) * lms;
+}
+
+float blueNoise(vec2 p, float frame) {
+ p += 5.588238 * mod(frame, 64.0);
+ return fract(52.9829189 * fract(0.06711056 * p.x + 0.00583715 * p.y));
+}
+
+void main() {
+ vec2 R = iResolution.xy;
+ vec2 pos = (gl_FragCoord.xy - 0.5 * R) / R.y;
+ float t = iTime * FLOW_SPEED * FLOW_DIRECTION + PHASE;
+ float breath = (-sin(iTime * BREATH_RATE * 1.5) + sin(iTime * BREATH_RATE + 1.0)) * 0.25 + 0.5;
+
+ vec2 u = (pos - vec2(CENTRE_X, CENTRE_Y)) * (ZOOM - breath * BREATH_AMOUNT);
+ float ct = cos(TILT), st = sin(TILT);
+ u = mat2(ct, st, -st, ct) * u;
+
+ mat2 fold = mat2(cos(THETA), sin(THETA), -SHEAR, cos(THETA));
+
+ float hue0 = HUE * TAU;
+ float hue1 = hue0 + HUE_SPREAD * TAU;
+ vec3 color = vec3(0.0);
+
+ for (float i = 1.0; i <= 96.0; i += 1.0) {
+ if (i > LAYERS) break;
+ u.x += -sin(u.y * WARP_FREQ_X + t + i * 0.007) * WARP_AMP_X;
+ u.y += -sin(u.x * WARP_FREQ_Y - t + i * 0.02) * WARP_AMP_Y;
+ u = fold * u * SHRINK;
+
+ vec2 q = u - vec2(OFFSET_X + breath * 0.1, OFFSET_Y);
+ vec2 s = vec2(q.x * ASPECT_X, q.y * ASPECT_Y);
+ float glow = GLOW_SIZE / (dot(s, s) + SOFTNESS);
+#ifndef SKIP_ECHO
+ vec2 e = vec2((q.x - ECHO_SHIFT) * ASPECT_X, s.y);
+ glow += ECHO * GLOW_SIZE / (dot(e, e) + SOFTNESS);
+#endif
+ glow *= 0.25 + breath * 0.4;
+
+ float r = length(u);
+ float k = sin(i * COLOUR_CYCLE + t * 1.2 + r * HUE_TRAVEL) * 0.5 + 0.5;
+ vec3 tint = clamp(oklchToLinear(LIGHTNESS + LIGHT_SWING * k, CHROMA * (0.75 + 0.35 * k), mix(hue0, hue1, k)), 0.0, 1.0);
+ color += glow * tint * exp2(-r * FALLOFF);
+ }
+
+ vec3 x = max(color, 0.0);
+ color = (x * (2.51 * x + 0.03)) / (x * (2.43 * x + 0.59) + 0.14);
+ color = pow(clamp(color, 0.0, 1.0), vec3(0.85, 0.92, 0.98));
+
+ float edge = smoothstep(0.5, 1.6, length(pos));
+ color *= 1.0 - edge * VIGNETTE;
+
+ vec3 dark = uDarkBackground + color * (1.0 - uDarkBackground);
+ float strength = max(color.r, max(color.g, color.b));
+ vec3 light = uLightBackground * (1.0 - strength) + color * 0.96;
+ color = mix(dark, light, uLightMode);
+
+ color += (blueNoise(gl_FragCoord.xy, floor(iTime * 24.0)) - 0.5) / 255.0;
+ fragColor = vec4(clamp(color, 0.0, 1.0), 1.0);
+}
+`;
+
+const HERO_HALFTONE = `#version 300 es
+precision highp float;
+
+uniform sampler2D tScene;
+uniform vec2 iResolution;
+uniform float iTime;
+uniform float uLightMode;
+uniform vec3 uDarkBackground;
+uniform vec3 uLightBackground;
+uniform float uPixelRatio;
+out vec4 fragColor;
+
+const float uStrength = 0.797335207;
+const float uScale = 0.985214949;
+const float uSeed = 0.435611069;
+
+const float TAU = 6.28318530718;
+const vec3 LUMA = vec3(0.2126, 0.7152, 0.0722);
+
+vec3 toInk(vec3 c) { return mix(c - uDarkBackground, uLightBackground - c, uLightMode); }
+vec3 fromInk(vec3 ink) { return mix(uDarkBackground + ink, uLightBackground - ink, uLightMode); }
+vec3 sceneInk(vec2 uv) { return toInk(texture(tScene, clamp(uv, 0.0, 1.0)).rgb); }
+
+float blueNoise(vec2 p, float frame) {
+ p += 5.588238 * mod(frame, 64.0);
+ return fract(52.9829189 * fract(0.06711056 * p.x + 0.00583715 * p.y));
+}
+
+vec3 halftone(vec2 frag) {
+ float cell = max(3.0, uScale * 3.6 * uPixelRatio);
+ float angle = 0.26 + uSeed * 0.3;
+ mat2 turn = mat2(cos(angle), -sin(angle), sin(angle), cos(angle));
+ vec2 rotated = turn * frag;
+ vec2 grid = floor(rotated / cell);
+ vec2 centre = (grid + 0.5) * cell;
+ vec2 source = transpose(turn) * centre;
+ vec3 soft = sceneInk(frag / iResolution);
+ vec3 ink = sceneInk(source / iResolution);
+ float level = clamp(dot(ink, LUMA), 0.0, 1.0);
+ float radius = cell * sqrt(pow(level, 0.9) / 3.14159265);
+ float dist = length(rotated - centre);
+ float aa = 0.7 * uPixelRatio;
+ float dot_ = 1.0 - smoothstep(radius - aa, radius + aa, dist);
+ vec3 dots = ink * min(0.8 / max(level, 1e-3), 2.2) * dot_;
+ float presence = smoothstep(0.03, 0.16, level) * (0.3 + 0.14 * uStrength);
+ return mix(soft, dots, presence);
+}
+
+void main() {
+ vec2 frag = gl_FragCoord.xy;
+ vec3 ink = halftone(frag);
+ vec3 color = fromInk(clamp(ink, 0.0, 1.0));
+ color += (blueNoise(frag, floor(iTime * 24.0)) - 0.5) / 255.0;
+ fragColor = vec4(clamp(color, 0.0, 1.0), 1.0);
+}
+`;
+
+const FRAGMENT = `#version 300 es
+precision highp float;
+uniform sampler2D uText;
+uniform sampler2D uHero;
+uniform vec2 uResolution;
+uniform vec4 uBounds;
+uniform float uEnter;
+uniform float uExit;
+uniform float uScale;
+uniform float uTime;
+uniform float uIntensity;
+out vec4 fragColor;
+
+void main() {
+ vec2 uv = (gl_FragCoord.xy / uResolution - 0.5) / uScale + 0.5;
+ vec2 q = (uv - uBounds.xy) / uBounds.zw;
+ float flow = sin(q.x * 7.0 + q.y * 5.0 - uTime * 3.2) * 0.065
+ + sin(q.x * 13.0 - q.y * 8.0 + uTime * 2.1) * 0.025;
+ float rank = q.x * 0.64 + (1.0 - q.y) * 0.36 + flow;
+ float d = rank - mix(-0.15, 1.65, uEnter);
+ float edge = exp(-pow((d + 0.1) * 6.0, 2.0));
+ // Refraction affects the glyph itself, concentrated inside the wet leading edge.
+ vec3 field = texture(uHero, uv).rgb;
+ vec2 warp = vec2(field.r - field.b, field.g - field.r);
+ vec2 sampleUV = uv + warp * edge * uIntensity * 2.5 / uResolution;
+ float glyph = texture(uText, sampleUV).a;
+ float appear = 1.0 - smoothstep(-0.025, 0.09, d);
+ float exitRank = q.x * 0.65 + (1.0 - q.y) * 0.5 + flow;
+ float leave = smoothstep(-0.12, 0.06, exitRank - mix(-0.25, 1.45, uExit));
+
+ vec3 liquid = texture(uHero, sampleUV).rgb;
+ vec3 silver = vec3(0.96, 0.925, 1.0);
+ float settled = 1.0 - smoothstep(-0.58, -0.16, d);
+ vec3 color = mix(liquid, silver, settled);
+ color = mix(silver, color, uIntensity);
+ float alpha = glyph * appear * leave;
+ fragColor = vec4(color * alpha, alpha);
+}`;
+
+function createRenderer(canvas: HTMLCanvasElement) {
+ const gl = canvas.getContext("webgl2", {
+ alpha: true,
+ premultipliedAlpha: true,
+ antialias: false,
+ depth: false,
+ });
+ if (!gl) throw new Error("Shader Text Reveal requires WebGL2.");
+ const shaders: WebGLShader[] = [];
+ const programs: WebGLProgram[] = [];
+ const textures: WebGLTexture[] = [];
+ const buffers: WebGLFramebuffer[] = [];
+ const dispose = () => {
+ for (const shader of shaders) gl.deleteShader(shader);
+ for (const program of programs) gl.deleteProgram(program);
+ for (const texture of textures) gl.deleteTexture(texture);
+ for (const buffer of buffers) gl.deleteFramebuffer(buffer);
+ };
+ const compile = (fragment: string) => {
+ const program = gl.createProgram();
+ if (!program) throw new Error("Shader Text Reveal: GPU allocation failed.");
+ programs.push(program);
+ for (const [type, source] of [
+ [gl.VERTEX_SHADER, VERTEX],
+ [gl.FRAGMENT_SHADER, fragment],
+ ] as const) {
+ const shader = gl.createShader(type);
+ if (!shader)
+ throw new Error("Shader Text Reveal: shader allocation failed.");
+ shaders.push(shader);
+ gl.shaderSource(shader, source);
+ gl.compileShader(shader);
+ if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS))
+ throw new Error(
+ gl.getShaderInfoLog(shader) ?? "Shader compilation failed.",
+ );
+ gl.attachShader(program, shader);
+ }
+ gl.linkProgram(program);
+ if (!gl.getProgramParameter(program, gl.LINK_STATUS))
+ throw new Error(gl.getProgramInfoLog(program) ?? "Shader link failed.");
+ const locations = new Map<string, WebGLUniformLocation | null>();
+ const uniform = (name: string) => {
+ if (!locations.has(name))
+ locations.set(name, gl.getUniformLocation(program, name));
+ return locations.get(name) ?? null;
+ };
+ return {
+ uniform,
+ begin: (time: number) => {
+ gl.useProgram(program);
+ gl.viewport(0, 0, canvas.width, canvas.height);
+ gl.uniform2f(uniform("iResolution"), canvas.width, canvas.height);
+ gl.uniform1f(uniform("iTime"), time);
+ gl.uniform1f(uniform("uLightMode"), 0);
+ gl.uniform3f(uniform("uDarkBackground"), 9 / 255, 9 / 255, 9 / 255);
+ gl.uniform3f(uniform("uLightBackground"), 1, 1, 1);
+ gl.uniform1f(uniform("uPixelRatio"), 1);
+ },
+ };
+ };
+ const texture = () => {
+ const value = gl.createTexture();
+ if (!value)
+ throw new Error("Shader Text Reveal: texture allocation failed.");
+ textures.push(value);
+ gl.activeTexture(gl.TEXTURE0);
+ gl.bindTexture(gl.TEXTURE_2D, value);
+ gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);
+ gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);
+ gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
+ gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
+ return value;
+ };
+ const target = () => {
+ const value = texture();
+ const buffer = gl.createFramebuffer();
+ if (!buffer)
+ throw new Error("Shader Text Reveal: framebuffer allocation failed.");
+ buffers.push(buffer);
+ gl.bindFramebuffer(gl.FRAMEBUFFER, buffer);
+ gl.texImage2D(
+ gl.TEXTURE_2D,
+ 0,
+ gl.RGBA,
+ canvas.width,
+ canvas.height,
+ 0,
+ gl.RGBA,
+ gl.UNSIGNED_BYTE,
+ null,
+ );
+ gl.framebufferTexture2D(
+ gl.FRAMEBUFFER,
+ gl.COLOR_ATTACHMENT0,
+ gl.TEXTURE_2D,
+ value,
+ 0,
+ );
+ if (gl.checkFramebufferStatus(gl.FRAMEBUFFER) !== gl.FRAMEBUFFER_COMPLETE)
+ throw new Error("Shader Text Reveal: incomplete framebuffer.");
+ return { value, buffer };
+ };
+ const bind = (value: WebGLTexture, unit: number) => {
+ gl.activeTexture(gl.TEXTURE0 + unit);
+ gl.bindTexture(gl.TEXTURE_2D, value);
+ };
+ try {
+ const field = compile(HERO_FIELD);
+ const halftone = compile(HERO_HALFTONE);
+ const composite = compile(FRAGMENT);
+ const text = texture();
+ const raw = target();
+ const hero = target();
+ gl.bindFramebuffer(gl.FRAMEBUFFER, null);
+ gl.clearColor(0, 0, 0, 0);
+ gl.clear(gl.COLOR_BUFFER_BIT);
+ let previous: HTMLCanvasElement | null = null;
+ return {
+ dispose,
+ draw: (
+ word: TextTexture,
+ state: ReturnType<typeof getShaderTextState>,
+ time: number,
+ intensity: number,
+ ) => {
+ if (gl.isContextLost())
+ throw new Error("Shader Text Reveal: WebGL context lost.");
+ // Render the hero's original field, then its original halftone pass.
+ gl.bindFramebuffer(gl.FRAMEBUFFER, raw.buffer);
+ field.begin(time);
+ gl.drawArrays(gl.TRIANGLES, 0, 3);
+ gl.bindFramebuffer(gl.FRAMEBUFFER, hero.buffer);
+ halftone.begin(time);
+ bind(raw.value, 0);
+ gl.uniform1i(halftone.uniform("tScene"), 0);
+ gl.drawArrays(gl.TRIANGLES, 0, 3);
+
+ gl.bindFramebuffer(gl.FRAMEBUFFER, null);
+ composite.begin(time);
+ bind(text, 0);
+ if (previous !== word.canvas) {
+ gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, true);
+ gl.texImage2D(
+ gl.TEXTURE_2D,
+ 0,
+ gl.RGBA,
+ gl.RGBA,
+ gl.UNSIGNED_BYTE,
+ word.canvas,
+ );
+ gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, false);
+ previous = word.canvas;
+ }
+ bind(hero.value, 1);
+ gl.uniform1i(composite.uniform("uText"), 0);
+ gl.uniform1i(composite.uniform("uHero"), 1);
+ gl.uniform2f(
+ composite.uniform("uResolution"),
+ canvas.width,
+ canvas.height,
+ );
+ gl.uniform4f(composite.uniform("uBounds"), ...word.bounds);
+ gl.uniform1f(composite.uniform("uEnter"), state.enter);
+ gl.uniform1f(composite.uniform("uExit"), state.exit);
+ gl.uniform1f(composite.uniform("uScale"), state.scale);
+ gl.uniform1f(composite.uniform("uTime"), time);
+ gl.uniform1f(composite.uniform("uIntensity"), clamp(intensity));
+ gl.drawArrays(gl.TRIANGLES, 0, 3);
+ },
+ };
+ } catch (error) {
+ dispose();
+ throw error;
+ }
+}
+
+type TextTexture = {
+ canvas: HTMLCanvasElement;
+ bounds: [number, number, number, number];
+};
+
+function textTexture(
+ text: string,
+ width: number,
+ height: number,
+ fontSize: number,
+ fontWeight: number,
+ fontFamily: string,
+): TextTexture {
+ const canvas = document.createElement("canvas");
+ canvas.width = width;
+ canvas.height = height;
+ const ctx = canvas.getContext("2d");
+ if (!ctx) throw new Error("Shader Text Reveal: cannot rasterize text.");
+ let size = Math.min(Math.max(1, fontSize), height * 0.58);
+ ctx.font = `${fontWeight} ${size}px ${fontFamily}`;
+ size *= Math.min(
+ 1,
+ (width * 0.72) / Math.max(1, ctx.measureText(text).width),
+ );
+ ctx.font = `${fontWeight} ${size}px ${fontFamily}`;
+ const metrics = ctx.measureText(text);
+ const left = (width - metrics.width) / 2;
+ const ascent = metrics.actualBoundingBoxAscent;
+ const descent = metrics.actualBoundingBoxDescent;
+ const baseline = (height + ascent - descent) / 2;
+ ctx.fillStyle = "white";
+ ctx.fillText(text, left, baseline);
+ return {
+ canvas,
+ bounds: [
+ left / width,
+ (height - baseline - descent) / height,
+ Math.max(1, metrics.width) / width,
+ Math.max(1, ascent + descent) / height,
+ ],
+ };
+}
+
+export function ShaderTextReveal({
+ text = "Your product",
+ fontSize = 400,
+ fontFamily = "Arial, sans-serif",
+ fontWeight = 500,
+ wordDuration = 30,
+ intensity = 1,
+}: ShaderTextRevealProps) {
+ const frame = useCurrentFrame();
+ const { width, height, fps } = useVideoConfig();
+ const { delayRender, continueRender, cancelRender } = useDelayRender();
+ const canvas = useRef<HTMLCanvasElement>(null);
+ const resources = useRef<{
+ renderer: ReturnType<typeof createRenderer>;
+ words: TextTexture[];
+ } | null>(null);
+ const current = useRef({ frame, fps, wordDuration, intensity });
+ current.current = { frame, fps, wordDuration, intensity };
+
+ useLayoutEffect(() => {
+ const element = canvas.current;
+ if (!element) return;
+ let cancelled = false;
+ const handle = delayRender("Load Shader Text Reveal font");
+ const phrases = text.includes("\n") ? text.split("\n") : text.split(/\s+/);
+ const words = phrases.map((word) => word.trim()).filter(Boolean);
+ const draw = () => {
+ const resource = resources.current;
+ if (!resource || resource.words.length === 0) return;
+ const clock = current.current;
+ const state = getShaderTextState(
+ clock.frame,
+ resource.words.length,
+ clock.wordDuration,
+ );
+ resource.renderer.draw(
+ resource.words[state.index],
+ state,
+ clock.frame / clock.fps,
+ clock.intensity,
+ );
+ };
+ void document.fonts
+ .load(`${fontWeight} ${fontSize}px ${fontFamily}`, text || " ")
+ .then(() => {
+ if (cancelled) return;
+ const textures = words.map((word) =>
+ textTexture(word, width, height, fontSize, fontWeight, fontFamily),
+ );
+ const renderer = createRenderer(element);
+ resources.current = { renderer, words: textures };
+ draw();
+ continueRender(handle);
+ })
+ .catch((error: unknown) => {
+ if (!cancelled)
+ cancelRender(
+ error instanceof Error ? error : new Error(String(error)),
+ );
+ });
+ return () => {
+ cancelled = true;
+ continueRender(handle);
+ resources.current?.renderer.dispose();
+ resources.current = null;
+ };
+ }, [
+ text,
+ width,
+ height,
+ fontSize,
+ fontWeight,
+ fontFamily,
+ delayRender,
+ continueRender,
+ cancelRender,
+ ]);
+
+ useLayoutEffect(() => {
+ const resource = resources.current;
+ if (!resource || resource.words.length === 0) return;
+ try {
+ const state = getShaderTextState(
+ frame,
+ resource.words.length,
+ wordDuration,
+ );
+ resource.renderer.draw(
+ resource.words[state.index],
+ state,
+ frame / fps,
+ intensity,
+ );
+ } catch (error) {
+ cancelRender(error instanceof Error ? error : new Error(String(error)));
+ }
+ }, [frame, fps, wordDuration, intensity, cancelRender]);
+
+ return (
+ <canvas
+ ref={canvas}
+ width={width}
+ height={height}
+ role="img"
+ aria-label={text}
+ style={{
+ position: "absolute",
+ inset: 0,
+ width: "100%",
+ height: "100%",
+ pointerEvents: "none",
+ }}
+ />
+ );
+}
diff --git a/tsconfig.json b/tsconfig.json
index bfa00c06..4fee861a 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -138,6 +138,9 @@
"@/components/remocn/shader-grain-gradient": [
"./registry/remocn/shader-grain-gradient/index.tsx"
],
+ "@/components/remocn/shader-light-tunnel": [
+ "./registry/remocn/shader-light-tunnel/index.tsx"
+ ],
"@/components/remocn/shader-warp": [
"./registry/remocn/shader-warp/index.tsx"
],