🎥 Make videos programmatically with React
fix sequence not showing
Jonny Burger64aa005d0680
diff --git a/packages/example/src/ThreeBasic/index.tsx b/packages/example/src/ThreeBasic/index.tsxindex e0ea0af624..7d98115c52 100644--- a/packages/example/src/ThreeBasic/index.tsx+++ b/packages/example/src/ThreeBasic/index.tsx@@ -1,35 +1,39 @@+import {RemotionThreeCanvas, ThreeVideo} from '@remotion/three';import React from 'react';-import { useCurrentFrame } from 'remotion';-import { RemotionThreeCanvas, ThreeVideo } from '@remotion/three';+import {Sequence, useCurrentFrame} from 'remotion';-const videoSrc = 'http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4';+const videoSrc =+ 'http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4';const ThreeBasic = (): React.ReactElement => {const frame = useCurrentFrame();return (- <div style={{ display: 'flex', width: '100%' }}>+ <div style={{display: 'flex', width: '100%'}}><RemotionThreeCanvasorthographic={false}- camera={{ fov: 75, position: [0, 0, 470] }}+ camera={{fov: 75, position: [0, 0, 470]}}><ambientLight intensity={0.15} /><pointLight args={[undefined, 0.4]} position={[200, 200, 0]} /><ThreeVideo ignoreDepth fullViewport src={videoSrc} startFrom={460} />- {/* TODO: Using Sequence directly here still crashes for some reason */}- {/* <Sequence- layout='none'- from={-460}+ <SequenceshowInTimeline={false}- durationInFrames={Number.POSITIVE_INFINITY}+ layout="none"+ from={-460}+ durationInFrames={Infinity}><ThreeVideo ignoreDepth src={videoSrc} />- </Sequence> */}+ </Sequence><meshposition={[-300, -200, 0]}- rotation={[frame * 0.06 * 0.5, frame * 0.07 * 0.5, frame * 0.08 * 0.5]}+ rotation={[+ frame * 0.06 * 0.5,+ frame * 0.07 * 0.5,+ frame * 0.08 * 0.5,+ ]}><boxGeometry args={[100, 100, 100]} /><meshStandardMaterial@@ -43,10 +47,14 @@ const ThreeBasic = (): React.ReactElement => {<meshposition={[300, -200, 0]}- rotation={[frame * 0.06 * 0.5, frame * 0.07 * 0.5, frame * 0.08 * 0.5]}+ rotation={[+ frame * 0.06 * 0.5,+ frame * 0.07 * 0.5,+ frame * 0.08 * 0.5,+ ]}><cylinderGeometry args={[50, 50, 180, 24]} />- <meshStandardMaterial color='red' />+ <meshStandardMaterial color="red" /></mesh></RemotionThreeCanvas></div>diff --git a/packages/three/src/RemotionThreeCanvas.tsx b/packages/three/src/RemotionThreeCanvas.tsxindex 8531456554..46afaea30b 100644--- a/packages/three/src/RemotionThreeCanvas.tsx+++ b/packages/three/src/RemotionThreeCanvas.tsx@@ -99,6 +99,9 @@ function useCreateRemotionThreeContext() {document.createElement('div'))[0];React.useEffect(() => {+ if (!portalRef.current) {+ return;+ }(portalRef.current as HTMLDivElement).appendChild(containerNode);return () => {ReactDOM.unmountComponentAtNode(containerNode);