🎥 Make videos programmatically with React
new timeline
Jonny Burger433d4f4c59a1
diff --git a/packages/studio/src/components/Timeline/TimelineListItem.tsx b/packages/studio/src/components/Timeline/TimelineListItem.tsxindex 70d86c257c..8daccc7332 100644--- a/packages/studio/src/components/Timeline/TimelineListItem.tsx+++ b/packages/studio/src/components/Timeline/TimelineListItem.tsx@@ -10,7 +10,6 @@ import {useZIndex} from '../../state/z-index';import {Spacing} from '../layout';import type {TimelineActionState} from './timeline-state-reducer';import {TimelineCollapseToggle} from './TimelineCollapseToggle';-import {TimelineSequenceFrame} from './TimelineSequenceFrame';const HOOK_WIDTH = 7;const BORDER_BOTTOM_LEFT_RADIUS = 2;@@ -161,10 +160,6 @@ export const TimelineListItem: React.FC<{) : null}<div title={text || 'Untitled'} style={textStyle}>{text || 'Untitled'}- <TimelineSequenceFrame- duration={sequence.duration}- from={sequence.from}- /></div><Spacing x={1} /></div>diff --git a/packages/studio/src/components/Timeline/TimelineSequence.tsx b/packages/studio/src/components/Timeline/TimelineSequence.tsxindex a7626cab95..d47ce43e71 100644--- a/packages/studio/src/components/Timeline/TimelineSequence.tsx+++ b/packages/studio/src/components/Timeline/TimelineSequence.tsx@@ -9,6 +9,7 @@ import {import {TIMELINE_LAYER_HEIGHT} from '../../helpers/timeline-layout';import {AudioWaveform} from '../AudioWaveform';import {LoopedTimelineIndicator} from './LoopedTimelineIndicators';+import {TimelineSequenceFrame} from './TimelineSequenceFrame';import {TimelineVideoInfo} from './TimelineVideoInfo';import {TimelineWidthContext} from './TimelineWidthProvider';@@ -64,7 +65,7 @@ const Inner: React.FC<{? VIDEO_GRADIENT: BLUE,border: SEQUENCE_BORDER_WIDTH + 'px solid rgba(255, 255, 255, 0.2)',- borderRadius: 4,+ borderRadius: 2,position: 'absolute',height: TIMELINE_LAYER_HEIGHT,marginTop: 1,@@ -93,6 +94,20 @@ const Inner: React.FC<{{s.loopDisplay === undefined ? null : (<LoopedTimelineIndicator loops={s.loopDisplay.numberOfTimes} />)}+ {s.type !== 'audio' &&+ s.type !== 'video' &&+ s.loopDisplay === undefined ? (+ <div+ style={{+ paddingLeft: 5,+ height: '100%',+ display: 'flex',+ alignItems: 'center',+ }}+ >+ <TimelineSequenceFrame from={s.from} duration={s.duration} />+ </div>+ ) : null}</div>);};diff --git a/packages/studio/src/components/Timeline/TimelineSequenceFrame.tsx b/packages/studio/src/components/Timeline/TimelineSequenceFrame.tsxindex 91de51512b..d33c008960 100644--- a/packages/studio/src/components/Timeline/TimelineSequenceFrame.tsx+++ b/packages/studio/src/components/Timeline/TimelineSequenceFrame.tsx@@ -1,14 +1,11 @@import React from 'react';-import {useCurrentFrame, useVideoConfig} from 'remotion';-import {renderFrame} from '../../state/render-frame';+import {useCurrentFrame} from 'remotion';const relativeFrameStyle: React.CSSProperties = {- fontSize: 12,+ fontSize: 11,fontFamily: 'Arial, Helvetica, sans-serif',color: 'white',- opacity: 0.6,- marginTop: 2,- cursor: 'help',+ opacity: 0.5,};export const TimelineSequenceFrame: React.FC<{@@ -16,7 +13,6 @@ export const TimelineSequenceFrame: React.FC<{duration: number;}> = ({from, duration}) => {const frame = useCurrentFrame();- const {fps} = useVideoConfig();const relativeFrame = frame - from;const roundedFrame = Math.round(relativeFrame * 100) / 100;@@ -27,18 +23,5 @@ export const TimelineSequenceFrame: React.FC<{return null;}- return (- <div- title={`-The current time within the sequence.--Call \`useCurrentFrame()\` within the sequence to get the time programmatically.--Call \`const {durationInFrames} = useVideoConfig()\` to get the duration of the sequence.-`.trim()}- style={relativeFrameStyle}- >- {renderFrame(relativeFrame, fps)} ({roundedFrame})- </div>- );+ return <div style={relativeFrameStyle}>{roundedFrame}</div>;};diff --git a/packages/studio/src/helpers/timeline-layout.ts b/packages/studio/src/helpers/timeline-layout.tsindex 745b39c6f8..da79bdd658 100644--- a/packages/studio/src/helpers/timeline-layout.ts+++ b/packages/studio/src/helpers/timeline-layout.ts@@ -1,3 +1,3 @@export const TIMELINE_PADDING = 16;-export const TIMELINE_LAYER_HEIGHT = 40;+export const TIMELINE_LAYER_HEIGHT = 25;export const TIMELINE_BORDER = 1;