Skip to content

🎥 Make videos programmatically with React

remotion.dev/brand: Add a 3D timeline comparison

JonnyBurgerc721477141a6
diff --git a/packages/brand/public/timeline-reveal/after.png b/packages/brand/public/timeline-reveal/after.png
index a923b1c591..484976177b 100644
Binary files a/packages/brand/public/timeline-reveal/after.png and b/packages/brand/public/timeline-reveal/after.png differ
diff --git a/packages/brand/public/timeline-reveal/before.png b/packages/brand/public/timeline-reveal/before.png
index e842fb3377..5cfea694e6 100644
Binary files a/packages/brand/public/timeline-reveal/before.png and b/packages/brand/public/timeline-reveal/before.png differ
diff --git a/packages/brand/src/ParentRotationSelectionRepro.tsx b/packages/brand/src/ParentRotationSelectionRepro.tsx
new file mode 100644
index 0000000000..bc599cfb62
--- /dev/null
+++ b/packages/brand/src/ParentRotationSelectionRepro.tsx
@@ -0,0 +1,38 @@
+import {CanvasImage, Composition, Interactive, registerRoot} from 'remotion';
+
+export const ParentRotationSelectionRepro = () => {
+ return (
+ <div style={{position: 'absolute', inset: 0, perspective: 1800}}>
+ <Interactive.Div
+ name="Parent"
+ style={{
+ position: 'absolute',
+ left: 240,
+ top: 160,
+ width: 800,
+ height: 400,
+ backgroundColor: '#334155',
+ rotate: '1 -1 0 12deg',
+ }}
+ >
+ <CanvasImage
+ name="Child"
+ src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='800' height='400'%3E%3Crect width='800' height='400' fill='%230b84ff'/%3E%3C/svg%3E"
+ cropRight={0.35}
+ style={{position: 'absolute', width: '100%', height: '100%'}}
+ />
+ </Interactive.Div>
+ </div>
+ );
+};
+
+registerRoot(() => (
+ <Composition
+ id="ParentRotationSelectionRepro"
+ component={ParentRotationSelectionRepro}
+ width={1280}
+ height={720}
+ fps={30}
+ durationInFrames={90}
+ />
+));
diff --git a/packages/brand/src/Root.tsx b/packages/brand/src/Root.tsx
index c465e56ba1..3b9daac0c3 100644
--- a/packages/brand/src/Root.tsx
+++ b/packages/brand/src/Root.tsx
@@ -186,7 +186,7 @@ export const RemotionRoot: React.FC = () => {
width={2560}
height={1600}
fps={60}
- durationInFrames={360}
+ durationInFrames={720}
/>
<Folder name="Logo">
<Folder name="AnimatedLogo">
diff --git a/packages/brand/src/TimelineLayoutReveal.tsx b/packages/brand/src/TimelineLayoutReveal.tsx
index 64eb740934..3d0c12309e 100644
--- a/packages/brand/src/TimelineLayoutReveal.tsx
+++ b/packages/brand/src/TimelineLayoutReveal.tsx
@@ -1,6 +1,7 @@
import {
CanvasImage,
Easing,
+ Interactive,
interpolate,
staticFile,
useCurrentFrame,
@@ -12,24 +13,139 @@ export const TimelineLayoutReveal = () => {
const {fps} = useVideoConfig();
return (
- <>
- <CanvasImage
- name="Before"
- src={staticFile('timeline-reveal/before.png')}
- premountFor={fps}
- style={{position: 'absolute', width: '100%', height: '100%'}}
- />
- <CanvasImage
- name="After"
- src={staticFile('timeline-reveal/after.png')}
- premountFor={fps}
- cropRight={interpolate(frame, [1.2 * fps, 3.8 * fps], [1, 0], {
- extrapolateLeft: 'clamp',
- extrapolateRight: 'clamp',
- easing: Easing.bezier(0.65, 0, 0.35, 1),
- })}
- style={{position: 'absolute', width: '100%', height: '100%'}}
- />
- </>
+ <div
+ style={{
+ position: 'absolute',
+ inset: 0,
+ overflow: 'hidden',
+ backgroundColor: '#0b0e14',
+ perspective: 2800,
+ }}
+ >
+ <Interactive.Div
+ name="Timeline camera"
+ style={{
+ position: 'absolute',
+ width: '100%',
+ height: '100%',
+ left: '50%',
+ top: '50%',
+ translate: interpolate(
+ frame,
+ [0, 11 * fps],
+ ['-512px -1264px', '-1280px -800px'],
+ {
+ extrapolateLeft: 'clamp',
+ extrapolateRight: 'clamp',
+ },
+ ),
+ transformOrigin: interpolate(
+ frame,
+ [0, 11 * fps],
+ ['20% 79%', '50% 50%'],
+ {
+ extrapolateLeft: 'clamp',
+ extrapolateRight: 'clamp',
+ },
+ ),
+ scale: interpolate(
+ frame,
+ [1.8666666666666667 * fps, 11 * fps],
+ [1.85, 1],
+ {
+ extrapolateLeft: 'clamp',
+ extrapolateRight: 'clamp',
+ easing: [Easing.bezier(0.42, 0, 0.58, 1)],
+ },
+ ),
+ rotate: interpolate(
+ frame,
+ [1.8666666666666667 * fps, 11 * fps],
+ [
+ '-0.204073 0.978913 0.009116 16.327895deg',
+ '-0.204073 0.978913 0.009116 0deg',
+ ],
+ {
+ extrapolateLeft: 'clamp',
+ extrapolateRight: 'clamp',
+ easing: [Easing.bezier(0.42, 0, 0.58, 1)],
+ },
+ ),
+ boxShadow: '0 40px 100px rgba(0, 0, 0, 0.5)',
+ }}
+ >
+ <CanvasImage
+ name="Before"
+ src={staticFile('timeline-reveal/before.png')}
+ premountFor={fps}
+ style={{position: 'absolute', width: '100%', height: '100%'}}
+ />
+ <CanvasImage
+ name="After"
+ src={staticFile('timeline-reveal/after.png')}
+ premountFor={fps}
+ cropRight={interpolate(frame, [0, 11 * fps], [0.8, 0], {
+ extrapolateLeft: 'clamp',
+ extrapolateRight: 'clamp',
+ easing: Easing.linear,
+ })}
+ style={{position: 'absolute', width: '100%', height: '100%'}}
+ />
+ <div
+ style={{
+ position: 'absolute',
+ top: '58%',
+ width: '100%',
+ height: '42%',
+ overflow: 'hidden',
+ }}
+ >
+ <Interactive.Div
+ name="Reveal seam"
+ style={{
+ position: 'absolute',
+ top: -928,
+ width: 128,
+ height: 1600,
+ overflow: 'hidden',
+ pointerEvents: 'none',
+ left: 0,
+ translate: interpolate(
+ frame,
+ [0, 11 * fps],
+ ['448px 0px', '2496px 0px'],
+ {
+ extrapolateLeft: 'clamp',
+ extrapolateRight: 'clamp',
+ easing: Easing.linear,
+ },
+ ),
+ opacity: interpolate(frame, [10.4 * fps, 11 * fps], [1, 0], {
+ extrapolateLeft: 'clamp',
+ extrapolateRight: 'clamp',
+ }),
+ background:
+ 'radial-gradient(ellipse at center, rgba(255, 255, 255, 0.6) 0%, rgba(219, 224, 232, 0.22) 35%, transparent 70%)',
+ }}
+ >
+ <Interactive.Div
+ name="Metallic core"
+ style={{
+ position: 'absolute',
+ left: 64,
+ top: 0,
+ width: 6,
+ height: '100%',
+ translate: '-3px 0px',
+ background:
+ 'linear-gradient(to right, #9da5b0, #e1e5ea 20%, #ffffff 45%, #ffffff 60%, #b5bdc9 82%, #f3f5f8)',
+ boxShadow:
+ '0 0 10px 3px rgba(255, 255, 255, 0.95), 0 0 26px 7px rgba(232, 236, 242, 0.65), 0 0 60px 12px rgba(214, 221, 231, 0.22)',
+ }}
+ />
+ </Interactive.Div>
+ </div>
+ </Interactive.Div>
+ </div>
);
};