Skip to content

🎥 Make videos programmatically with React

use translateX instead of left

jeetiss594d68b3b72c
diff --git a/packages/cli/src/editor/components/TimelineSlider.tsx b/packages/cli/src/editor/components/TimelineSlider.tsx
index ca5177ae1e..ddc6cdd0c0 100644
--- a/packages/cli/src/editor/components/TimelineSlider.tsx
+++ b/packages/cli/src/editor/components/TimelineSlider.tsx
@@ -1,4 +1,4 @@
-import React, {useMemo} from 'react';
+import React from 'react';
import {Internals} from 'remotion';
import styled from 'styled-components';
import {
@@ -25,27 +25,16 @@ export const TimelineSlider: React.FC = () => {
const videoConfig = Internals.useUnsafeVideoConfig();
const {width} = useWindowSize();
- const left = useMemo(() => {
- if (!videoConfig) {
- return 0;
- }
- return (
- (timelinePosition / videoConfig.durationInFrames) *
- (width - TIMELINE_LEFT_PADDING - TIMELINE_RIGHT_PADDING - 1) +
- TIMELINE_LEFT_PADDING
- );
- }, [timelinePosition, videoConfig, width]);
-
if (!videoConfig) {
return null;
}
+ const left =
+ (timelinePosition / videoConfig.durationInFrames) *
+ (width - TIMELINE_LEFT_PADDING - TIMELINE_RIGHT_PADDING - 1);
+
return (
- <Container
- style={{
- left,
- }}
- >
+ <Container style={{transform: `translateX(${left}px)`}}>
<Line>
<TimelineSliderHandle />
</Line>