Skip to content

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

feat: glitch

kapishdima764046ee8c24
diff --git a/components/docs/examples/sustained-glitch-example.tsx b/components/docs/examples/sustained-glitch-example.tsx
new file mode 100644
index 00000000..741b086e
--- /dev/null
+++ b/components/docs/examples/sustained-glitch-example.tsx
@@ -0,0 +1,45 @@
+"use client";
+
+import { CanvasSceneA } from "@/components/docs/examples/canvas-scenes";
+import { SustainedGlitch } from "@/registry/remocn/sustained-glitch";
+
+interface SustainedGlitchExampleProps {
+ intensity?: number;
+ frequency?: number;
+ slices?: number;
+ seed?: number;
+}
+
+export function SustainedGlitchExampleScene({
+ intensity,
+ frequency,
+ slices,
+ seed,
+}: SustainedGlitchExampleProps) {
+ return (
+ <SustainedGlitch
+ intensity={intensity}
+ frequency={frequency}
+ slices={slices}
+ seed={seed}
+ >
+ <CanvasSceneA />
+ </SustainedGlitch>
+ );
+}
+
+export const sustainedGlitchExampleCode = (
+ values: Record<string, unknown>,
+): string => {
+ const intensity = (values.intensity as number) ?? 1;
+ const frequency = (values.frequency as number) ?? 1;
+ const slices = (values.slices as number) ?? 24;
+ const seed = (values.seed as number) ?? 1;
+ return `import { SustainedGlitch } from "@/components/remocn/sustained-glitch";
+
+export const MyScene = () => (
+ <SustainedGlitch intensity={${intensity}} frequency={${frequency}} slices={${slices}} seed={${seed}}>
+ <Scene />
+ </SustainedGlitch>
+);`;
+};
diff --git a/content/changelog/2026-08-02-filters.mdx b/content/changelog/2026-08-02-filters.mdx
index 6723cdcb..49245db1 100644
--- a/content/changelog/2026-08-02-filters.mdx
+++ b/content/changelog/2026-08-02-filters.mdx
@@ -10,6 +10,7 @@ Canvas transitions gave the catalog effects that live at a cut. Filters are the
### New components
- [VHS Filter](/docs/filters/components/vhs-filter) — a scene held under analog tape. Colour bleeds sideways off every edge while brightness stays sharp, which is what separates tape from a blur; rows wander out of line on a slow drift with per-line jitter on top; the bottom of the frame tears where a real deck switches heads; luma noise and scanlines settle over all of it. Every knob is a plain number, so `intensity` can be interpolated to let a scene surface out of the wear.
+- [Sustained Glitch](/docs/filters/components/sustained-glitch) — broadcast corruption held over a scene as scheduled bursts rather than a constant texture. Slices tear sideways on their own beats, channels pull apart, and blocks fill with picture dragged in from elsewhere in the frame; a few frames later it has decayed and the scene is untouched again until the next hit. `intensity` is read every frame, so the damage can be interpolated onto a beat. It is the sustained sibling of `glitch-cut` — the same look, living between the cuts instead of at one.
- [CRT Screen](/docs/filters/components/crt-screen) — the scene put behind curved glass. The picture bulges outward so straight lines bow, an RGB phosphor mask breaks the colour into stripes, scanlines follow the curve instead of lying flat, bright areas flood the mask around them, and past the edge of the tube the corners fall away into real darkness rather than a hole. The pair splits cleanly: `vhs-filter` degrades the signal, `crt-screen` is the display it arrives on, and they stack.
### Improvements
diff --git a/content/docs/filters/components/meta.json b/content/docs/filters/components/meta.json
index cbaf789f..c3cc4bfc 100644
--- a/content/docs/filters/components/meta.json
+++ b/content/docs/filters/components/meta.json
@@ -1,5 +1,5 @@
{
"title": "Filters",
"collapsible": false,
- "pages": ["vhs-filter", "crt-screen"]
+ "pages": ["vhs-filter", "crt-screen", "sustained-glitch"]
}
diff --git a/content/docs/filters/components/sustained-glitch.mdx b/content/docs/filters/components/sustained-glitch.mdx
new file mode 100644
index 00000000..3fb81f94
--- /dev/null
+++ b/content/docs/filters/components/sustained-glitch.mdx
@@ -0,0 +1,135 @@
+---
+title: Sustained Glitch
+description: Hold a scene under scheduled bursts of broadcast corruption, resting clean in between
+component: sustained-glitch
+vibe: tech
+length: sustained
+useWhen:
+ - "A tech or developer-facing scene should feel unstable for its whole run without the corruption ever settling into a constant texture."
+ - "You want a recurring accent between cuts rather than an effect that lives at one — something breaks up every second or so and the frame recovers."
+ - "The scene is a screen recording, terminal, or dashboard where a signal fault is a believable thing to happen to it."
+avoidWhen:
+ - "The tearing should happen only at the cut between two scenes — use `glitch-cut`."
+ - "Only a headline should break up while the scene behind it stays intact — use `rgb-glitch-text`."
+ - "You want continuous analog wear rather than intermittent digital faults — use `vhs-filter`."
+---
+
+<ComponentPreview name="sustained-glitch" />
+
+<CanvasFilterNote />
+
+## Installation
+
+<InstallBlock name="sustained-glitch" />
+
+## Usage
+
+`SustainedGlitch` is a wrapper. Put a scene inside it and the frame stays clean
+until a burst fires: slices tear sideways on their own beats, the colour channels
+pull apart, and blocks fill with picture dragged in from somewhere else in the
+frame. The burst decays over a few frames and the scene goes back to untouched
+until the next one.
+
+This is the one filter in the pack that is not a steady texture. That is the
+point — a constant glitch stops reading as a fault and starts reading as a
+material.
+
+```tsx
+import { SustainedGlitch } from "@/components/remocn/sustained-glitch";
+
+export const MyScene = () => (
+ <SustainedGlitch>
+ <Scene />
+ </SustainedGlitch>
+);
+```
+
+## How the bursts are scheduled
+
+Time is cut into slots — one per second at `frequency={1}`, shorter as you raise
+it. Most slots fire a burst, at a position and length seeded inside the slot, and
+the whole schedule is a function of the frame number, so it is identical on every
+render.
+
+Two knobs shape it. `frequency` sets how often the frame can break; `intensity`
+scales how hard it breaks when it does, and at `0` nothing fires at all.
+
+## Landing a hit on a beat
+
+`intensity` is a plain number read every frame, so interpolate it. To put damage
+on a specific beat, raise `frequency` until bursts are effectively continuous and
+let the envelope decide when they are visible.
+
+```tsx
+import { interpolate, useCurrentFrame } from "remotion";
+import { SustainedGlitch } from "@/components/remocn/sustained-glitch";
+
+export const MyScene = () => {
+ const frame = useCurrentFrame();
+ const intensity = interpolate(
+ frame,
+ [40, 44, 52],
+ [0, 1.6, 0],
+ { extrapolateLeft: "clamp", extrapolateRight: "clamp" },
+ );
+
+ return (
+ <SustainedGlitch intensity={intensity} frequency={6}>
+ <Scene />
+ </SustainedGlitch>
+ );
+};
+```
+
+## Props
+
+<PropsTable
+ rows={[
+ {
+ name: "intensity",
+ type: "number",
+ default: "1",
+ description:
+ "How hard a burst hits. Read every frame, so it can be interpolated to script the damage. At 0 no burst is visible and the scene passes through untouched.",
+ },
+ {
+ name: "frequency",
+ type: "number",
+ default: "1",
+ description:
+ "How often the frame can break, in bursts per second at 30fps. Around 6 the slots are short enough that the tearing is effectively continuous, which is what you want when intensity is driving the timing instead.",
+ },
+ {
+ name: "slices",
+ type: "number",
+ default: "24",
+ description:
+ "How many horizontal slices the frame tears into. Low counts read as chunky tape damage, high counts as fine scanline tearing.",
+ },
+ {
+ name: "seed",
+ type: "number",
+ default: "1",
+ description:
+ "Shifts the whole schedule and the per-slice pattern. Change it when two scenes in one video should not break up in the same rhythm.",
+ },
+ {
+ name: "children",
+ type: "React.ReactNode",
+ description: "The scene the filter wraps and re-reads every frame.",
+ },
+ ]}
+/>
+
+## Notes
+
+Between bursts the filter writes the scene through unchanged, so a scene wrapped
+at `intensity={0}` costs a texture read and nothing else visually.
+
+The CSS fallback keeps the same shape — clean, then a burst of shifted bands, then
+clean — but its schedule is its own. If you have timed something against a
+specific burst in Chrome, check it once on the fallback path before shipping.
+
+The corrupted blocks pull picture from a displaced coordinate, which is why this
+needs the canvas: the block does not tint or mask what was already under it, it
+shows a piece of somewhere else in the frame.
diff --git a/content/docs/filters/components/vhs-filter.mdx b/content/docs/filters/components/vhs-filter.mdx
index 90355c53..e936bf96 100644
--- a/content/docs/filters/components/vhs-filter.mdx
+++ b/content/docs/filters/components/vhs-filter.mdx
@@ -12,6 +12,7 @@ avoidWhen:
- "The artifact should live only at the cut between two scenes — use `glitch-cut`."
- "Only a headline should break up while the scene behind it stays clean — use `rgb-glitch-text`."
- "The story is the display the scene sits on rather than the signal reaching it — use `crt-screen`."
+ - "You want intermittent digital faults rather than continuous analog wear — use `sustained-glitch`."
---
<ComponentPreview name="vhs-filter" />
diff --git a/registry-artifacts/registry.json b/registry-artifacts/registry.json
index e1047656..27053347 100644
--- a/registry-artifacts/registry.json
+++ b/registry-artifacts/registry.json
@@ -1674,6 +1674,21 @@
],
"type": "registry:component"
},
+ {
+ "name": "sustained-glitch",
+ "title": "Sustained Glitch",
+ "description": "Broadcast corruption held over a scene in scheduled bursts: slices tear sideways, channels split, and blocks fill with picture pulled from somewhere else — then the frame rests clean until the next hit.",
+ "dependencies": ["remotion"],
+ "registryDependencies": ["@remocn/canvas-presentation"],
+ "files": [
+ {
+ "path": "registry/remocn/sustained-glitch/index.tsx",
+ "type": "registry:component",
+ "target": "components/remocn/sustained-glitch.tsx"
+ }
+ ],
+ "type": "registry:component"
+ },
{
"name": "crt-screen",
"title": "CRT Screen",
diff --git a/registry-artifacts/sustained-glitch.json b/registry-artifacts/sustained-glitch.json
new file mode 100644
index 00000000..f7f2da37
--- /dev/null
+++ b/registry-artifacts/sustained-glitch.json
@@ -0,0 +1,17 @@
+{
+ "$schema": "https://ui.shadcn.com/schema/registry-item.json",
+ "name": "sustained-glitch",
+ "title": "Sustained Glitch",
+ "description": "Broadcast corruption held over a scene in scheduled bursts: slices tear sideways, channels split, and blocks fill with picture pulled from somewhere else — then the frame rests clean until the next hit.",
+ "dependencies": ["remotion"],
+ "registryDependencies": ["@remocn/canvas-presentation"],
+ "files": [
+ {
+ "path": "registry/remocn/sustained-glitch/index.tsx",
+ "content": "\"use client\";\n\nimport type React from \"react\";\nimport { AbsoluteFill, random, useCurrentFrame } from \"remotion\";\nimport {\n type CanvasFilterProps,\n makeCanvasFilter,\n makeFilterShader,\n} from \"@/lib/remocn/canvas-presentation\";\n\nexport type SustainedGlitchProps = {\n intensity?: number;\n frequency?: number;\n slices?: number;\n seed?: number;\n};\n\nconst DEFAULTS = {\n intensity: 1,\n frequency: 1,\n slices: 24,\n seed: 1,\n};\n\nconst FRAGMENT_SHADER = `#version 300 es\nprecision highp float;\n\nuniform sampler2D u_scene;\nuniform float u_frame;\nuniform float u_intensity;\nuniform float u_frequency;\nuniform float u_slices;\nuniform float u_seed;\n\nin vec2 v_uv;\nout vec4 outColor;\n\nconst float BLOCK_COLUMNS = 16.0;\n\nfloat hash(vec2 p) {\n return fract(sin(dot(p, vec2(127.1, 311.7))) * 43758.5453123);\n}\n\nvec4 sampleSplit(vec2 uv, float split) {\n vec4 center = texture(u_scene, uv);\n float r = texture(u_scene, fract(vec2(uv.x + split, uv.y))).r;\n float b = texture(u_scene, fract(vec2(uv.x - split, uv.y))).b;\n return vec4(r, center.g, b, center.a);\n}\n\nvoid main() {\n float slotLength = max(30.0 / max(u_frequency, 0.1), 4.0);\n float slot = floor(u_frame / slotLength);\n float local = u_frame - slot * slotLength;\n\n float burstLength = 2.0 + floor(hash(vec2(slot, u_seed + 2.0)) * 4.0);\n float start =\n floor(hash(vec2(slot, u_seed + 1.0)) * max(slotLength - burstLength, 1.0));\n float fires = step(0.25, hash(vec2(slot, u_seed + 3.0)));\n\n float age = local - start;\n float live = fires * step(0.0, age) * step(age, burstLength - 1.0);\n float energy =\n max(u_intensity, 0.0) * live * (1.0 - age / burstLength);\n\n if (energy <= 0.0) {\n outColor = texture(u_scene, v_uv);\n return;\n }\n\n float clock = mod(u_frame, 512.0) + u_seed;\n float row = floor(v_uv.y * max(u_slices, 2.0));\n float torn = step(0.45, hash(vec2(row, clock)));\n float amount = hash(vec2(row + 17.0, clock * 1.7 + 3.0)) - 0.5;\n float sliceShift = amount * 0.28 * energy * torn;\n\n vec2 block = vec2(floor(v_uv.x * BLOCK_COLUMNS), row);\n float corrupt = step(1.0 - 0.45 * min(energy, 1.0), hash(block + clock * 7.3));\n vec2 jump =\n vec2(\n hash(block + clock * 3.1 + 5.0) - 0.5,\n hash(block + clock * 9.7 + 11.0) - 0.5\n ) *\n vec2(0.62, 0.34) *\n corrupt;\n\n vec2 uv = fract(v_uv + vec2(sliceShift, 0.0) + jump);\n float split = 0.02 * energy * (0.35 + abs(amount));\n\n vec4 color = sampleSplit(uv, split);\n color.rgb +=\n vec3(0.05, 0.015, 0.09) *\n energy *\n torn *\n hash(vec2(row, clock + 41.0)) *\n color.a;\n\n outColor = vec4(clamp(color.rgb, 0.0, 1.0), color.a);\n}`;\n\nconst shader = makeFilterShader<SustainedGlitchProps>(\n FRAGMENT_SHADER,\n ({ gl, uniform, passedProps }) => {\n const {\n intensity = DEFAULTS.intensity,\n frequency = DEFAULTS.frequency,\n slices = DEFAULTS.slices,\n seed = DEFAULTS.seed,\n } = passedProps;\n gl.uniform1f(uniform(\"u_intensity\"), intensity);\n gl.uniform1f(uniform(\"u_frequency\"), frequency);\n gl.uniform1f(uniform(\"u_slices\"), slices);\n gl.uniform1f(uniform(\"u_seed\"), seed);\n },\n);\n\nfunction burstEnergy(\n frame: number,\n intensity: number,\n frequency: number,\n seed: number,\n): number {\n const slotLength = Math.max(30 / Math.max(frequency, 0.1), 4);\n const slot = Math.floor(frame / slotLength);\n const local = frame - slot * slotLength;\n\n const burstLength = 2 + Math.floor(random(`glitch-len-${seed}-${slot}`) * 4);\n const start = Math.floor(\n random(`glitch-start-${seed}-${slot}`) *\n Math.max(slotLength - burstLength, 1),\n );\n if (random(`glitch-fire-${seed}-${slot}`) < 0.25) return 0;\n\n const age = local - start;\n if (age < 0 || age > burstLength - 1) return 0;\n return Math.max(intensity, 0) * (1 - age / burstLength);\n}\n\nconst SustainedGlitchFallback: React.FC<\n SustainedGlitchProps & CanvasFilterProps\n> = ({\n children,\n intensity = DEFAULTS.intensity,\n frequency = DEFAULTS.frequency,\n slices = DEFAULTS.slices,\n seed = DEFAULTS.seed,\n}) => {\n const frame = useCurrentFrame();\n const energy = burstEnergy(frame, intensity, frequency, seed);\n\n if (energy <= 0) {\n return <AbsoluteFill>{children}</AbsoluteFill>;\n }\n\n const bands = Math.max(2, Math.min(6, Math.round(slices / 5)));\n const height = 100 / bands;\n\n return (\n <AbsoluteFill>\n {Array.from({ length: bands }, (_, band) => {\n const shift =\n (random(`glitch-shift-${seed}-${frame}-${band}`) - 0.5) * 46 * energy;\n const tint = band % 2 === 0 ? \"rgb(255, 42, 90)\" : \"rgb(0, 224, 255)\";\n return (\n <AbsoluteFill\n key={band}\n style={{\n clipPath: `inset(${band * height}% 0 ${100 - (band + 1) * height}% 0)`,\n transform: `translateX(${shift}px)`,\n }}\n >\n {children}\n <AbsoluteFill\n style={{\n background: tint,\n mixBlendMode: \"screen\",\n opacity:\n 0.18 *\n energy *\n random(`glitch-tint-${seed}-${frame}-${band}`),\n }}\n />\n </AbsoluteFill>\n );\n })}\n </AbsoluteFill>\n );\n};\n\nexport const SustainedGlitch = makeCanvasFilter<SustainedGlitchProps>({\n shader,\n fallback: SustainedGlitchFallback,\n});\n",
+ "type": "registry:component",
+ "target": "components/remocn/sustained-glitch.tsx"
+ }
+ ],
+ "type": "registry:component"
+}
diff --git a/registry/__index__.tsx b/registry/__index__.tsx
index 5f1c36c3..b233fcfd 100644
--- a/registry/__index__.tsx
+++ b/registry/__index__.tsx
@@ -104,6 +104,7 @@ import { springScaleInConfig } from "@/registry/remocn/spring-scale-in/config";
import { springSettleConfig } from "@/registry/remocn/spring-settle/config";
import { staggeredFadeUpConfig } from "@/registry/remocn/staggered-fade-up/config";
import { strikethroughReplaceConfig } from "@/registry/remocn/strikethrough-replace/config";
+import { sustainedGlitchConfig } from "@/registry/remocn/sustained-glitch/config";
import { swirlDissolveConfig } from "@/registry/remocn/swirl-dissolve/config";
import { terminalCursorZoomConfig } from "@/registry/remocn/terminal-cursor-zoom/config";
import { terminalSimulatorConfig } from "@/registry/remocn/terminal-simulator/config";
@@ -1473,6 +1474,13 @@ const registry: Record<string, RegistryEntry> = {
})),
config: crtScreenConfig,
},
+ "sustained-glitch": {
+ load: () =>
+ import("@/components/docs/examples/sustained-glitch-example").then(
+ (m) => ({ default: m.SustainedGlitchExampleScene }),
+ ),
+ config: sustainedGlitchConfig,
+ },
"slide-swap": {
load: () =>
import("@/components/docs/examples/slide-swap-example").then((m) => ({
diff --git a/registry/remocn/registry.json b/registry/remocn/registry.json
index 65afd5f3..21a6dd27 100644
--- a/registry/remocn/registry.json
+++ b/registry/remocn/registry.json
@@ -1674,6 +1674,21 @@
}
]
},
+ {
+ "name": "sustained-glitch",
+ "type": "registry:component",
+ "title": "Sustained Glitch",
+ "description": "Broadcast corruption held over a scene in scheduled bursts: slices tear sideways, channels split, and blocks fill with picture pulled from somewhere else — then the frame rests clean until the next hit.",
+ "dependencies": ["remotion"],
+ "registryDependencies": ["@remocn/canvas-presentation"],
+ "files": [
+ {
+ "path": "sustained-glitch/index.tsx",
+ "type": "registry:component",
+ "target": "components/remocn/sustained-glitch.tsx"
+ }
+ ]
+ },
{
"name": "crt-screen",
"type": "registry:component",
diff --git a/registry/remocn/sustained-glitch/config.ts b/registry/remocn/sustained-glitch/config.ts
new file mode 100644
index 00000000..8f9c0aaa
--- /dev/null
+++ b/registry/remocn/sustained-glitch/config.ts
@@ -0,0 +1,47 @@
+import { sustainedGlitchExampleCode } from "@/components/docs/examples/sustained-glitch-example";
+import { type ComponentConfig, FPS, H, W } from "@/lib/customizer-config";
+
+export const sustainedGlitchConfig: ComponentConfig = {
+ componentName: "SustainedGlitch",
+ importPath: "@/components/remocn/sustained-glitch",
+ controls: {
+ intensity: {
+ type: "number",
+ default: 1,
+ min: 0,
+ max: 2,
+ step: 0.05,
+ label: "Intensity",
+ },
+ frequency: {
+ type: "number",
+ default: 1,
+ min: 0.1,
+ max: 6,
+ step: 0.1,
+ label: "Frequency",
+ },
+ slices: {
+ type: "number",
+ default: 24,
+ min: 6,
+ max: 48,
+ step: 1,
+ label: "Slices",
+ },
+ seed: {
+ type: "number",
+ default: 1,
+ min: 1,
+ max: 20,
+ step: 1,
+ label: "Seed",
+ },
+ },
+ durationInFrames: 120,
+ fps: FPS,
+ compositionWidth: W,
+ compositionHeight: H,
+ previewBackdrop: { type: "color", value: "#0a0a0a" },
+ snippet: sustainedGlitchExampleCode,
+};
diff --git a/registry/remocn/sustained-glitch/index.tsx b/registry/remocn/sustained-glitch/index.tsx
new file mode 100644
index 00000000..70479a25
--- /dev/null
+++ b/registry/remocn/sustained-glitch/index.tsx
@@ -0,0 +1,193 @@
+"use client";
+
+import type React from "react";
+import { AbsoluteFill, random, useCurrentFrame } from "remotion";
+import {
+ type CanvasFilterProps,
+ makeCanvasFilter,
+ makeFilterShader,
+} from "@/lib/remocn/canvas-presentation";
+
+export type SustainedGlitchProps = {
+ intensity?: number;
+ frequency?: number;
+ slices?: number;
+ seed?: number;
+};
+
+const DEFAULTS = {
+ intensity: 1,
+ frequency: 1,
+ slices: 24,
+ seed: 1,
+};
+
+const FRAGMENT_SHADER = `#version 300 es
+precision highp float;
+
+uniform sampler2D u_scene;
+uniform float u_frame;
+uniform float u_intensity;
+uniform float u_frequency;
+uniform float u_slices;
+uniform float u_seed;
+
+in vec2 v_uv;
+out vec4 outColor;
+
+const float BLOCK_COLUMNS = 16.0;
+
+float hash(vec2 p) {
+ return fract(sin(dot(p, vec2(127.1, 311.7))) * 43758.5453123);
+}
+
+vec4 sampleSplit(vec2 uv, float split) {
+ vec4 center = texture(u_scene, uv);
+ float r = texture(u_scene, fract(vec2(uv.x + split, uv.y))).r;
+ float b = texture(u_scene, fract(vec2(uv.x - split, uv.y))).b;
+ return vec4(r, center.g, b, center.a);
+}
+
+void main() {
+ float slotLength = max(30.0 / max(u_frequency, 0.1), 4.0);
+ float slot = floor(u_frame / slotLength);
+ float local = u_frame - slot * slotLength;
+
+ float burstLength = 2.0 + floor(hash(vec2(slot, u_seed + 2.0)) * 4.0);
+ float start =
+ floor(hash(vec2(slot, u_seed + 1.0)) * max(slotLength - burstLength, 1.0));
+ float fires = step(0.25, hash(vec2(slot, u_seed + 3.0)));
+
+ float age = local - start;
+ float live = fires * step(0.0, age) * step(age, burstLength - 1.0);
+ float energy =
+ max(u_intensity, 0.0) * live * (1.0 - age / burstLength);
+
+ if (energy <= 0.0) {
+ outColor = texture(u_scene, v_uv);
+ return;
+ }
+
+ float clock = mod(u_frame, 512.0) + u_seed;
+ float row = floor(v_uv.y * max(u_slices, 2.0));
+ float torn = step(0.45, hash(vec2(row, clock)));
+ float amount = hash(vec2(row + 17.0, clock * 1.7 + 3.0)) - 0.5;
+ float sliceShift = amount * 0.28 * energy * torn;
+
+ vec2 block = vec2(floor(v_uv.x * BLOCK_COLUMNS), row);
+ float corrupt = step(1.0 - 0.45 * min(energy, 1.0), hash(block + clock * 7.3));
+ vec2 jump =
+ vec2(
+ hash(block + clock * 3.1 + 5.0) - 0.5,
+ hash(block + clock * 9.7 + 11.0) - 0.5
+ ) *
+ vec2(0.62, 0.34) *
+ corrupt;
+
+ vec2 uv = fract(v_uv + vec2(sliceShift, 0.0) + jump);
+ float split = 0.02 * energy * (0.35 + abs(amount));
+
+ vec4 color = sampleSplit(uv, split);
+ color.rgb +=
+ vec3(0.05, 0.015, 0.09) *
+ energy *
+ torn *
+ hash(vec2(row, clock + 41.0)) *
+ color.a;
+
+ outColor = vec4(clamp(color.rgb, 0.0, 1.0), color.a);
+}`;
+
+const shader = makeFilterShader<SustainedGlitchProps>(
+ FRAGMENT_SHADER,
+ ({ gl, uniform, passedProps }) => {
+ const {
+ intensity = DEFAULTS.intensity,
+ frequency = DEFAULTS.frequency,
+ slices = DEFAULTS.slices,
+ seed = DEFAULTS.seed,
+ } = passedProps;
+ gl.uniform1f(uniform("u_intensity"), intensity);
+ gl.uniform1f(uniform("u_frequency"), frequency);
+ gl.uniform1f(uniform("u_slices"), slices);
+ gl.uniform1f(uniform("u_seed"), seed);
+ },
+);
+
+function burstEnergy(
+ frame: number,
+ intensity: number,
+ frequency: number,
+ seed: number,
+): number {
+ const slotLength = Math.max(30 / Math.max(frequency, 0.1), 4);
+ const slot = Math.floor(frame / slotLength);
+ const local = frame - slot * slotLength;
+
+ const burstLength = 2 + Math.floor(random(`glitch-len-${seed}-${slot}`) * 4);
+ const start = Math.floor(
+ random(`glitch-start-${seed}-${slot}`) *
+ Math.max(slotLength - burstLength, 1),
+ );
+ if (random(`glitch-fire-${seed}-${slot}`) < 0.25) return 0;
+
+ const age = local - start;
+ if (age < 0 || age > burstLength - 1) return 0;
+ return Math.max(intensity, 0) * (1 - age / burstLength);
+}
+
+const SustainedGlitchFallback: React.FC<
+ SustainedGlitchProps & CanvasFilterProps
+> = ({
+ children,
+ intensity = DEFAULTS.intensity,
+ frequency = DEFAULTS.frequency,
+ slices = DEFAULTS.slices,
+ seed = DEFAULTS.seed,
+}) => {
+ const frame = useCurrentFrame();
+ const energy = burstEnergy(frame, intensity, frequency, seed);
+
+ if (energy <= 0) {
+ return <AbsoluteFill>{children}</AbsoluteFill>;
+ }
+
+ const bands = Math.max(2, Math.min(6, Math.round(slices / 5)));
+ const height = 100 / bands;
+
+ return (
+ <AbsoluteFill>
+ {Array.from({ length: bands }, (_, band) => {
+ const shift =
+ (random(`glitch-shift-${seed}-${frame}-${band}`) - 0.5) * 46 * energy;
+ const tint = band % 2 === 0 ? "rgb(255, 42, 90)" : "rgb(0, 224, 255)";
+ return (
+ <AbsoluteFill
+ key={band}
+ style={{
+ clipPath: `inset(${band * height}% 0 ${100 - (band + 1) * height}% 0)`,
+ transform: `translateX(${shift}px)`,
+ }}
+ >
+ {children}
+ <AbsoluteFill
+ style={{
+ background: tint,
+ mixBlendMode: "screen",
+ opacity:
+ 0.18 *
+ energy *
+ random(`glitch-tint-${seed}-${frame}-${band}`),
+ }}
+ />
+ </AbsoluteFill>
+ );
+ })}
+ </AbsoluteFill>
+ );
+};
+
+export const SustainedGlitch = makeCanvasFilter<SustainedGlitchProps>({
+ shader,
+ fallback: SustainedGlitchFallback,
+});
diff --git a/src/remotion/canvas-spike-root.tsx b/src/remotion/canvas-spike-root.tsx
index 728456e8..06ff1049 100644
--- a/src/remotion/canvas-spike-root.tsx
+++ b/src/remotion/canvas-spike-root.tsx
@@ -12,6 +12,7 @@ import { EmberBurnExampleScene } from "@/components/docs/examples/ember-burn-exa
import { GlitchCutExampleScene } from "@/components/docs/examples/glitch-cut-example";
import { GridWaveExampleScene } from "@/components/docs/examples/grid-wave-example";
import { ParticleDissolveExampleScene } from "@/components/docs/examples/particle-dissolve-example";
+import { SustainedGlitchExampleScene } from "@/components/docs/examples/sustained-glitch-example";
import { VhsFilterExampleScene } from "@/components/docs/examples/vhs-filter-example";
import type { ComponentConfig } from "@/lib/customizer-config";
import { crtScreenConfig } from "@/registry/remocn/crt-screen/config";
@@ -20,6 +21,7 @@ import { emberBurnConfig } from "@/registry/remocn/ember-burn/config";
import { glitchCutConfig } from "@/registry/remocn/glitch-cut/config";
import { gridWaveConfig } from "@/registry/remocn/grid-wave/config";
import { particleDissolveConfig } from "@/registry/remocn/particle-dissolve/config";
+import { sustainedGlitchConfig } from "@/registry/remocn/sustained-glitch/config";
import { vhsFilterConfig } from "@/registry/remocn/vhs-filter/config";
const { fontFamily: GEIST } = loadFont();
@@ -48,6 +50,10 @@ const SCENES: Record<
},
"vhs-filter": { Scene: VhsFilterExampleScene, config: vhsFilterConfig },
"crt-screen": { Scene: CrtScreenExampleScene, config: crtScreenConfig },
+ "sustained-glitch": {
+ Scene: SustainedGlitchExampleScene,
+ config: sustainedGlitchConfig,
+ },
};
function makeStage(Scene: ComponentType) {