Skip to content

🎥 Make videos programmatically with React

946 B
Raw Blame
import {starburst} from '@remotion/effects/starburst';
import React from 'react';
import {CanvasImage} from 'remotion';
import {EFFECTS_PREVIEW_IMAGE_SRC} from './effects-preview-image';

const fullSize: React.CSSProperties = {
	width: '100%',
	height: '100%',
};

export const STARBURST_PREVIEW_PARAMS = {
	rays: 16,
	colors: ['#dff4ff', '#7cc6ff'],
	rotation: 0,
	smoothness: 0,
	origin: [0.5, 0.5] as const,
} as const;

export const EffectsStarburstPreview: React.FC<{
	readonly rays: number;
	readonly colors: readonly string[];
	readonly rotation: number;
	readonly smoothness: number;
	readonly origin: readonly [number, number];
}> = ({rays, colors, rotation, smoothness, origin}) => {
	return (
		<CanvasImage
			src={EFFECTS_PREVIEW_IMAGE_SRC}
			width={1280}
			height={720}
			fit="cover"
			style={fullSize}
			effects={[
				starburst({
					rays,
					colors,
					rotation,
					smoothness,
					origin,
				}),
			]}
		/>
	);
};