🎥 Make videos programmatically with React
fix format
Jonny Burgerd4f642ecefb8
diff --git a/packages/example/src/Root.tsx b/packages/example/src/Root.tsxindex d42ab5f7d1..a4b3e2058d 100644--- a/packages/example/src/Root.tsx+++ b/packages/example/src/Root.tsx@@ -4,9 +4,9 @@ import {CalculateMetadataFunction,Composition,Folder,- Still,getInputProps,staticFile,+ Still,} from 'remotion';import {z} from 'zod';import {TwentyTwoKHzAudio} from './22KhzAudio';@@ -34,8 +34,8 @@ import {ManyAudio} from './ManyAudio';import {HandleAudioRenderError} from './MediaErrorHandling/HandleAudioRenderError';import {MissingImg} from './MissingImg';import {- OffthreadRemoteVideo,calculateMetadataFn,+ OffthreadRemoteVideo,} from './OffthreadRemoteVideo/OffthreadRemoteVideo';import {OrbScene} from './Orb';import {ShapesMorph} from './Paths/ShapesMorph';@@ -49,8 +49,8 @@ import RiveVehicle from './Rive/RiveExample';import {ScalePath} from './ScalePath';import {ArrayTest,- SchemaTest,schemaArrayTestSchema,+ SchemaTest,schemaTestSchema,} from './SchemaTest';import {Scripts} from './Scripts';@@ -76,6 +76,7 @@ import {} from './StudioApis/SaveDefaultProps';import {TriggerCalculateMetadata} from './StudioApis/TriggerCalculateMetadata';import {WriteStaticFile} from './StudioApis/WriteStaticFile';+import './style.css';import {SubtitleArtifact} from './SubtitleArtifact/SubtitleArtifact';import {Tailwind} from './Tailwind';import {TenFrameTester} from './TenFrameTester';@@ -93,7 +94,6 @@ import {VideoSpeed} from './VideoSpeed';import {VideoTesting} from './VideoTesting';import {WarpDemoOuter} from './WarpText';import {WarpDemo2} from './WarpText/demo2';-import './style.css';import {WatchStaticDemo} from './watch-static';if (alias !== 'alias') {@@ -104,7 +104,7 @@ const INCLUDE_COMP_BREAKING_GET_COMPOSITIONS = false;// @ts-expect-error no typesimport styles from './styles.module.scss';-import { ThreeHtml } from './ThreeHtml/ThreeHtml';+import {ThreeHtml} from './ThreeHtml/ThreeHtml';class Vector2 {readonly x: number;diff --git a/packages/example/src/ThreeHtml/ThreeHtml.tsx b/packages/example/src/ThreeHtml/ThreeHtml.tsxindex 8cc1eaae2c..8450c8b64d 100644--- a/packages/example/src/ThreeHtml/ThreeHtml.tsx+++ b/packages/example/src/ThreeHtml/ThreeHtml.tsx@@ -2,60 +2,60 @@ import {Html} from '@react-three/drei';import {ThreeCanvas} from '@remotion/three';import React, {useRef} from 'react';import {- Internals,- interpolate,- useCurrentFrame,- useVideoConfig,+ Internals,+ interpolate,+ useCurrentFrame,+ useVideoConfig,} from 'remotion';const Content = () => {- return <h1>{useCurrentFrame()}</h1>;+ return <h1>{useCurrentFrame()}</h1>;};const Box: React.FC<{- portalTarget: React.MutableRefObject<HTMLDivElement>;+ portalTarget: React.MutableRefObject<HTMLDivElement>;}> = ({portalTarget}) => {- const frame = useCurrentFrame();- const rotation = interpolate(frame, [0, 1_000], [0, -5], {- extrapolateRight: 'clamp',- extrapolateLeft: 'clamp',- });-- const contexts = Internals.useRemotionContexts();-- return (- <group position={[0, 0.05, -0.75]} rotation={[0, rotation, 0]}>- <mesh position={[0, 0.05, -0.7]}>- <boxGeometry args={[2, 2, 0.1]} />- <meshStandardMaterial color="#f00" />-- <Html transform portal={portalTarget}>- <Internals.RemotionContextProvider contexts={contexts}>- <Content />- </Internals.RemotionContextProvider>- </Html>- </mesh>- </group>- );+ const frame = useCurrentFrame();+ const rotation = interpolate(frame, [0, 1_000], [0, -5], {+ extrapolateRight: 'clamp',+ extrapolateLeft: 'clamp',+ });++ const contexts = Internals.useRemotionContexts();++ return (+ <group position={[0, 0.05, -0.75]} rotation={[0, rotation, 0]}>+ <mesh position={[0, 0.05, -0.7]}>+ <boxGeometry args={[2, 2, 0.1]} />+ <meshStandardMaterial color="#f00" />++ <Html transform portal={portalTarget}>+ <Internals.RemotionContextProvider contexts={contexts}>+ <Content />+ </Internals.RemotionContextProvider>+ </Html>+ </mesh>+ </group>+ );};export const ThreeHtml = () => {- const portalRef =- useRef<HTMLDivElement>() as React.MutableRefObject<HTMLDivElement>;-- const {width, height} = useVideoConfig();-- return (- <div style={{background: 'rgba(0, 0, 0, 0.5)'}}>- <div ref={portalRef} data-portal />- <ThreeCanvas- camera={{position: [0, 2, 5], fov: 50}}- width={width}- height={height}- >- <pointLight position={[10, 10, 10]} />- <Box portalTarget={portalRef} />- </ThreeCanvas>- </div>- );+ const portalRef =+ useRef<HTMLDivElement>() as React.MutableRefObject<HTMLDivElement>;++ const {width, height} = useVideoConfig();++ return (+ <div style={{background: 'rgba(0, 0, 0, 0.5)'}}>+ <div ref={portalRef} data-portal />+ <ThreeCanvas+ camera={{position: [0, 2, 5], fov: 50}}+ width={width}+ height={height}+ >+ <pointLight position={[10, 10, 10]} />+ <Box portalTarget={portalRef} />+ </ThreeCanvas>+ </div>+ );};