🎥 Make videos programmatically with React
almost done
Jonny Burgerad50cd76f2d6
diff --git a/packages/docs/components/LandingPage/FreePricing.tsx b/packages/docs/components/LandingPage/FreePricing.tsxindex b59e99b3d3..ea26f6cf81 100644--- a/packages/docs/components/LandingPage/FreePricing.tsx+++ b/packages/docs/components/LandingPage/FreePricing.tsx@@ -1,5 +1,6 @@import React from "react";import styled from "styled-components";+import { mobile } from "../layout/layout";import { PricingTable } from "./PricingTable";const Row = styled.div`@@ -22,10 +23,17 @@ const Mp4 = styled.span`-webkit-background-clip: text;`;+const Container = styled.div`+ text-align: center;+ ${mobile`+ text-align: left;+ `}+`;+export const FreePricing: React.FC = () => {return (<>- <div style={{ textAlign: "center" }}>+ <Container><Title><Mp4>Free</Mp4> for individuals <br /> Funded by companies</Title>@@ -35,7 +43,7 @@ export const FreePricing: React.FC = () => {As a company, you need a license to use Remotion. <br /> Thanks toyour support, we keep improving Remotion for everyone.</p>- </div>+ </Container><PricingTable></PricingTable><br /><br />diff --git a/packages/docs/components/LandingPage/PricingTable.tsx b/packages/docs/components/LandingPage/PricingTable.tsxindex 9622795c0f..5a5139eb98 100644--- a/packages/docs/components/LandingPage/PricingTable.tsx+++ b/packages/docs/components/LandingPage/PricingTable.tsx@@ -111,6 +111,13 @@ const Bullet: React.FC<{ color: string }> = ({ color }) => {);};+const A = styled.a`+ &:hover {+ text-decoration: none;+ }+ color: inherit;+`;+export const PricingTable: React.FC<{}> = () => {const [period, setPeriod] = useState(Period.Monthly);return (@@ -177,13 +184,13 @@ export const PricingTable: React.FC<{}> = () => {</li></ul><div style={{ flex: 1 }} />- <a href="https://companies.remotion.dev">+ <A href="https://companies.remotion.dev" target="_blank"><div><BlueButton fullWidth loading={false} size="bg">Buy a license</BlueButton></div>- </a>+ </A></Panel><Spacer /><Spacer />@@ -212,13 +219,13 @@ export const PricingTable: React.FC<{}> = () => {</li></ul><div style={{ flex: 1 }} />- <a href="https://companies.remotion.dev">+ <A href="https://companies.remotion.dev" target="_blank"><div><BlueButton fullWidth loading={false} size="bg">Buy a license</BlueButton></div>- </a>+ </A></Panel></PricingRow></Portion>diff --git a/packages/docs/components/LandingPage/Programmatic.tsx b/packages/docs/components/LandingPage/Programmatic.tsxindex 7a34af160c..4beee338ed 100644--- a/packages/docs/components/LandingPage/Programmatic.tsx+++ b/packages/docs/components/LandingPage/Programmatic.tsx@@ -1,7 +1,17 @@import { Player, PlayerRef } from "@remotion/player";import React, { useCallback, useEffect, useRef, useState } from "react";+import styled from "styled-components";+import { mobile } from "../layout/layout";import { GithubDemo, GithubResponse } from "./GithubDemo";+const MobilePlayer = styled.div`+ width: 500px;+ position: relative;+ ${mobile`+ width: 100%;+ `}+`;+export const ProgrammaticContent: React.FC<{ data: GithubResponse | null }> = ({data,}) => {@@ -41,7 +51,7 @@ export const ProgrammaticContent: React.FC<{ data: GithubResponse | null }> = ({}, [data]);return (- <div ref={containerRef}>+ <MobilePlayer ref={containerRef}><Playerref={playerRef}component={GithubDemo}@@ -50,9 +60,9 @@ export const ProgrammaticContent: React.FC<{ data: GithubResponse | null }> = ({durationInFrames={100}fps={30}controls- style={{ width: 500 }}+ style={{ width: "100%" }}inputProps={{ data }}- ></Player>- </div>+ />+ </MobilePlayer>);};diff --git a/packages/docs/components/LandingPage/WriteInReact.tsx b/packages/docs/components/LandingPage/WriteInReact.tsxnew file mode 100644index 0000000000..7afaf6b44e--- /dev/null+++ b/packages/docs/components/LandingPage/WriteInReact.tsx@@ -0,0 +1,98 @@+import TabItem from "@theme/TabItem";+import Tabs from "@theme/Tabs";+import React, { useState } from "react";+import styled from "styled-components";+import headerStyles from "../../src/pages/header.module.css";+import styles from "../../src/pages/styles.module.css";+import { mobile } from "../layout/layout";++const Row = styled.div`+ flex-direction: row;+ display: flex;+ ${mobile`+ flex-direction: column;+ `}+`;++const Title = styled.h1`+ font-size: 5em;+ font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,+ Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;+ font-weight: 700;+ line-height: 1;+ -webkit-text-fill-color: transparent;+ background: linear-gradient(+ to right,+ var(--text-color),+ var(--light-text-color)+ );+ -webkit-background-clip: text;+ width: 500px;+`;++const Snippet: React.FC<{+ snippetValue: string;+}> = ({ snippetValue }) => {+ const [copied, setCopied] = useState(false);+ return (+ <div className={styles.snippet}>+ <div className={styles.snippetValue}>$ {snippetValue}</div>+ <div+ className={styles.copySnippet}+ onClick={() => {+ navigator.clipboard.writeText(snippetValue);+ setCopied(true);+ }}+ >+ {copied ? "Copied!" : "Copy"}+ </div>+ </div>+ );+};++const Right = styled.div`+ flex: 1;+ ${mobile`+ margin-top: 30px;+ `}+`;++export const WriteInReact: React.FC = () => {+ return (+ <Row>+ <div style={{ flex: 1 }}>+ <Title>+ Write videos <br /> in React.+ </Title>+ <p>+ Use your React knowledge to create real MP4 videos. <br /> Scale your+ video production using server-side rendering and parametrization.+ </p>+ <Tabs+ className={headerStyles.tabContainer}+ defaultValue="npm"+ values={[+ { label: "NPM", value: "npm" },+ { label: "Yarn", value: "yarn" },+ ]}+ >+ <TabItem value="npm">+ <Snippet snippetValue={"npm init video"} />+ </TabItem>++ <TabItem value="yarn">+ <Snippet snippetValue={"yarn create video"} />+ </TabItem>+ </Tabs>+ </div>+ <Right>+ <img+ style={{+ boxShadow: "0 0 8px rgba(0, 0, 0, 0.2)",+ }}+ src="http://i3.ytimg.com/vi/gwlDorikqgY/maxresdefault.jpg"+ ></img>+ </Right>+ </Row>+ );+};diff --git a/packages/docs/components/LandingPage/editor.tsx b/packages/docs/components/LandingPage/editor.tsxindex 8dcefaa434..aa0e1c732c 100644--- a/packages/docs/components/LandingPage/editor.tsx+++ b/packages/docs/components/LandingPage/editor.tsx@@ -1,5 +1,6 @@import React, { useCallback, useEffect, useRef, useState } from "react";import styled, { keyframes } from "styled-components";+import { mobile } from "../layout/layout";const Row = styled.div`display: flex;@@ -7,6 +8,12 @@ const Row = styled.div`justify-content: flex-end;text-align: right;align-items: center;+ ${mobile`+ flex-direction: column-reverse;+ text-align: left;+ align-items: flex-start;+ justify-content: flex-start;+ `}`;const Title = styled.h2`@@ -16,6 +23,9 @@ const Title = styled.h2`Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;line-height: 1.1;text-align: right;+ ${mobile`+ text-align: left;+ `}`;const Mp4 = styled.span`diff --git a/packages/docs/components/LandingPage/if-you-know-react.tsx b/packages/docs/components/LandingPage/if-you-know-react.tsxindex 26278eedb1..d50853e469 100644--- a/packages/docs/components/LandingPage/if-you-know-react.tsx+++ b/packages/docs/components/LandingPage/if-you-know-react.tsx@@ -1,13 +1,20 @@import React from "react";import styled from "styled-components";+import { mobile } from "../layout/layout";import { CodeExample } from "./CodeExample";const Row = styled.div`display: flex;flex-direction: row;- justify-content: flex-end;text-align: right;+ justify-content: flex-end;align-items: center;+ ${mobile`+ flex-direction: column-reverse;+ text-align: left;+ justify-content: flex-start;+ align-items: flex-start;+ `}`;const Title = styled.h2`@@ -17,6 +24,9 @@ const Title = styled.h2`Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;line-height: 1.1;text-align: right;+ ${mobile`+ text-align: left;+ `}`;const Rea = styled.span`@@ -32,6 +42,10 @@ const Button = styled.div`border-radius: 3px;color: white;font-weight: bold;+ ${mobile`++ margin-bottom: 80px;+ `}`;export const IfYouKnowReact: React.FC = () => {@@ -49,7 +63,9 @@ export const IfYouKnowReact: React.FC = () => {rules of React stay the same. <br />Learn the fundamentals in just a few minutes:</p>- <Button>Learn Remotion</Button>+ <a href="/docs/the-fundamentals">+ <Button>Learn Remotion</Button>+ </a></div></Row>);diff --git a/packages/docs/components/LandingPage/parametrize.tsx b/packages/docs/components/LandingPage/parametrize.tsxindex e3fc9a479d..1ef4553adf 100644--- a/packages/docs/components/LandingPage/parametrize.tsx+++ b/packages/docs/components/LandingPage/parametrize.tsx@@ -1,5 +1,6 @@import React, { useEffect, useReducer, useRef, useState } from "react";import styled from "styled-components";+import { mobile } from "../layout/layout";import { GithubResponse } from "./GithubDemo";import { ProgrammaticContent } from "./Programmatic";@@ -8,6 +9,10 @@ const Row = styled.div`flex-direction: row;text-align: left;align-items: center;+ ${mobile`+ flex-direction: column;+ align-items: flex-start;+ `}`;const Title = styled.h2`diff --git a/packages/docs/components/LandingPage/real-mp4-videos.tsx b/packages/docs/components/LandingPage/real-mp4-videos.tsxindex 0aa33ae87a..ad6fe37223 100644--- a/packages/docs/components/LandingPage/real-mp4-videos.tsx+++ b/packages/docs/components/LandingPage/real-mp4-videos.tsx@@ -1,9 +1,13 @@import React, { useCallback, useEffect, useRef, useState } from "react";import styled, { keyframes } from "styled-components";+import { mobile } from "../layout/layout";const Row = styled.div`display: flex;flex-direction: row;+ ${mobile`+ flex-direction: column-reverse;+ `}`;const Title = styled.h2`@@ -31,11 +35,25 @@ const animation = keyframes`}`;+const Mp4Container = styled.div`+ flex: 1;+ justify-content: flex-end;+ ${mobile`+ justify-content: flex-start;+ `}+ align-items: center;+ display: flex;+`;+const Icon = styled.img<{playing: boolean;}>`animation: ${animation} 0.6s;animation-play-state: ${(props) => (props.playing ? "running" : "paused")};+ ${mobile`+ animation: none;+ margin-bottom: 30px;+ `}`;export const RealMP4Videos: React.FC = () => {@@ -72,20 +90,13 @@ export const RealMP4Videos: React.FC = () => {also supported.</p></div>- <div- style={{- flex: 1,- justifyContent: "flex-end",- alignItems: "center",- display: "flex",- }}- >+ <Mp4Container><Iconplaying={isIntersecting}src="/img/mp4.png"- style={{ width: 140 }}+ style={{ width: 110 }}></Icon>- </div>+ </Mp4Container></Row>);};diff --git a/packages/docs/src/css/custom.css b/packages/docs/src/css/custom.cssindex 24a445cd0c..1c9efd6d38 100644--- a/packages/docs/src/css/custom.css+++ b/packages/docs/src/css/custom.css@@ -22,7 +22,7 @@--blue-button-color: #084696;--blue-underlay: rgba(66, 144, 245, 0.15);--blue-underlay-hover: rgba(66, 144, 245, 0.25);- --light-text-color: #444;+ --light-text-color: #777;--clear-hover: rgba(0, 0, 0, 0.04);--box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);}diff --git a/packages/docs/src/pages/new-landing.tsx b/packages/docs/src/pages/new-landing.tsxindex c6c59c32e2..80c21b4d82 100644--- a/packages/docs/src/pages/new-landing.tsx+++ b/packages/docs/src/pages/new-landing.tsx@@ -6,27 +6,18 @@ import { FreePricing } from "../../components/LandingPage/FreePricing";import { IfYouKnowReact } from "../../components/LandingPage/if-you-know-react";import { Parametrize } from "../../components/LandingPage/parametrize";import { RealMP4Videos } from "../../components/LandingPage/real-mp4-videos";--const Title = styled.h1`- font-size: 5em;- font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,- Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;- font-weight: 700;- line-height: 1;- -webkit-text-fill-color: transparent;- background: linear-gradient(- to right,- var(--text-color),- var(--light-text-color)- );- -webkit-background-clip: text;- width: 500px;-`;+import { WriteInReact } from "../../components/LandingPage/WriteInReact";+import { mobile } from "../../components/layout/layout";const Content = styled.div`max-width: 1000px;margin: auto;padding-top: 10vh;+ padding-left: 20px;+ padding-right: 20px;+ ${mobile`+ max-width: 500px;+ `}`;const NewLanding: React.FC = () => {@@ -36,13 +27,7 @@ const NewLanding: React.FC = () => {description="Create MP4 motion graphics in React. Leverage CSS, SVG, WebGL and more technologies to render videos programmatically!"><Content>- <Title>- Write videos <br /> in React.- </Title>- <p>- Use your React knowledge to create real MP4 videos. <br /> Scale your- video production using server-side rendering and parametrization.- </p>+ <WriteInReact></WriteInReact><br /><br /><br />diff --git a/packages/docs/static/img/mp4.png b/packages/docs/static/img/mp4.pngindex 77db1fc8a6..2d36a37e67 100644Binary files a/packages/docs/static/img/mp4.png and b/packages/docs/static/img/mp4.png differ