Skip to content

🎥 Make videos programmatically with React

video

Jonny Burger2781a1a0d163
diff --git a/packages/docs/components/LandingPage/FreePricing.tsx b/packages/docs/components/LandingPage/FreePricing.tsx
index d5bfabcf81..8146648e8b 100644
--- a/packages/docs/components/LandingPage/FreePricing.tsx
+++ b/packages/docs/components/LandingPage/FreePricing.tsx
@@ -16,11 +16,19 @@ const Title = styled.h2`
line-height: 1.1;
`;
+const Mp4 = styled.span`
+ background: linear-gradient(to right, rgb(66, 144, 245), rgb(66, 233, 245));
+ -webkit-text-fill-color: transparent;
+ -webkit-background-clip: text;
+`;
+
export const FreePricing: React.FC = () => {
return (
<Row>
<div>
- <Title>Funded by companies</Title>
+ <Title>
+ <Mp4>Free</Mp4> for individuals <br /> Funded by companies
+ </Title>
<p>
Remotion is free for individuals - you can even build a business on
it! <br />
diff --git a/packages/docs/components/LandingPage/editor.tsx b/packages/docs/components/LandingPage/editor.tsx
index 1296b2c226..7684ad3eac 100644
--- a/packages/docs/components/LandingPage/editor.tsx
+++ b/packages/docs/components/LandingPage/editor.tsx
@@ -1,11 +1,12 @@
-import React from "react";
-import styled from "styled-components";
+import React, { useCallback, useEffect, useRef, useState } from "react";
+import styled, { keyframes } from "styled-components";
const Row = styled.div`
display: flex;
flex-direction: row;
justify-content: flex-end;
text-align: right;
+ align-items: center;
`;
const Title = styled.h2`
@@ -23,12 +24,65 @@ const Mp4 = styled.span`
-webkit-background-clip: text;
`;
+const animation = keyframes`
+ from {
+ opacity: 0;
+ }
+ to {
+ opacity: 1;
+ }
+`;
+const Video = styled.video<{
+ playing: boolean;
+}>`
+ animation: ${animation} 0.6s;
+ animation-play-state: ${(props) => (props.playing ? "running" : "paused")};
+`;
+
export const LightningFastEditor: React.FC = () => {
+ const ref = useRef<HTMLDivElement>(null);
+ const videoRef = useRef<HTMLVideoElement>(null);
+ const [isIntersecting, setIsIntersecting] = useState(false);
+
+ const callback: IntersectionObserverCallback = useCallback((data) => {
+ const { isIntersecting } = data[0];
+ setIsIntersecting(isIntersecting);
+ if (isIntersecting) {
+ videoRef.current?.play();
+ } else {
+ videoRef.current?.pause();
+ }
+ }, []);
+
+ useEffect(() => {
+ const { current } = ref;
+ if (!current) {
+ return;
+ }
+ const observer = new IntersectionObserver(callback, {
+ root: null,
+ threshold: 0.2,
+ });
+ observer.observe(current);
+
+ return () => observer.unobserve(current);
+ }, []);
return (
- <Row>
+ <Row ref={ref}>
<div>
+ <Video
+ src="/img/player-demo.mp4"
+ autoPlay
+ muted
+ playsInline
+ playing={isIntersecting}
+ loop
+ style={{ width: 500, borderRadius: 4, overflow: "hidden" }}
+ ></Video>
+ </div>
+ <div style={{ flex: 1 }}>
<Title>
- Fast and <br /> delightful editing
+ Fast and <br /> <Mp4>delightful</Mp4> editing
</Title>
<p>
Preview your video in the browser. <br />
diff --git a/packages/docs/components/LandingPage/parametrize.tsx b/packages/docs/components/LandingPage/parametrize.tsx
index e0471dedeb..7c8f38cfdd 100644
--- a/packages/docs/components/LandingPage/parametrize.tsx
+++ b/packages/docs/components/LandingPage/parametrize.tsx
@@ -16,12 +16,18 @@ const Title = styled.h2`
text-align: left;
`;
+const Mp4 = styled.span`
+ background: linear-gradient(to right, rgb(66, 144, 245), rgb(66, 233, 245));
+ -webkit-text-fill-color: transparent;
+ -webkit-background-clip: text;
+`;
+
export const Parametrize: React.FC = () => {
return (
<Row>
<div>
<Title>
- Programmatic content <br />
+ <Mp4>Programmatic</Mp4> content <br />
and rendering
</Title>
<p>