Skip to content

🎥 Make videos programmatically with React

do more

Jonny Burger6bbaf45368b8
diff --git a/packages/docs/src/components/DoMoreHero/DoMoreHero.tsx b/packages/docs/src/components/DoMoreHero/DoMoreHero.tsx
index e74f0392ab..5286d0f8c2 100644
--- a/packages/docs/src/components/DoMoreHero/DoMoreHero.tsx
+++ b/packages/docs/src/components/DoMoreHero/DoMoreHero.tsx
@@ -2,7 +2,7 @@ import { useColorMode } from "@docusaurus/theme-common";
import { getBoundingBox, parsePath, resetPath } from "@remotion/paths";
import { Player } from "@remotion/player";
import { makeTriangle } from "@remotion/shapes";
-import React from "react";
+import React, { useMemo } from "react";
import {
AbsoluteFill,
interpolate,
@@ -10,6 +10,7 @@ import {
useCurrentFrame,
useVideoConfig,
} from "remotion";
+import { useMobileLayout } from "../../helpers/mobile-layout";
import { transformElement } from "./element";
import { Faces } from "./Faces";
import { extrudeElement } from "./join-inbetween-tiles";
@@ -25,7 +26,8 @@ import {
const InFrameLogo: React.FC<{
background: string;
-}> = ({ background }) => {
+ dark: boolean;
+}> = ({ background, dark }) => {
const { width: bBoxWidth, height: bBoxHeight, fps } = useVideoConfig();
const viewBox = [-bBoxWidth / 2, -bBoxHeight / 2, bBoxWidth, bBoxHeight].join(
" "
@@ -65,12 +67,15 @@ const InFrameLogo: React.FC<{
}))) *
500;
+ const darkColor = i === 2 ? "#bbb" : i === 1 ? "#ddd" : "#fff";
const color = i === 2 ? "#E9F3FD" : i === 1 ? "#C1DBF9" : "#0b84f3";
+ const actualColor = dark ? darkColor : color;
+
const extruded = extrudeElement({
- backFaceColor: color,
+ backFaceColor: actualColor,
sideColor: "black",
- frontFaceColor: color,
+ frontFaceColor: actualColor,
depth,
points: parsed,
strokeWidth: 20,
@@ -121,8 +126,6 @@ const gradientOpacities = [
const globalGradientOpacity = 1;
-const inputProps = {};
-
export const DoMoreHero: React.FC = () => {
const { colorMode } = useColorMode();
@@ -146,6 +149,23 @@ export const DoMoreHero: React.FC = () => {
})
.join(", ");
+ const mobile = useMobileLayout();
+ const theme = useColorMode();
+
+ const dimensions = mobile
+ ? {
+ width: 1080 * 2,
+ height: 1920 * 0.8,
+ }
+ : {
+ width: 1920 * 2,
+ height: 1080 * 1.4,
+ };
+
+ const inputProps = useMemo(() => {
+ return { dark: theme.isDarkTheme };
+ }, [theme.isDarkTheme]);
+
return (
<div
style={{
@@ -154,8 +174,8 @@ export const DoMoreHero: React.FC = () => {
>
<Player
component={InFrameLogo}
- compositionWidth={1920 * 2}
- compositionHeight={1080 * 1.4}
+ compositionWidth={dimensions.width}
+ compositionHeight={dimensions.height}
durationInFrames={100000}
fps={30}
loop
diff --git a/packages/docs/src/pages/4/v4.module.css b/packages/docs/src/pages/4/v4.module.css
index 1cb192685e..aca277e6bc 100644
--- a/packages/docs/src/pages/4/v4.module.css
+++ b/packages/docs/src/pages/4/v4.module.css
@@ -33,6 +33,7 @@
margin-top: -5px;
font-weight: 600;
margin-bottom: 10px;
+ text-align: center;
}
.eventtitle {
@@ -51,6 +52,12 @@
font-weight: 900;
}
+@media screen and (max-width: 900px) {
+ .pagetitle {
+ font-size: 3em;
+ }
+}
+
.button {
background-color: var(--ifm-color-primary);
border: none;
@@ -105,6 +112,12 @@
grid-auto-rows: 1fr;
}
+@media screen and (max-width: 900px) {
+ .grid {
+ grid-template-columns: repeat(1, 1fr);
+ }
+}
+
.submitbutton {
background-color: var(--ifm-color-primary);
color: white;