Skip to content

🎥 Make videos programmatically with React

4.8 KB
Raw Blame
import {MacOSCursor} from '@remotion/mac-cursors';
import {Video} from '@remotion/media';
import {
	AbsoluteFill,
	Composition,
	Easing,
	interpolate,
	useCurrentFrame,
} from 'remotion';

export const QuickSwitcherPreview = () => {
	const frame = useCurrentFrame();

	return (
		<AbsoluteFill
			name="Canvas Capture"
			style={{
				width: 2538,
				height: 2512,
				translate: '-310.8px -981.8px',
				scale: 1.112,
				rotate: '0.579193 0.794678 -0.181719 38.86285deg',
			}}
		>
			<Video
				src="https://remotion.media/studio-close-ups/quick-switcher-2026-09-22.mp4"
				style={{
					position: 'absolute',
				}}
			/>
			<MacOSCursor
				cursor={'auto'}
				style={{
					position: 'absolute',
					left: 0,
					top: 0,
					scale: interpolate(
						frame,
						[0, 383, 390],
						[4.2, 3.7800000000000002, 4.2],
						{
							easing: Easing.step1,
							extrapolateLeft: 'clamp',
							extrapolateRight: 'clamp',
						},
					),
					translate: interpolate(
						frame,
						[
							4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
							22, 23, 24, 25, 26, 27, 330, 331, 332, 333, 334, 335, 336, 337,
							338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350,
							351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363,
							364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376,
							377, 378,
						],
						[
							'1253.09296875px 3957.0398437500003px',
							'1256.9320312500001px 3957.0398437500003px',
							'1263.29765625px 3957.0398437500003px',
							'1310.465625px 3951.01875px',
							'1369.51171875px 3939.8625px',
							'1504.37109375px 3895.6804687500003px',
							'1678.8187500000001px 3821.5242187500003px',
							'1788.8390625000002px 3761.93671875px',
							'1961.1703125000001px 3671.37421875px',
							'2109.26953125px 3604.8304687500004px',
							'2278.6640625px 3527.2781250000003px',
							'2386.99453125px 3474.33515625px',
							'2437.509375px 3443.8031250000004px',
							'2489.43515625px 3411.9421875000003px',
							'2549.728125px 3386.5945312500003px',
							'2624.5242187500003px 3365.3484375000003px',
							'2740.28671875px 3343.4460937500003px',
							'2840.446875px 3321.5765625000004px',
							'2870.6671875px 3312.159375px',
							'2931.3210937500003px 3290.2734375px',
							'2992.5984375000003px 3273.3093750000003px',
							'3070.24921875px 3253.7203125px',
							'3116.51484375px 3243.4828125000004px',
							'3131.87109375px 3240.64453125px',
							'3131.87109375px 3240.64453125px',
							'3080.68359375px 3272.259375px',
							'3060.66796875px 3284.6953125px',
							'3014.0578125px 3312.24140625px',
							'2958.68671875px 3352.0265625px',
							'2904.365625px 3398.80078125px',
							'2904.365625px 3398.80078125px',
							'2782.4671875px 3492.15234375px',
							'2712.59296875px 3532.6921875000003px',
							'2712.59296875px 3532.6921875000003px',
							'2655.40078125px 3561.3046875px',
							'2611.8914062500003px 3580.5328125px',
							'2573.96015625px 3593.44453125px',
							'2544.72421875px 3599.94140625px',
							'2515.12734375px 3602.89453125px',
							'2465.1375000000003px 3603.09140625px',
							'2438.1492187500003px 3604.5515625000003px',
							'2402.08828125px 3606.0281250000003px',
							'2354.5921875px 3609.76875px',
							'2264.8992187500003px 3622.7296875px',
							'2127.34921875px 3649.14375px',
							'1964.5500000000002px 3683.8921875px',
							'1836.1546875000001px 3713.9812500000003px',
							'1728.5625px 3736.425px',
							'1620.7734375px 3760.05px',
							'1562.8265625000001px 3778.6218750000003px',
							'1507.66875px 3798.7523437500004px',
							'1475.4632812500001px 3809.3015625000003px',
							'1452.06796875px 3816.1101562500003px',
							'1443.9796875px 3819.703125px',
							'1430.44453125px 3828.0046875000003px',
							'1419.665625px 3835.5515625000003px',
							'1408.8046875px 3842.8851562500004px',
							'1393.03828125px 3855.0750000000003px',
							'1384.44140625px 3861.4242187500004px',
							'1376.79609375px 3866.8875000000003px',
							'1368.62578125px 3871.9078125px',
							'1357.65px 3880.40625px',
							'1344.328125px 3892.00546875px',
							'1333.08984375px 3901.2585937500003px',
							'1322.03203125px 3910.08515625px',
							'1310.64609375px 3919.89609375px',
							'1302.18046875px 3927.60703125px',
							'1291.5328125px 3936.909375px',
							'1283.47734375px 3944.7515625px',
							'1280.68828125px 3949.3617187500004px',
							'1277.5875px 3955.53046875px',
							'1276.19296875px 3958.696875px',
							'1276.1273437500001px 3958.8609375px',
						],
						{
							extrapolateLeft: 'clamp',
							extrapolateRight: 'clamp',
						},
					),
				}}
			/>
		</AbsoluteFill>
	);
};

export const QuickSwitcher = () => {
	return (
		<Composition
			id="QuickSwitcher"
			component={QuickSwitcherPreview}
			width={1920}
			height={1080}
			fps={60}
			durationInFrames={419}
		/>
	);
};