Skip to content

🎥 Make videos programmatically with React

`@remotion/effects`: Add venetian blinds effect (#8728)

Jonny Burger177ae207f85e
diff --git a/packages/docs/components/effects-demos/registry.ts b/packages/docs/components/effects-demos/registry.ts
index a9fa0174c9..f2a01b4207 100644
--- a/packages/docs/components/effects-demos/registry.ts
+++ b/packages/docs/components/effects-demos/registry.ts
@@ -44,6 +44,7 @@ import {thermalVision} from '@remotion/effects/thermal-vision';
import {tint} from '@remotion/effects/tint';
import {uvTranslate, xyTranslate} from '@remotion/effects/translate';
import {tvSignalOff} from '@remotion/effects/tv-signal-off';
+import {venetianBlinds} from '@remotion/effects/venetian-blinds';
import {vignette} from '@remotion/effects/vignette';
import {wave} from '@remotion/effects/wave';
import {waves} from '@remotion/effects/waves';
@@ -119,6 +120,7 @@ import {
EffectsXyTranslatePreview,
} from '../effects/effects-translate-preview';
import {EffectsTvSignalOffPreview} from '../effects/effects-tv-signal-off-preview';
+import {EffectsVenetianBlindsPreview} from '../effects/effects-venetian-blinds-preview';
import {EffectsVignettePreview} from '../effects/effects-vignette-preview';
import {EffectsWavePreview} from '../effects/effects-wave-preview';
import {EffectsWavesPreview} from '../effects/effects-waves-preview';
@@ -208,6 +210,14 @@ export const effectsDemos: EffectsDemoType[] = [
comp: EffectsEvolvePreview,
schema: evolve().definition.schema,
},
+ {
+ ...defaults,
+ id: 'effects-venetian-blinds',
+ effectName: 'venetianBlinds',
+ effectImportPath: '@remotion/effects/venetian-blinds',
+ comp: EffectsVenetianBlindsPreview,
+ schema: venetianBlinds().definition.schema,
+ },
{
...defaults,
id: 'effects-drop-shadow',
diff --git a/packages/docs/components/effects/effects-venetian-blinds-preview.tsx b/packages/docs/components/effects/effects-venetian-blinds-preview.tsx
new file mode 100644
index 0000000000..848a53fb14
--- /dev/null
+++ b/packages/docs/components/effects/effects-venetian-blinds-preview.tsx
@@ -0,0 +1,20 @@
+import {venetianBlinds} from '@remotion/effects/venetian-blinds';
+import React from 'react';
+import {CanvasImage} from 'remotion';
+import {EFFECTS_PREVIEW_IMAGE_SRC} from './effects-preview-image';
+
+export const EffectsVenetianBlindsPreview: React.FC<{
+ readonly progress: number;
+ readonly direction: 'vertical' | 'horizontal';
+ readonly slats: number;
+}> = ({progress, direction, slats}) => {
+ return (
+ <CanvasImage
+ src={EFFECTS_PREVIEW_IMAGE_SRC}
+ width={1280}
+ height={720}
+ fit="cover"
+ effects={[venetianBlinds({progress, direction, slats})]}
+ />
+ );
+};
diff --git a/packages/docs/docs/effects/venetian-blinds.mdx b/packages/docs/docs/effects/venetian-blinds.mdx
new file mode 100644
index 0000000000..ac5f792628
--- /dev/null
+++ b/packages/docs/docs/effects/venetian-blinds.mdx
@@ -0,0 +1,83 @@
+---
+image: /generated/articles-docs-effects-venetian-blinds.png
+slug: /effects/venetian-blinds
+title: venetianBlinds()
+sidebar_label: venetianBlinds()
+crumb: '@remotion/effects'
+---
+
+# venetianBlinds()<AvailableFrom v="4.0.485" />
+
+_Part of the [`@remotion/effects`](/docs/effects/api) package._
+
+Reveals a canvas-based component through vertical or horizontal blinds.
+
+Use it for slatted wipes, intro animations, and outro animations on [`<Video>`](/docs/media/video), [`<HtmlInCanvas>`](/docs/remotion/html-in-canvas) and [`<Solid>`](/docs/solid).
+
+## Preview
+
+<EffectsDemo type="effects-venetian-blinds" />
+
+## Example
+
+```tsx twoslash title="MyComp.tsx"
+import {AbsoluteFill, interpolate, useCurrentFrame} from 'remotion';
+import {Video} from '@remotion/media';
+import {venetianBlinds} from '@remotion/effects/venetian-blinds';
+
+export const MyComp: React.FC = () => {
+ const frame = useCurrentFrame();
+ const progress = interpolate(frame, [0, 45], [0, 1], {
+ extrapolateLeft: 'clamp',
+ extrapolateRight: 'clamp',
+ });
+
+ return (
+ <AbsoluteFill>
+ <Video
+ src="https://remotion.media/video.mp4"
+ effects={[
+ venetianBlinds({
+ progress,
+ direction: 'vertical',
+ slats: 14,
+ }),
+ ]}
+ />
+ </AbsoluteFill>
+ );
+};
+```
+
+## API
+
+Pass an object with the following properties. You can also call `venetianBlinds()` without arguments.
+
+### `progress?`
+
+Reveal progress from `0` (fully hidden) to `1` (fully revealed). Defaults to `0.5`.
+
+### `direction?`
+
+Orientation of the blinds. Defaults to `vertical`.
+
+Possible values: `vertical`, `horizontal`.
+
+### `slats?`
+
+Number of blinds across the source. Must be a positive integer. Defaults to `12`.
+
+### `disabled?`
+
+When `true`, the effect is skipped. Defaults to `false`.
+
+## Requirements
+
+`venetianBlinds()` uses a WebGL2 backend. During renders, enable WebGL via [`Config.setChromiumOpenGlRenderer('angle')`](/docs/config#setchromiumopenglrenderer). See [Using WebGL during renders](/docs/remotion/html-in-canvas#using-webgl-during-renders).
+
+## See also
+
+- [`@remotion/effects`](/docs/effects/api)
+- [`evolve()`](/docs/effects/evolve)
+- [HTML-in-canvas guide](/docs/html-in-canvas)
+- [Source code for this effect](https://github.com/remotion-dev/remotion/blob/main/packages/effects/src/venetian-blinds.ts)
diff --git a/packages/docs/sidebars.ts b/packages/docs/sidebars.ts
index 81b224baed..80f2316519 100644
--- a/packages/docs/sidebars.ts
+++ b/packages/docs/sidebars.ts
@@ -319,6 +319,7 @@ const sidebars: SidebarsConfig = {
'effects/tint',
'effects/tv-signal-off',
'effects/uv-translate',
+ 'effects/venetian-blinds',
'effects/vignette',
'effects/wave',
'effects/waves',
diff --git a/packages/docs/src/data/articles.ts b/packages/docs/src/data/articles.ts
index f7cabb47a5..496a0a8ed3 100644
--- a/packages/docs/src/data/articles.ts
+++ b/packages/docs/src/data/articles.ts
@@ -2159,6 +2159,15 @@ export const articles = [
noAi: false,
slug: 'effects/uv-translate',
},
+ {
+ id: 'effects/venetian-blinds',
+ title: 'venetianBlinds()',
+ relativePath: 'docs/effects/venetian-blinds.mdx',
+ compId: 'articles-docs-effects-venetian-blinds',
+ crumb: '@remotion/effects',
+ noAi: false,
+ slug: 'effects/venetian-blinds',
+ },
{
id: 'effects/vignette',
title: 'vignette()',
diff --git a/packages/docs/src/remotion/Root.tsx b/packages/docs/src/remotion/Root.tsx
index 51a2c78649..8e8d00ea94 100644
--- a/packages/docs/src/remotion/Root.tsx
+++ b/packages/docs/src/remotion/Root.tsx
@@ -67,6 +67,7 @@ import {
EffectsXyTranslatePreview,
} from '../../components/effects/effects-translate-preview';
import {EffectsTvSignalOffPreview} from '../../components/effects/effects-tv-signal-off-preview';
+import {EffectsVenetianBlindsPreview} from '../../components/effects/effects-venetian-blinds-preview';
import {EffectsVignettePreview} from '../../components/effects/effects-vignette-preview';
import {EffectsWavePreview} from '../../components/effects/effects-wave-preview';
import {EffectsWavesPreview} from '../../components/effects/effects-waves-preview';
@@ -219,6 +220,17 @@ export const RemotionRoot: React.FC = () => {
feather: 0.18,
}}
/>
+ <Still
+ id="effects-venetian-blinds-preview"
+ component={EffectsVenetianBlindsPreview}
+ width={1280}
+ height={720}
+ defaultProps={{
+ progress: 0.58,
+ direction: 'vertical',
+ slats: 14,
+ }}
+ />
<Still
id="effects-drop-shadow-preview"
component={EffectsDropShadowPreview}
diff --git a/packages/docs/static/generated/articles-docs-effects-venetian-blinds.png b/packages/docs/static/generated/articles-docs-effects-venetian-blinds.png
new file mode 100644
index 0000000000..858861f172
Binary files /dev/null and b/packages/docs/static/generated/articles-docs-effects-venetian-blinds.png differ
diff --git a/packages/docs/static/img/effects-venetian-blinds-preview.png b/packages/docs/static/img/effects-venetian-blinds-preview.png
new file mode 100644
index 0000000000..c9e8656c77
Binary files /dev/null and b/packages/docs/static/img/effects-venetian-blinds-preview.png differ
diff --git a/packages/effects/bundle.ts b/packages/effects/bundle.ts
index 1284381fd3..ff029d655b 100644
--- a/packages/effects/bundle.ts
+++ b/packages/effects/bundle.ts
@@ -53,6 +53,7 @@ const effectEntrypoints = [
'src/tint.ts',
'src/translate.ts',
'src/tv-signal-off.ts',
+ 'src/venetian-blinds.ts',
'src/vignette.ts',
'src/wave.ts',
'src/waves.ts',
diff --git a/packages/effects/package.json b/packages/effects/package.json
index b6612181d9..b098ee9fb0 100644
--- a/packages/effects/package.json
+++ b/packages/effects/package.json
@@ -264,6 +264,11 @@
"module": "./dist/esm/tv-signal-off.mjs",
"import": "./dist/esm/tv-signal-off.mjs"
},
+ "./venetian-blinds": {
+ "types": "./dist/venetian-blinds.d.ts",
+ "module": "./dist/esm/venetian-blinds.mjs",
+ "import": "./dist/esm/venetian-blinds.mjs"
+ },
"./vignette": {
"types": "./dist/vignette.d.ts",
"module": "./dist/esm/vignette.mjs",
@@ -436,6 +441,9 @@
"tv-signal-off": [
"dist/tv-signal-off.d.ts"
],
+ "venetian-blinds": [
+ "dist/venetian-blinds.d.ts"
+ ],
"vignette": [
"dist/vignette.d.ts"
],
diff --git a/packages/effects/src/test/effect-params.test.ts b/packages/effects/src/test/effect-params.test.ts
index 31dc43e3e3..36bb4575e4 100644
--- a/packages/effects/src/test/effect-params.test.ts
+++ b/packages/effects/src/test/effect-params.test.ts
@@ -49,6 +49,7 @@ import {tint} from '../tint.js';
import {uvTranslate, xyTranslate} from '../translate.js';
import {tvSignalOff} from '../tv-signal-off.js';
import {publicUvToShaderUv} from '../uv-coordinate.js';
+import {venetianBlinds} from '../venetian-blinds.js';
import {vignette} from '../vignette.js';
import {wave} from '../wave/index.js';
import {waves} from '../waves.js';
@@ -211,6 +212,9 @@ test('@remotion/effects expose documentation links', () => {
expect(tvSignalOff().definition.documentationLink).toBe(
'https://www.remotion.dev/docs/effects/tv-signal-off',
);
+ expect(venetianBlinds().definition.documentationLink).toBe(
+ 'https://www.remotion.dev/docs/effects/venetian-blinds',
+ );
expect(uvTranslate().definition.documentationLink).toBe(
'https://www.remotion.dev/docs/effects/uv-translate',
);
@@ -290,6 +294,7 @@ test('@remotion/effects expose API names as Studio labels', () => {
expect(thermalVision().definition.label).toBe('thermalVision()');
expect(tint({color: '#fff'}).definition.label).toBe('tint()');
expect(tvSignalOff().definition.label).toBe('tvSignalOff()');
+ expect(venetianBlinds().definition.label).toBe('venetianBlinds()');
expect(uvTranslate().definition.label).toBe('uvTranslate()');
expect(vignette().definition.label).toBe('vignette()');
expect(xyTranslate().definition.label).toBe('xyTranslate()');
@@ -1079,6 +1084,82 @@ test('evolve() parameters produce distinct effect keys', () => {
).toBe(4);
});
+test('venetianBlinds() accepts default params', () => {
+ expect(() => venetianBlinds()).not.toThrow();
+});
+
+test('venetianBlinds() rejects non-finite progress', () => {
+ expect(() => venetianBlinds({progress: Number.NaN})).toThrow(
+ '"progress" must be a finite number',
+ );
+});
+
+test('venetianBlinds() rejects progress below range', () => {
+ expect(() => venetianBlinds({progress: -0.1})).toThrow(
+ '"progress" must be >= 0',
+ );
+});
+
+test('venetianBlinds() rejects progress above range', () => {
+ expect(() => venetianBlinds({progress: 1.1})).toThrow(
+ '"progress" must be <= 1',
+ );
+});
+
+test('venetianBlinds() rejects direction outside the enum', () => {
+ expect(() => venetianBlinds({direction: 'diagonal' as 'vertical'})).toThrow(
+ '"direction" must be "vertical" or "horizontal", but got "diagonal"',
+ );
+});
+
+test('venetianBlinds() rejects non-finite slats', () => {
+ expect(() => venetianBlinds({slats: Number.NaN})).toThrow(
+ '"slats" must be a finite number',
+ );
+});
+
+test('venetianBlinds() rejects fractional slats', () => {
+ expect(() => venetianBlinds({slats: 6.5})).toThrow(
+ '"slats" must be an integer',
+ );
+});
+
+test('venetianBlinds() rejects non-positive slats', () => {
+ expect(() => venetianBlinds({slats: 0})).toThrow('"slats" must be >= 1');
+});
+
+test('venetianBlinds() parameters produce distinct effect keys', () => {
+ const full = venetianBlinds({
+ progress: 1,
+ direction: 'vertical',
+ slats: 12,
+ });
+ const half = venetianBlinds({
+ progress: 0.5,
+ direction: 'vertical',
+ slats: 12,
+ });
+ const otherDirection = venetianBlinds({
+ progress: 0.5,
+ direction: 'horizontal',
+ slats: 12,
+ });
+ const otherSlats = venetianBlinds({
+ progress: 0.5,
+ direction: 'horizontal',
+ slats: 18,
+ });
+
+ expect(
+ new Set([
+ full.effectKey,
+ half.effectKey,
+ otherDirection.effectKey,
+ otherSlats.effectKey,
+ ]).size,
+ ).toBe(4);
+});
+
test('dropShadow() accepts default params', () => {
expect(() => dropShadow()).not.toThrow();
});
diff --git a/packages/effects/src/venetian-blinds.ts b/packages/effects/src/venetian-blinds.ts
new file mode 100644
index 0000000000..f12fed323a
--- /dev/null
+++ b/packages/effects/src/venetian-blinds.ts
@@ -0,0 +1,376 @@
+import type {InteractivitySchema} from 'remotion';
+import {Internals} from 'remotion';
+import {
+ assertOptionalFiniteNumber,
+ validateUnitInterval,
+} from './color-utils.js';
+import {assertEffectParamsObject} from './validate-effect-param.js';
+
+const {createEffect, createWebGL2ContextError} = Internals;
+
+const VENETIAN_BLINDS_DIRECTIONS = ['vertical', 'horizontal'] as const;
+
+const DEFAULT_PROGRESS = 0.5 as const;
+const DEFAULT_DIRECTION = 'vertical' as const;
+const DEFAULT_SLATS = 12 as const;
+
+export type VenetianBlindsDirection =
+ (typeof VENETIAN_BLINDS_DIRECTIONS)[number];
+
+export const venetianBlindsSchema = {
+ progress: {
+ type: 'number',
+ min: 0,
+ max: 1,
+ step: 0.01,
+ default: DEFAULT_PROGRESS,
+ description: 'Progress',
+ hiddenFromList: false,
+ },
+ direction: {
+ type: 'enum',
+ variants: {
+ vertical: {},
+ horizontal: {},
+ },
+ default: DEFAULT_DIRECTION,
+ description: 'Direction',
+ },
+ slats: {
+ type: 'number',
+ min: 1,
+ max: 100,
+ step: 1,
+ default: DEFAULT_SLATS,
+ description: 'Slats',
+ hiddenFromList: false,
+ },
+} as const satisfies InteractivitySchema;
+
+export type VenetianBlindsParams = {
+ /** Reveal progress from `0` (hidden) to `1` (fully revealed). Defaults to `0.5`. */
+ readonly progress?: number;
+ /** Slat orientation. Defaults to `vertical`. */
+ readonly direction?: VenetianBlindsDirection;
+ /** Number of blinds across the source. Defaults to `12`. */
+ readonly slats?: number;
+};
+
+type VenetianBlindsResolved = {
+ readonly progress: number;
+ readonly direction: VenetianBlindsDirection;
+ readonly slats: number;
+};
+
+const formatEnum = (variants: readonly string[]): string => {
+ if (variants.length === 2) {
+ return `"${variants[0]}" or "${variants[1]}"`;
+ }
+
+ return `${variants
+ .slice(0, -1)
+ .map((variant) => `"${variant}"`)
+ .join(', ')} or "${variants[variants.length - 1]}"`;
+};
+
+const assertOptionalEnum = <T extends string>(
+ value: unknown,
+ name: string,
+ variants: readonly T[],
+): void => {
+ if (value === undefined) {
+ return;
+ }
+
+ if (!variants.includes(value as T)) {
+ throw new TypeError(
+ `"${name}" must be ${formatEnum(variants)}, but got ${JSON.stringify(value)}`,
+ );
+ }
+};
+
+const resolve = (p: VenetianBlindsParams): VenetianBlindsResolved => ({
+ progress: p.progress ?? DEFAULT_PROGRESS,
+ direction: p.direction ?? DEFAULT_DIRECTION,
+ slats: p.slats ?? DEFAULT_SLATS,
+});
+
+const validatePositiveInteger = (value: number, name: string): void => {
+ if (!Number.isInteger(value)) {
+ throw new TypeError(
+ `"${name}" must be an integer, but got ${JSON.stringify(value)}`,
+ );
+ }
+
+ if (value < 1) {
+ throw new TypeError(
+ `"${name}" must be >= 1, but got ${JSON.stringify(value)}`,
+ );
+ }
+};
+
+const validateVenetianBlindsParams = (params: VenetianBlindsParams): void => {
+ assertEffectParamsObject(params, 'Venetian blinds');
+ assertOptionalFiniteNumber(params.progress, 'progress');
+ assertOptionalFiniteNumber(params.slats, 'slats');
+ assertOptionalEnum(params.direction, 'direction', VENETIAN_BLINDS_DIRECTIONS);
+
+ const r = resolve(params);
+ validateUnitInterval(r.progress, 'progress');
+ validatePositiveInteger(r.slats, 'slats');
+};
+
+type VenetianBlindsState = {
+ readonly gl: WebGL2RenderingContext;
+ readonly program: WebGLProgram;
+ readonly vao: WebGLVertexArrayObject;
+ readonly vbo: WebGLBuffer;
+ readonly texture: WebGLTexture;
+ readonly uniforms: {
+ readonly uSource: WebGLUniformLocation | null;
+ readonly uProgress: WebGLUniformLocation | null;
+ readonly uDirection: WebGLUniformLocation | null;
+ readonly uSlats: WebGLUniformLocation | null;
+ };
+};
+
+const VENETIAN_BLINDS_VS = /* glsl */ `#version 300 es
+in vec2 aPos;
+in vec2 aUv;
+out vec2 vUv;
+
+void main() {
+ vUv = aUv;
+ gl_Position = vec4(aPos, 0.0, 1.0);
+}
+`;
+
+const VENETIAN_BLINDS_FS = /* glsl */ `#version 300 es
+precision highp float;
+
+in vec2 vUv;
+out vec4 fragColor;
+
+uniform sampler2D uSource;
+uniform float uProgress;
+uniform int uDirection;
+uniform float uSlats;
+
+float maskValue(float distanceToCenter, float progress) {
+ float p = clamp(progress, 0.0, 1.0);
+
+ if (p <= 0.000001) {
+ return 0.0;
+ }
+
+ if (p >= 0.999999) {
+ return 1.0;
+ }
+
+ return step(distanceToCenter, p);
+}
+
+void main() {
+ vec4 source = texture(uSource, vUv);
+ float axis = uDirection == 0 ? vUv.x : vUv.y;
+ float local = fract(axis * max(uSlats, 1.0));
+ float distanceToCenter = abs(local - 0.5) * 2.0;
+ float mask = maskValue(distanceToCenter, uProgress);
+
+ fragColor = vec4(source.rgb * mask, source.a * mask);
+}
+`;
+
+const compileShader = (
+ gl: WebGL2RenderingContext,
+ type: number,
+ source: string,
+): WebGLShader => {
+ const shader = gl.createShader(type);
+ if (!shader) {
+ throw new Error('Failed to create WebGL shader');
+ }
+
+ gl.shaderSource(shader, source);
+ gl.compileShader(shader);
+ if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) {
+ const log = gl.getShaderInfoLog(shader);
+ gl.deleteShader(shader);
+ throw new Error(
+ `Venetian blinds shader compile failed: ${log ?? '(no log)'}`,
+ );
+ }
+
+ return shader;
+};
+
+const linkProgram = (
+ gl: WebGL2RenderingContext,
+ vs: WebGLShader,
+ fs: WebGLShader,
+): WebGLProgram => {
+ const program = gl.createProgram();
+ if (!program) {
+ throw new Error('Failed to create WebGL program');
+ }
+
+ gl.attachShader(program, vs);
+ gl.attachShader(program, fs);
+ gl.linkProgram(program);
+ if (!gl.getProgramParameter(program, gl.LINK_STATUS)) {
+ const log = gl.getProgramInfoLog(program);
+ gl.deleteProgram(program);
+ throw new Error(
+ `Venetian blinds program link failed: ${log ?? '(no log)'}`,
+ );
+ }
+
+ return program;
+};
+
+const setupVenetianBlinds = (
+ target: HTMLCanvasElement,
+): VenetianBlindsState => {
+ const gl = target.getContext('webgl2', {
+ premultipliedAlpha: true,
+ alpha: true,
+ preserveDrawingBuffer: true,
+ });
+
+ if (!gl) {
+ throw createWebGL2ContextError('venetian blinds effect');
+ }
+
+ gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, true);
+
+ const vs = compileShader(gl, gl.VERTEX_SHADER, VENETIAN_BLINDS_VS);
+ const fs = compileShader(gl, gl.FRAGMENT_SHADER, VENETIAN_BLINDS_FS);
+ const program = linkProgram(gl, vs, fs);
+ gl.deleteShader(vs);
+ gl.deleteShader(fs);
+
+ const vao = gl.createVertexArray();
+ if (!vao) {
+ throw new Error('Failed to create WebGL vertex array');
+ }
+
+ gl.bindVertexArray(vao);
+
+ const data = new Float32Array([
+ -1, -1, 0, 0, 1, -1, 1, 0, -1, 1, 0, 1, 1, 1, 1, 1,
+ ]);
+
+ const vbo = gl.createBuffer();
+ if (!vbo) {
+ throw new Error('Failed to create WebGL buffer');
+ }
+
+ gl.bindBuffer(gl.ARRAY_BUFFER, vbo);
+ gl.bufferData(gl.ARRAY_BUFFER, data, gl.STATIC_DRAW);
+
+ const aPos = gl.getAttribLocation(program, 'aPos');
+ const aUv = gl.getAttribLocation(program, 'aUv');
+ gl.enableVertexAttribArray(aPos);
+ gl.vertexAttribPointer(aPos, 2, gl.FLOAT, false, 16, 0);
+ gl.enableVertexAttribArray(aUv);
+ gl.vertexAttribPointer(aUv, 2, gl.FLOAT, false, 16, 8);
+
+ gl.bindVertexArray(null);
+
+ const texture = gl.createTexture();
+ if (!texture) {
+ throw new Error('Failed to create WebGL texture');
+ }
+
+ 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);
+ gl.bindTexture(gl.TEXTURE_2D, null);
+
+ return {
+ gl,
+ program,
+ vao,
+ vbo,
+ texture,
+ uniforms: {
+ uSource: gl.getUniformLocation(program, 'uSource'),
+ uProgress: gl.getUniformLocation(program, 'uProgress'),
+ uDirection: gl.getUniformLocation(program, 'uDirection'),
+ uSlats: gl.getUniformLocation(program, 'uSlats'),
+ },
+ };
+};
+
+const directionToInt = (direction: VenetianBlindsDirection): number => {
+ switch (direction) {
+ case 'vertical':
+ return 0;
+ case 'horizontal':
+ return 1;
+ default: {
+ const exhaustiveCheck: never = direction;
+ return exhaustiveCheck;
+ }
+ }
+};
+
+export const venetianBlinds = createEffect<
+ VenetianBlindsParams,
+ VenetianBlindsState
+>({
+ type: 'dev.remotion.effects.venetianBlinds',
+ label: 'venetianBlinds()',
+ documentationLink: 'https://www.remotion.dev/docs/effects/venetian-blinds',
+ backend: 'webgl2',
+ calculateKey: (params) => {
+ const r = resolve(params);
+ return `venetian-blinds-${r.progress}-${r.direction}-${r.slats}`;
+ },
+ setup: (target) => setupVenetianBlinds(target),
+ apply: ({source, width, height, params, state, flipSourceY}) => {
+ const r = resolve(params);
+ const {gl, program, texture, uniforms, vao} = state;
+
+ gl.viewport(0, 0, width, height);
+ gl.bindFramebuffer(gl.FRAMEBUFFER, null);
+ gl.clearColor(0, 0, 0, 0);
+ gl.clear(gl.COLOR_BUFFER_BIT);
+
+ gl.activeTexture(gl.TEXTURE0);
+ gl.bindTexture(gl.TEXTURE_2D, texture);
+ gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, flipSourceY);
+ gl.texImage2D(
+ gl.TEXTURE_2D,
+ 0,
+ gl.RGBA,
+ gl.RGBA,
+ gl.UNSIGNED_BYTE,
+ source as TexImageSource,
+ );
+
+ gl.useProgram(program);
+ if (uniforms.uSource) gl.uniform1i(uniforms.uSource, 0);
+ if (uniforms.uProgress) gl.uniform1f(uniforms.uProgress, r.progress);
+ if (uniforms.uDirection)
+ gl.uniform1i(uniforms.uDirection, directionToInt(r.direction));
+ if (uniforms.uSlats) gl.uniform1f(uniforms.uSlats, r.slats);
+
+ gl.bindVertexArray(vao);
+ gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4);
+ gl.bindVertexArray(null);
+
+ gl.bindTexture(gl.TEXTURE_2D, null);
+ gl.useProgram(null);
+ },
+ cleanup: ({gl, program, vao, vbo, texture}) => {
+ gl.deleteTexture(texture);
+ gl.deleteBuffer(vbo);
+ gl.deleteProgram(program);
+ gl.deleteVertexArray(vao);
+ },
+ schema: venetianBlindsSchema,
+ validateParams: validateVenetianBlindsParams,
+});
diff --git a/packages/skills/skills/remotion/SKILL.md b/packages/skills/skills/remotion/SKILL.md
index a638c4a2b7..a8aef4aec9 100644
--- a/packages/skills/skills/remotion/SKILL.md
+++ b/packages/skills/skills/remotion/SKILL.md
@@ -260,7 +260,7 @@ When creating a visual effect, prefer: 1. normal Remotion/HTML/CSS/SVG/filter/bl
For light leak overlays, see [rules/light-leaks.md](rules/light-leaks.md). Docs: https://www.remotion.dev/docs/effects
-Available effects: `brightness()`, `contrast()`, `colorKey()`, `duotone()`, `grayscale()`, `hue()`, `invert()`, `saturation()`, `tint()`, `linearGradient()`, `linearGradientTint()`, `thermalVision()`, `blur()`, `linearProgressiveBlur()`, `radialProgressiveBlur()`, `zoomBlur()`, `dropShadow()`, `glow()`, `lightTrail()`, `evolve()`, `mirror()`, `scale()`, `uvTranslate()`, `xyTranslate()`, `barrelDistortion()`, `chromaticAberration()`, `fisheye()`, `cornerPin()`, `wave()`, `burlap()`, `emboss()`, `dotGrid()`, `halftone()`, `noise()`, `noiseDisplacement()`, `pattern()`, `pixelate()`, `pixelDissolve()`, `scanlines()`, `speckle()`, `shine()`, `shrinkwrap()`, `vignette()`, `contourLines()`, `checkerboard()`, `halftoneLinearGradient()`, `gridlines()`, `whiteNoise()`, `tvSignalOff()`, `lines()`, `rings()`, `waves()`, `zigzag()`, `lightLeak()`, `starburst()`.
+Available effects: `brightness()`, `contrast()`, `colorKey()`, `duotone()`, `grayscale()`, `hue()`, `invert()`, `saturation()`, `tint()`, `linearGradient()`, `linearGradientTint()`, `thermalVision()`, `blur()`, `linearProgressiveBlur()`, `radialProgressiveBlur()`, `zoomBlur()`, `dropShadow()`, `glow()`, `lightTrail()`, `evolve()`, `venetianBlinds()`, `mirror()`, `scale()`, `uvTranslate()`, `xyTranslate()`, `barrelDistortion()`, `chromaticAberration()`, `fisheye()`, `cornerPin()`, `wave()`, `burlap()`, `emboss()`, `dotGrid()`, `halftone()`, `noise()`, `noiseDisplacement()`, `pattern()`, `pixelate()`, `pixelDissolve()`, `scanlines()`, `speckle()`, `shine()`, `shrinkwrap()`, `vignette()`, `contourLines()`, `checkerboard()`, `halftoneLinearGradient()`, `gridlines()`, `whiteNoise()`, `tvSignalOff()`, `lines()`, `rings()`, `waves()`, `zigzag()`, `lightLeak()`, `starburst()`.
## 3D content
diff --git a/packages/studio-shared/src/effect-catalog.ts b/packages/studio-shared/src/effect-catalog.ts
index d9119a6ff9..c6625dfefc 100644
--- a/packages/studio-shared/src/effect-catalog.ts
+++ b/packages/studio-shared/src/effect-catalog.ts
@@ -305,6 +305,17 @@ export const EFFECT_CATALOG: readonly EffectCatalogItem[] = [
config: {},
},
},
+ {
+ id: 'effects-venetian-blinds',
+ category: 'Reveal',
+ label: 'venetianBlinds()',
+ description: 'Slatted reveal effect',
+ effect: {
+ name: 'venetianBlinds',
+ importPath: '@remotion/effects/venetian-blinds',
+ config: {},
+ },
+ },
{
id: 'effects-mirror',
category: 'Transform',