Skip to content

🎥 Make videos programmatically with React

WIP: New homepage graphic "What is Remotion"

Jonny Burger1fd130f357db
diff --git a/packages/example/public/bg.png b/packages/example/public/bg.png
new file mode 100644
index 0000000000..c987a2cb92
Binary files /dev/null and b/packages/example/public/bg.png differ
diff --git a/packages/example/src/3DContext/DivExtrusion.tsx b/packages/example/src/3DContext/DivExtrusion.tsx
index 612b70a514..62167262be 100644
--- a/packages/example/src/3DContext/DivExtrusion.tsx
+++ b/packages/example/src/3DContext/DivExtrusion.tsx
@@ -15,6 +15,7 @@ export const DivExtrusion: React.FC<{
width,
position: 'absolute',
top: 0,
+ filter: 'drop-shadow(0 0 10px rgba(0, 0, 0, 0.1))',
}}
pointerEvents="none"
>
diff --git a/packages/example/src/3DContext/transformation-context.tsx b/packages/example/src/3DContext/transformation-context.tsx
index 6bf3305510..3005e9c13b 100644
--- a/packages/example/src/3DContext/transformation-context.tsx
+++ b/packages/example/src/3DContext/transformation-context.tsx
@@ -4,6 +4,8 @@ import {
rotateX,
rotateY,
scaled,
+ translateX,
+ translateY,
} from '@remotion/svg-3d-engine';
import React, {useContext, useMemo} from 'react';
@@ -39,6 +41,28 @@ export const RotateX: React.FC<{
);
};
+export const TranslateY: React.FC<{
+ readonly children: React.ReactNode;
+ readonly px: number;
+}> = ({children, px}) => {
+ return (
+ <NewTransform transform={useMemo(() => translateY(px), [px])}>
+ {children}
+ </NewTransform>
+ );
+};
+
+export const TranslateX: React.FC<{
+ readonly children: React.ReactNode;
+ readonly px: number;
+}> = ({children, px}) => {
+ return (
+ <NewTransform transform={useMemo(() => translateX(px), [px])}>
+ {children}
+ </NewTransform>
+ );
+};
+
export const RotateY: React.FC<{
readonly children: React.ReactNode;
readonly radians: number;
diff --git a/packages/example/src/Compose/Compose.tsx b/packages/example/src/Compose/Compose.tsx
new file mode 100644
index 0000000000..410e07453d
--- /dev/null
+++ b/packages/example/src/Compose/Compose.tsx
@@ -0,0 +1,156 @@
+import {AbsoluteFill, Img, staticFile, useCurrentFrame} from 'remotion';
+import {ExtrudeDiv} from '../3DContext/Div3D';
+import {
+ RotateX,
+ RotateY,
+ Scale,
+ TranslateX,
+ TranslateY,
+} from '../3DContext/transformation-context';
+
+const height = 700;
+const width = (height / 16) * 9;
+
+export const Compose = () => {
+ const cornerRadius = 10;
+
+ const angle = Math.PI / 4;
+
+ const progress = useCurrentFrame();
+
+ return (
+ <AbsoluteFill className="flex justify-center items-center">
+ <Scale factor={1.3}>
+ <RotateX radians={progress / 10}>
+ <RotateX radians={Math.sin(angle) / 4}>
+ <RotateY radians={-Math.cos(angle) / 4}>
+ <AbsoluteFill className="flex justify-center items-center">
+ <ExtrudeDiv
+ width={width}
+ height={height}
+ depth={40}
+ cornerRadius={10}
+ bottomFace={
+ <div
+ className="text-white "
+ style={{
+ fontFamily: 'GT Planar',
+ height: '100%',
+ display: 'flex',
+ flexDirection: 'column',
+ justifyContent: 'center',
+ paddingLeft: 10,
+ }}
+ >
+ &lt;Video /&gt;
+ </div>
+ }
+ >
+ <div
+ style={{
+ borderRadius: cornerRadius,
+ overflow: 'hidden',
+ fontFamily: 'GT Planar',
+ backgroundColor: 'white',
+ }}
+ className="text-black flex justify-center items-center font-sans text-2xl font-bold flex-1"
+ >
+ <Img src={staticFile('bg.png')}></Img>
+ </div>
+ </ExtrudeDiv>
+ </AbsoluteFill>
+ <TranslateX px={30}>
+ <TranslateY px={120}>
+ <AbsoluteFill className="flex justify-center items-center">
+ <ExtrudeDiv
+ width={300}
+ height={60}
+ depth={40}
+ cornerRadius={10}
+ bottomFace={
+ <div
+ className="text-white "
+ style={{
+ fontFamily: 'GT Planar',
+ height: '100%',
+ display: 'flex',
+ flexDirection: 'column',
+ justifyContent: 'center',
+ paddingLeft: 10,
+ }}
+ >
+ &lt;Captions /&gt;
+ </div>
+ }
+ >
+ <div
+ style={{
+ borderRadius: cornerRadius,
+ overflow: 'hidden',
+ fontFamily: 'GT Planar',
+ backgroundColor: 'white',
+ }}
+ className="text-black flex justify-center items-center font-sans text-2xl font-bold flex-1"
+ >
+ <div>
+ Hallo{' '}
+ <span className="bg-blue-600 px-2 py-1 rounded text-white">
+ IPT!
+ </span>
+ </div>
+ </div>
+ </ExtrudeDiv>
+ </AbsoluteFill>
+ </TranslateY>
+ </TranslateX>
+ <TranslateX px={110}>
+ <TranslateY px={-280}>
+ <AbsoluteFill className="flex justify-center items-center">
+ <ExtrudeDiv
+ width={120}
+ height={120}
+ depth={40}
+ cornerRadius={10}
+ bottomFace={
+ <div
+ className="text-white "
+ style={{
+ fontFamily: 'GT Planar',
+ height: '100%',
+ display: 'flex',
+ flexDirection: 'column',
+ justifyContent: 'center',
+ paddingLeft: 10,
+ }}
+ >
+ &lt;Img /&gt;
+ </div>
+ }
+ >
+ <div
+ style={{
+ borderRadius: cornerRadius,
+ overflow: 'hidden',
+ fontFamily: 'GT Planar',
+ backgroundColor: 'white',
+ }}
+ className="text-black flex justify-center items-center font-sans text-2xl font-bold flex-1"
+ >
+ <Img
+ style={{
+ width: '80%',
+ }}
+ src="https://ipt.ch/static/img/logo_ipt.e41536c42e31.svg"
+ ></Img>
+ </div>
+ </ExtrudeDiv>
+ </AbsoluteFill>
+ </TranslateY>
+ </TranslateX>
+ </RotateY>
+ </RotateX>
+ </RotateX>
+ </Scale>
+ </AbsoluteFill>
+ );
+};
diff --git a/packages/example/src/Root.tsx b/packages/example/src/Root.tsx
index d5cff09d53..6fa41e9d16 100644
--- a/packages/example/src/Root.tsx
+++ b/packages/example/src/Root.tsx
@@ -118,6 +118,7 @@ import {ThreeDContext} from './3DContext';
import {ThreeDEngine} from './3DEngine';
import {ThreeDSvgContent} from './3DSvgContent';
import {AnimatedImages} from './AnimatedImage/Avif';
+import {Compose} from './Compose/Compose';
import {ParseAndDownloadMedia} from './ParseAndDownloadMedia';
import {SmoothTextTransition} from './SmoothTextTransition';
@@ -1497,6 +1498,14 @@ export const Index: React.FC = () => {
fps={30}
durationInFrames={1000}
/>
+ <Composition
+ id="3DCompose"
+ component={Compose}
+ width={1080}
+ height={1080}
+ fps={30}
+ durationInFrames={1000}
+ />
<Composition
id="3DContext"
component={ThreeDContext}