Skip to content

🎥 Make videos programmatically with React

fix timeline elements

Jonny Burger5af2e7cb7401
diff --git a/packages/cli/src/editor/components/TimelineElements.tsx b/packages/cli/src/editor/components/TimelineElements.tsx
index 2950d6d25f..adecd7a000 100644
--- a/packages/cli/src/editor/components/TimelineElements.tsx
+++ b/packages/cli/src/editor/components/TimelineElements.tsx
@@ -29,6 +29,10 @@ export const TimelineElements: React.FC = () => {
return calculateTimeline(sequences, videoConfig.durationInFrames);
}, [sequences, videoConfig]);
+ // If a composition is 100 frames long, the last frame is 99
+ // and therefore frame 99 should be at the right
+ const lastFrame = (videoConfig?.durationInFrames ?? 1) - 1;
+
return (
<div
style={{
@@ -47,6 +51,8 @@ export const TimelineElements: React.FC = () => {
}}
>
{track.sequences.map((s) => {
+ // If a duration is 1, it is essentially a still and it should have width 0
+ const spatialDuration = s.sequence.duration - 1;
return (
<div
key={s.sequence.id}
@@ -59,16 +65,12 @@ export const TimelineElements: React.FC = () => {
height: 80,
marginTop: 1,
marginLeft: `calc(${
- (s.sequence.from / videoConfig.durationInFrames) * 100
+ (s.sequence.from / lastFrame) * 100
}%)`,
width:
s.sequence.duration === Infinity
? width
- : `calc(${
- (s.sequence.duration /
- videoConfig.durationInFrames) *
- 100
- }%)`,
+ : `calc(${(spatialDuration / lastFrame) * 100}%)`,
color: 'white',
overflow: 'hidden',
}}
diff --git a/packages/core/src/feature-flags.ts b/packages/core/src/feature-flags.ts
index 61acaf6695..3c5c78555b 100644
--- a/packages/core/src/feature-flags.ts
+++ b/packages/core/src/feature-flags.ts
@@ -3,7 +3,8 @@
// Disabling this for now!
export const FEATURE_FLAG_FIREFOX_SUPPORT = false;
-// Enable this to enter V2 mode and enable breaking changes
+// Disable this to enter V1 mode and disable breaking changes
+// Needed if making future 1.x releases
// See here https://github.com/JonnyBurger/remotion/issues/185 what
-// those will be
-export const FEATURE_FLAG_V2_BREAKING_CHANGES = false;
+// the breaking changes are
+export const FEATURE_FLAG_V2_BREAKING_CHANGES = true;