Skip to content

🎥 Make videos programmatically with React

Elements: Add Location Lower Third (#9130)

Igor Samokhovetsad1fc48970e9
diff --git a/packages/docs/elements-sidebars.ts b/packages/docs/elements-sidebars.ts
index b5719c671e..eb07870567 100644
--- a/packages/docs/elements-sidebars.ts
+++ b/packages/docs/elements-sidebars.ts
@@ -36,7 +36,10 @@ const sidebars: SidebarsConfig = {
label: 'Overlays',
link: {type: 'doc', id: 'overlays/index'},
collapsed: false,
- items: ['overlays/lower-third/index'],
+ items: [
+ 'overlays/location-lower-third/index',
+ 'overlays/lower-third/index',
+ ],
},
{
type: 'category',
diff --git a/packages/docs/elements/overlays/index.mdx b/packages/docs/elements/overlays/index.mdx
index fb40d9ec84..73b0de0804 100644
--- a/packages/docs/elements/overlays/index.mdx
+++ b/packages/docs/elements/overlays/index.mdx
@@ -7,4 +7,5 @@ description: Drop-in overlay Elements for Remotion videos.
Elements:
-- [Lower third](/elements/overlays/lower-third/)
+- [Location Lower Third](/elements/overlays/location-lower-third/)
+- [Name Lower Third](/elements/overlays/lower-third/)
diff --git a/packages/docs/elements/overlays/location-lower-third/index.mdx b/packages/docs/elements/overlays/location-lower-third/index.mdx
new file mode 100644
index 0000000000..19b552bd92
--- /dev/null
+++ b/packages/docs/elements/overlays/location-lower-third/index.mdx
@@ -0,0 +1,11 @@
+---
+title: Location Lower Third
+description: An animated lower third for an event location and venue.
+---
+
+import {ElementPage} from '@site/src/components/Elements/ElementPage';
+import {elementDefinitions} from '@site/src/components/Elements/element-definitions';
+
+# Location Lower Third
+
+<ElementPage definition={elementDefinitions['overlays/location-lower-third']} sourceFile="./location-lower-third.tsx" />
diff --git a/packages/docs/elements/overlays/location-lower-third/location-lower-third.tsx b/packages/docs/elements/overlays/location-lower-third/location-lower-third.tsx
new file mode 100644
index 0000000000..c11ee0b2c7
--- /dev/null
+++ b/packages/docs/elements/overlays/location-lower-third/location-lower-third.tsx
@@ -0,0 +1,190 @@
+import React from 'react';
+import {Easing, Interactive, interpolate, useCurrentFrame} from 'remotion';
+
+const location = 'Berlin, Germany';
+const venue = 'LocalFirstConf, July 14';
+
+export const LocationLowerThird: React.FC = () => {
+ const frame = useCurrentFrame();
+ const visibleLocationCharacters = Math.floor(
+ interpolate(
+ frame,
+ [14, 38, 88, 108],
+ [0, location.length, location.length, 0],
+ {
+ extrapolateLeft: 'clamp',
+ extrapolateRight: 'clamp',
+ },
+ ),
+ );
+ const visibleVenueCharacters = Math.floor(
+ interpolate(frame, [27, 54, 82, 102], [0, venue.length, venue.length, 0], {
+ extrapolateLeft: 'clamp',
+ extrapolateRight: 'clamp',
+ }),
+ );
+
+ return (
+ <Interactive.Div
+ name="Container"
+ style={{
+ position: 'relative',
+ width: 680,
+ height: 138,
+ boxSizing: 'border-box',
+ fontFamily: 'Arial, Helvetica, sans-serif',
+ }}
+ >
+ <Interactive.Svg
+ name="Location pin"
+ viewBox="0 0 64 80"
+ style={{
+ position: 'absolute',
+ left: 56,
+ top: 4,
+ width: 104,
+ height: 130,
+ overflow: 'visible',
+ filter: 'drop-shadow(0 6px 8px rgba(24, 24, 27, 0.14))',
+ opacity: interpolate(frame, [0, 9, 108, 119], [0, 1, 1, 0], {
+ extrapolateLeft: 'clamp',
+ extrapolateRight: 'clamp',
+ }),
+ translate: interpolate(
+ frame,
+ [0, 16, 106, 119],
+ ['0px -10px', '0px 0px', '0px 0px', '0px -8px'],
+ {
+ easing: Easing.out(Easing.cubic),
+ extrapolateLeft: 'clamp',
+ extrapolateRight: 'clamp',
+ },
+ ),
+ scale: interpolate(frame, [0, 16, 106, 119], [0.88, 1, 1, 0.92], {
+ easing: Easing.out(Easing.cubic),
+ extrapolateLeft: 'clamp',
+ extrapolateRight: 'clamp',
+ }),
+ transformOrigin: '52px 126px',
+ }}
+ >
+ <path
+ d="M32 3C15.4 3 4 15.4 4 31C4 50.8 22.1 69.6 29.3 76.2C30.8 77.6 33.2 77.6 34.7 76.2C41.9 69.6 60 50.8 60 31C60 15.4 48.6 3 32 3Z"
+ pathLength="1"
+ fill="#2563eb"
+ fillOpacity={interpolate(frame, [5, 18, 105, 114], [0, 1, 1, 0], {
+ extrapolateLeft: 'clamp',
+ extrapolateRight: 'clamp',
+ })}
+ stroke="#1d4ed8"
+ strokeDasharray="1"
+ strokeDashoffset={interpolate(
+ frame,
+ [0, 16, 105, 116],
+ [1, 0, 0, 1],
+ {
+ easing: Easing.out(Easing.cubic),
+ extrapolateLeft: 'clamp',
+ extrapolateRight: 'clamp',
+ },
+ )}
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ strokeWidth="2.5"
+ />
+ <circle
+ cx="32"
+ cy="30"
+ r={interpolate(frame, [10, 21, 102, 112], [0, 9, 9, 0], {
+ easing: Easing.out(Easing.cubic),
+ extrapolateLeft: 'clamp',
+ extrapolateRight: 'clamp',
+ })}
+ fill="#eff6ff"
+ />
+ </Interactive.Svg>
+
+ <div
+ style={{
+ position: 'absolute',
+ left: 184,
+ top: 3,
+ width: 440,
+ height: 132,
+ display: 'flex',
+ flexDirection: 'column',
+ }}
+ >
+ <div
+ style={{
+ height: 82,
+ display: 'flex',
+ alignItems: 'center',
+ overflow: 'hidden',
+ }}
+ >
+ <Interactive.Div
+ name="Location"
+ dir="auto"
+ style={{
+ minWidth: 0,
+ maxWidth: 440,
+ overflow: 'hidden',
+ color: '#18181b',
+ fontSize: 54,
+ fontWeight: 700,
+ letterSpacing: -1,
+ lineHeight: 1,
+ clipPath: `inset(0 ${
+ 100 - (visibleLocationCharacters / location.length) * 100
+ }% 0 0)`,
+ textOverflow: 'ellipsis',
+ whiteSpace: 'nowrap',
+ opacity: interpolate(frame, [14, 22, 98, 110], [0, 1, 1, 0], {
+ extrapolateLeft: 'clamp',
+ extrapolateRight: 'clamp',
+ }),
+ }}
+ >
+ {location}
+ </Interactive.Div>
+ </div>
+
+ <div
+ style={{
+ minHeight: 0,
+ flex: 1,
+ display: 'flex',
+ alignItems: 'center',
+ overflow: 'hidden',
+ }}
+ >
+ <Interactive.Div
+ name="Venue"
+ dir="auto"
+ style={{
+ minWidth: 0,
+ maxWidth: 440,
+ overflow: 'hidden',
+ color: '#52525b',
+ fontSize: 29,
+ fontWeight: 500,
+ lineHeight: 1,
+ clipPath: `inset(0 ${
+ 100 - (visibleVenueCharacters / venue.length) * 100
+ }% 0 0)`,
+ textOverflow: 'ellipsis',
+ whiteSpace: 'nowrap',
+ opacity: interpolate(frame, [27, 35, 92, 104], [0, 1, 1, 0], {
+ extrapolateLeft: 'clamp',
+ extrapolateRight: 'clamp',
+ }),
+ }}
+ >
+ {venue}
+ </Interactive.Div>
+ </div>
+ </div>
+ </Interactive.Div>
+ );
+};
diff --git a/packages/docs/elements/overlays/lower-third/index.mdx b/packages/docs/elements/overlays/lower-third/index.mdx
index f7112a3108..57b5b6cfc0 100644
--- a/packages/docs/elements/overlays/lower-third/index.mdx
+++ b/packages/docs/elements/overlays/lower-third/index.mdx
@@ -1,11 +1,11 @@
---
-title: Lower Third
-description: A clean animated lower third for names and titles.
+title: Name Lower Third
+description: A clean animated lower third for introducing a speaker, guest, or host.
---
import {ElementPage} from '@site/src/components/Elements/ElementPage';
import {elementDefinitions} from '@site/src/components/Elements/element-definitions';
-# Lower Third
+# Name Lower Third
<ElementPage definition={elementDefinitions['overlays/lower-third']} sourceFile="./lower-third.tsx" />
diff --git a/packages/docs/elements/overlays/lower-third/lower-third.tsx b/packages/docs/elements/overlays/lower-third/lower-third.tsx
index e7e897c615..c3880bd268 100644
--- a/packages/docs/elements/overlays/lower-third/lower-third.tsx
+++ b/packages/docs/elements/overlays/lower-third/lower-third.tsx
@@ -7,7 +7,7 @@ loadFont('normal', {
weights: ['500', '600', '700'],
});
-export const LowerThird: React.FC = () => {
+export const NameLowerThird: React.FC = () => {
const frame = useCurrentFrame();
return (
diff --git a/packages/docs/src/components/Elements/element-definitions.ts b/packages/docs/src/components/Elements/element-definitions.ts
index ed88a0ac27..dccd5dece9 100644
--- a/packages/docs/src/components/Elements/element-definitions.ts
+++ b/packages/docs/src/components/Elements/element-definitions.ts
@@ -4,7 +4,8 @@ import {NotebookPaper} from '../../../elements/backgrounds/notebook-paper/notebo
import {PaperTexture} from '../../../elements/backgrounds/paper-texture/paper-texture';
import {RotatingStarburst} from '../../../elements/backgrounds/rotating-starburst/rotating-starburst';
import {NumberCounter} from '../../../elements/data/number-counter/number-counter';
-import {LowerThird} from '../../../elements/overlays/lower-third/lower-third';
+import {LocationLowerThird} from '../../../elements/overlays/location-lower-third/location-lower-third';
+import {NameLowerThird} from '../../../elements/overlays/lower-third/lower-third';
import {CircleMarker} from '../../../elements/text/circle-marker/circle-marker';
import {CrossedOffText} from '../../../elements/text/crossed-off/crossed-off';
import {StrikeThroughText} from '../../../elements/text/strike-through/strike-through';
@@ -95,13 +96,29 @@ export const elementDefinitions = {
slug: 'backgrounds/rotating-starburst',
width: 1920,
},
+ 'overlays/location-lower-third': {
+ category: 'overlays',
+ component: LocationLowerThird,
+ contributors: [],
+ description: 'An animated lower third for an event location and venue.',
+ displayName: 'Location Lower Third',
+ durationInFrames: 120,
+ elementHeight: 138,
+ elementWidth: 680,
+ fps: 30,
+ height: 1080,
+ posterFrame: 60,
+ previewPadding: 300,
+ slug: 'overlays/location-lower-third',
+ width: 1920,
+ },
'overlays/lower-third': {
category: 'overlays',
- component: LowerThird,
+ component: NameLowerThird,
contributors: [],
description:
- 'A clean animated lower third for introducing a speaker, guest, or section.',
- displayName: 'Lower Third',
+ 'A clean animated lower third for introducing a speaker, guest, or host.',
+ displayName: 'Name Lower Third',
durationInFrames: 120,
elementHeight: 138,
elementWidth: 680,