Skip to content

🎥 Make videos programmatically with React

1.3 KB
Raw Blame
import {Video} from '@remotion/media';
import {
	Easing,
	Interactive,
	interpolate,
	useCurrentFrame,
	useVideoConfig,
} from 'remotion';
import {assetUrl} from './assets';
import type {EndCardPlatform} from './EndCard';
import {EndCard} from './EndCard';

export const Scene11: React.FC<{platform: EndCardPlatform}> = ({platform}) => {
	const frame = useCurrentFrame();
	const {fps} = useVideoConfig();

	return (
		<>
			<Video
				name="Presenter video"
				style={{
					translate: interpolate(
						frame,
						[16.73 * fps, 17.73 * fps],
						['0% 0px', '-20% 0px'],
						{
							easing: Easing.out(Easing.cubic),
							extrapolateLeft: 'clamp',
							extrapolateRight: 'clamp',
						},
					),
				}}
				src={assetUrl('whats11.mov')}
				trimBefore={98}
				trimAfter={840}
			/>
			<Interactive.Div
				name="End card panel"
				style={{
					backgroundColor: 'white',
					bottom: 0,
					left: '60%',
					overflow: 'hidden',
					position: 'absolute',
					top: 0,
					translate: interpolate(
						frame,
						[16.73 * fps, 17.73 * fps],
						['102% 0px', '0% 0px'],
						{
							easing: Easing.out(Easing.cubic),
							extrapolateLeft: 'clamp',
							extrapolateRight: 'clamp',
						},
					),
					width: '40%',
				}}
			>
				<EndCard platform={platform} />
			</Interactive.Div>
		</>
	);
};