Skip to content

πŸŽ₯ Make videos programmatically with React

Light Leaks Guide

JonnyBurger7c2fcbd55a63
diff --git a/packages/docs/docs/light-leaks-guide.mdx b/packages/docs/docs/light-leaks-guide.mdx
new file mode 100644
index 0000000000..7abbccb653
--- /dev/null
+++ b/packages/docs/docs/light-leaks-guide.mdx
@@ -0,0 +1,105 @@
+---
+image: /generated/articles-docs-light-leaks-guide.png
+id: light-leaks
+title: Light Leaks
+crumb: 'Techniques'
+---
+
+# Light Leaks<AvailableFrom v="4.0.415"/>
+
+The [`<LightLeak>`](/docs/light-leaks/light-leak) component from [`@remotion/light-leaks`](/docs/light-leaks/api) renders a WebGL-based light leak effect. The effect reveals during the first half of its duration and retracts during the second half.
+
+<Demo type="light-leak" />
+
+```tsx twoslash title="MyComp.tsx"
+import {LightLeak} from '@remotion/light-leaks';
+import {AbsoluteFill} from 'remotion';
+
+const MyComp = () => {
+ return (
+ <AbsoluteFill style={{backgroundColor: 'black'}}>
+ <LightLeak durationInFrames={60} seed={3} hueShift={30} />
+ </AbsoluteFill>
+ );
+};
+```
+
+## Changing the seed
+
+The [`seed`](/docs/light-leaks/light-leak#seed) prop controls the shape of the light leak pattern. Different values produce different patterns.
+
+```tsx twoslash title="DifferentSeed.tsx"
+import {LightLeak} from '@remotion/light-leaks';
+import {AbsoluteFill} from 'remotion';
+
+// ---cut---
+const MyComp = () => {
+ return (
+ <AbsoluteFill style={{backgroundColor: 'black'}}>
+ <LightLeak seed={5} durationInFrames={30} />
+ </AbsoluteFill>
+ );
+};
+```
+
+## Changing the color
+
+Use [`hueShift`](/docs/light-leaks/light-leak#hueshift) to rotate the color of the light leak in degrees (`0`–`360`):
+
+- `0` (default) β€” yellow-to-orange
+- `120` β€” shifts toward green
+- `240` β€” shifts toward blue
+
+```tsx twoslash title="BlueHue.tsx"
+import {LightLeak} from '@remotion/light-leaks';
+import {AbsoluteFill} from 'remotion';
+
+// ---cut---
+const MyComp = () => {
+ return (
+ <AbsoluteFill style={{backgroundColor: 'black'}}>
+ <LightLeak hueShift={240} durationInFrames={30} />
+ </AbsoluteFill>
+ );
+};
+```
+
+## Using as a transition
+
+Combined with [`<TransitionSeries.Overlay>`](/docs/transitions/transitionseries#transitionseriesoverlay), you can place a light leak at the cut point between two sequences without shortening the timeline.
+
+<Demo type="transition-series-overlay" />
+
+```tsx twoslash title="LightLeakTransition.tsx"
+import {AbsoluteFill} from 'remotion';
+const Fill = ({color}: {color: string}) => <AbsoluteFill style={{backgroundColor: color}} />;
+
+// ---cut---
+import {LightLeak} from '@remotion/light-leaks';
+import {TransitionSeries} from '@remotion/transitions';
+
+const LightLeakTransition = () => {
+ return (
+ <TransitionSeries>
+ <TransitionSeries.Sequence durationInFrames={60}>
+ <Fill color="#0b84f3" />
+ </TransitionSeries.Sequence>
+ <TransitionSeries.Overlay durationInFrames={20}>
+ <LightLeak />
+ </TransitionSeries.Overlay>
+ <TransitionSeries.Sequence durationInFrames={60}>
+ <Fill color="pink" />
+ </TransitionSeries.Sequence>
+ </TransitionSeries>
+ );
+};
+```
+
+At the midpoint, the light leak covers most of the canvas, hiding the cut between scenes.
+
+## See also
+
+- [`<LightLeak>` API reference](/docs/light-leaks/light-leak)
+- [`@remotion/light-leaks`](/docs/light-leaks/api)
+- [`<TransitionSeries.Overlay>`](/docs/transitions/transitionseries#transitionseriesoverlay)
+- [Transitions](/docs/transitioning)
diff --git a/packages/docs/docs/light-leaks/index.mdx b/packages/docs/docs/light-leaks/index.mdx
index 0a7c200148..eab2f098a5 100644
--- a/packages/docs/docs/light-leaks/index.mdx
+++ b/packages/docs/docs/light-leaks/index.mdx
@@ -1,5 +1,7 @@
---
image: /generated/articles-docs-light-leaks-index.png
+id: light-leaks-api
+slug: /light-leaks/api
title: '@remotion/light-leaks'
---
@@ -17,4 +19,4 @@ import {TableOfContents} from './table-of-contents';
## License
-MIT
+[Remotion License](/docs/license)
diff --git a/packages/docs/sidebars.ts b/packages/docs/sidebars.ts
index 7edb86ff43..989a819021 100644
--- a/packages/docs/sidebars.ts
+++ b/packages/docs/sidebars.ts
@@ -456,7 +456,7 @@ const sidebars: SidebarsConfig = {
label: '@remotion/light-leaks',
link: {
type: 'doc',
- id: 'light-leaks/index',
+ id: 'light-leaks/light-leaks-api',
},
items: ['light-leaks/light-leak'],
},
@@ -866,6 +866,7 @@ const sidebars: SidebarsConfig = {
'maps',
'animation-math',
'shaders',
+ 'light-leaks',
],
},
{
diff --git a/packages/docs/src/data/articles.ts b/packages/docs/src/data/articles.ts
index 6d05713384..bc803f94ce 100644
--- a/packages/docs/src/data/articles.ts
+++ b/packages/docs/src/data/articles.ts
@@ -3105,13 +3105,22 @@ export const articles = [
slug: 'licensing/register-usage-event',
},
{
- id: 'light-leaks/index',
+ id: 'light-leaks',
+ title: 'Light Leaks',
+ relativePath: 'docs/light-leaks-guide.mdx',
+ compId: 'articles-docs-light-leaks-guide',
+ crumb: 'Techniques',
+ noAi: false,
+ slug: 'light-leaks',
+ },
+ {
+ id: 'light-leaks-api',
title: '@remotion/light-leaks',
relativePath: 'docs/light-leaks/index.mdx',
compId: 'articles-docs-light-leaks-index',
crumb: null,
noAi: false,
- slug: 'light-leaks/index',
+ slug: 'light-leaks/api',
},
{
id: 'light-leaks/light-leak',
diff --git a/packages/docs/static/generated/articles-docs-light-leaks-guide.png b/packages/docs/static/generated/articles-docs-light-leaks-guide.png
new file mode 100644
index 0000000000..d51ba45621
Binary files /dev/null and b/packages/docs/static/generated/articles-docs-light-leaks-guide.png differ
diff --git a/packages/light-leaks/package.json b/packages/light-leaks/package.json
index e412c4dcc9..365944bc6f 100644
--- a/packages/light-leaks/package.json
+++ b/packages/light-leaks/package.json
@@ -18,7 +18,7 @@
},
"author": "Jonny Burger <[email protected]>",
"contributors": [],
- "license": "MIT",
+ "license": "Remotion License",
"bugs": {
"url": "https://github.com/remotion-dev/remotion/issues"
},