Skip to content

🎥 Make videos programmatically with React

cool and interesting

Jonny Burgerbd4c10d4d36e
diff --git a/packages/docs/components/demos/Heart.tsx b/packages/docs/components/demos/Heart.tsx
index 1bfc67f716..72bab2f70b 100644
--- a/packages/docs/components/demos/Heart.tsx
+++ b/packages/docs/components/demos/Heart.tsx
@@ -1,22 +1,25 @@
-import { Heart } from "@remotion/shapes";
-import React from "react";
-import { AbsoluteFill } from "remotion";
+import {Heart} from '@remotion/shapes';
+import React from 'react';
+import {AbsoluteFill} from 'remotion';
export const HeartDemo: React.FC<{
- readonly darkMode: boolean;
- readonly size: number;
-}> = ({ size, darkMode }) => {
- return (
- <AbsoluteFill
- style={{
- justifyContent: "center",
- alignItems: "center",
- }}
- >
- <Heart
- fill={darkMode ? "white" : "var(--ifm-link-color)"}
- size={size}
- />
- </AbsoluteFill>
- );
-};
\ No newline at end of file
+ readonly darkMode: boolean;
+ readonly width: number;
+ readonly height: number;
+}> = ({width, height, darkMode}) => {
+ return (
+ <AbsoluteFill
+ style={{
+ justifyContent: 'center',
+ alignItems: 'center',
+ }}
+ >
+ <Heart
+ fill={darkMode ? 'white' : 'var(--ifm-link-color)'}
+ width={width}
+ height={height}
+ debug
+ />
+ </AbsoluteFill>
+ );
+};
diff --git a/packages/docs/components/demos/types.ts b/packages/docs/components/demos/types.ts
index f60492eeab..c6ae9ec6b4 100644
--- a/packages/docs/components/demos/types.ts
+++ b/packages/docs/components/demos/types.ts
@@ -1,715 +1,724 @@
import {
- ClockWipeDemo,
- CubeDemo,
- CustomTimingDemo,
- CustomTransitionDemo,
- FadeDemo,
- FlipDemo,
- NoneDemo,
- SlideDemo,
- SlideDemoLongDurationRest,
- WipeDemo,
-} from "../transitions/previews";
-import { CircleDemo } from "./Circle";
-import { EllipseDemo } from "./Ellipse";
-import { HeartDemo } from "./Heart";
-import { NoiseComp } from "./NoiseDemo";
-import { PieDemo } from "./Pie";
-import { PolygonDemo } from "./Polygon";
-import { RectDemo } from "./Rect";
-import { StarDemo } from "./Star";
-import { AnimationMath } from "./SubtractAnimations";
+ ClockWipeDemo,
+ CubeDemo,
+ CustomTimingDemo,
+ CustomTransitionDemo,
+ FadeDemo,
+ FlipDemo,
+ NoneDemo,
+ SlideDemo,
+ SlideDemoLongDurationRest,
+ WipeDemo,
+} from '../transitions/previews';
+import {CircleDemo} from './Circle';
+import {EllipseDemo} from './Ellipse';
+import {HeartDemo} from './Heart';
+import {NoiseComp} from './NoiseDemo';
+import {PieDemo} from './Pie';
+import {PolygonDemo} from './Polygon';
+import {RectDemo} from './Rect';
+import {StarDemo} from './Star';
+import {AnimationMath} from './SubtractAnimations';
import {
- OpacityDemo,
- RotateDemo,
- ScaleDemo,
- SkewDemo,
- TranslateDemo,
-} from "./Translate";
-import { TriangleDemo } from "./Triangle";
+ OpacityDemo,
+ RotateDemo,
+ ScaleDemo,
+ SkewDemo,
+ TranslateDemo,
+} from './Translate';
+import {TriangleDemo} from './Triangle';
export type Option = {
- name: string;
- optional: "no" | "default-enabled" | "default-disabled";
+ name: string;
+ optional: 'no' | 'default-enabled' | 'default-disabled';
} & (
- | {
- type: "numeric";
- min: number;
- default: number;
- max: number;
- step: number;
- }
- | {
- type: "boolean";
- default: boolean;
- }
- | {
- type: "enum";
- default: string;
- values: string[];
- }
+ | {
+ type: 'numeric';
+ min: number;
+ default: number;
+ max: number;
+ step: number;
+ }
+ | {
+ type: 'boolean';
+ default: boolean;
+ }
+ | {
+ type: 'enum';
+ default: string;
+ values: string[];
+ }
);
export type DemoType = {
- id: string;
- comp: React.FC;
- compWidth: number;
- compHeight: number;
- fps: number;
- durationInFrames: number;
- options: Option[];
- autoPlay: boolean;
+ id: string;
+ comp: React.FC;
+ compWidth: number;
+ compHeight: number;
+ fps: number;
+ durationInFrames: number;
+ options: Option[];
+ autoPlay: boolean;
};
export const rectDemo: DemoType = {
- comp: RectDemo,
- compWidth: 1280,
- compHeight: 400,
- durationInFrames: 150,
- fps: 30,
- id: "rect",
- autoPlay: false,
- options: [
- {
- default: 200,
- max: 1000,
- step: 5,
- min: 1,
- type: "numeric",
- name: "width",
- optional: "no",
- },
- {
- default: 200,
- max: 1000,
- step: 5,
- min: 1,
- type: "numeric",
- name: "height",
- optional: "no",
- },
- {
- name: "cornerRadius",
- default: 0,
- max: 100,
- min: 0,
- step: 1,
- type: "numeric",
- optional: "no",
- },
- {
- name: "edgeRoundness",
- default: 1,
- max: 2,
- min: -2,
- step: 0.01,
- type: "numeric",
- optional: "default-disabled",
- },
- {
- name: "debug",
- type: "boolean",
- optional: "no",
- default: false,
- },
- ],
+ comp: RectDemo,
+ compWidth: 1280,
+ compHeight: 400,
+ durationInFrames: 150,
+ fps: 30,
+ id: 'rect',
+ autoPlay: false,
+ options: [
+ {
+ default: 200,
+ max: 1000,
+ step: 5,
+ min: 1,
+ type: 'numeric',
+ name: 'width',
+ optional: 'no',
+ },
+ {
+ default: 200,
+ max: 1000,
+ step: 5,
+ min: 1,
+ type: 'numeric',
+ name: 'height',
+ optional: 'no',
+ },
+ {
+ name: 'cornerRadius',
+ default: 0,
+ max: 100,
+ min: 0,
+ step: 1,
+ type: 'numeric',
+ optional: 'no',
+ },
+ {
+ name: 'edgeRoundness',
+ default: 1,
+ max: 2,
+ min: -2,
+ step: 0.01,
+ type: 'numeric',
+ optional: 'default-disabled',
+ },
+ {
+ name: 'debug',
+ type: 'boolean',
+ optional: 'no',
+ default: false,
+ },
+ ],
};
export const triangleDemo: DemoType = {
- comp: TriangleDemo,
- compWidth: 1280,
- compHeight: 400,
- durationInFrames: 150,
- fps: 30,
- id: "triangle",
- autoPlay: false,
- options: [
- {
- default: 200,
- max: 1000,
- step: 5,
- min: 1,
- type: "numeric",
- name: "length",
- optional: "no",
- },
- {
- name: "edgeRoundness",
- default: 1,
- max: 2,
- min: -2,
- step: 0.01,
- type: "numeric",
- optional: "default-disabled",
- },
- {
- name: "cornerRadius",
- default: 0,
- max: 100,
- min: 0,
- step: 1,
- type: "numeric",
- optional: "no",
- },
- {
- name: "direction",
- type: "enum",
- default: "up",
- values: ["up", "down", "left", "right"],
- optional: "no",
- },
- {
- name: "debug",
- type: "boolean",
- optional: "no",
- default: false,
- },
- ],
+ comp: TriangleDemo,
+ compWidth: 1280,
+ compHeight: 400,
+ durationInFrames: 150,
+ fps: 30,
+ id: 'triangle',
+ autoPlay: false,
+ options: [
+ {
+ default: 200,
+ max: 1000,
+ step: 5,
+ min: 1,
+ type: 'numeric',
+ name: 'length',
+ optional: 'no',
+ },
+ {
+ name: 'edgeRoundness',
+ default: 1,
+ max: 2,
+ min: -2,
+ step: 0.01,
+ type: 'numeric',
+ optional: 'default-disabled',
+ },
+ {
+ name: 'cornerRadius',
+ default: 0,
+ max: 100,
+ min: 0,
+ step: 1,
+ type: 'numeric',
+ optional: 'no',
+ },
+ {
+ name: 'direction',
+ type: 'enum',
+ default: 'up',
+ values: ['up', 'down', 'left', 'right'],
+ optional: 'no',
+ },
+ {
+ name: 'debug',
+ type: 'boolean',
+ optional: 'no',
+ default: false,
+ },
+ ],
};
export const circleDemo: DemoType = {
- comp: CircleDemo,
- compHeight: 720,
- compWidth: 1280,
- durationInFrames: 150,
- fps: 30,
- id: "circle",
- autoPlay: false,
- options: [
- {
- default: 200,
- max: 1000,
- step: 5,
- min: 1,
- type: "numeric",
- name: "radius",
- optional: "no",
- },
- ],
+ comp: CircleDemo,
+ compHeight: 720,
+ compWidth: 1280,
+ durationInFrames: 150,
+ fps: 30,
+ id: 'circle',
+ autoPlay: false,
+ options: [
+ {
+ default: 200,
+ max: 1000,
+ step: 5,
+ min: 1,
+ type: 'numeric',
+ name: 'radius',
+ optional: 'no',
+ },
+ ],
};
export const heartDemo: DemoType = {
- comp: HeartDemo,
- compHeight: 720,
- compWidth: 1280,
- durationInFrames: 150,
- fps: 30,
- id: "heart",
- autoPlay: false,
- options: [
- {
- default: 200,
- max: 1000,
- step: 5,
- min: 1,
- type: "numeric",
- name: "size",
- optional: "no",
- },
- ],
+ comp: HeartDemo,
+ compHeight: 720,
+ compWidth: 1280,
+ durationInFrames: 150,
+ fps: 30,
+ id: 'heart',
+ autoPlay: false,
+ options: [
+ {
+ default: 200,
+ max: 1000,
+ step: 5,
+ min: 1,
+ type: 'numeric',
+ name: 'width',
+ optional: 'no',
+ },
+ {
+ default: 200,
+ max: 1000,
+ step: 5,
+ min: 1,
+ type: 'numeric',
+ name: 'height',
+ optional: 'no',
+ },
+ ],
};
export const translateDemo: DemoType = {
- comp: TranslateDemo,
- autoPlay: false,
- compHeight: 400,
- compWidth: 1280,
- durationInFrames: 150,
- fps: 30,
- id: "translate",
- options: [
- {
- default: 0,
- max: 800,
- step: 5,
- min: -800,
- type: "numeric",
- name: "translateX",
- optional: "no",
- },
- {
- default: 0,
- max: 800,
- step: 5,
- min: -800,
- type: "numeric",
- name: "translateY",
- optional: "no",
- },
- ],
+ comp: TranslateDemo,
+ autoPlay: false,
+ compHeight: 400,
+ compWidth: 1280,
+ durationInFrames: 150,
+ fps: 30,
+ id: 'translate',
+ options: [
+ {
+ default: 0,
+ max: 800,
+ step: 5,
+ min: -800,
+ type: 'numeric',
+ name: 'translateX',
+ optional: 'no',
+ },
+ {
+ default: 0,
+ max: 800,
+ step: 5,
+ min: -800,
+ type: 'numeric',
+ name: 'translateY',
+ optional: 'no',
+ },
+ ],
};
export const skewDemo: DemoType = {
- comp: SkewDemo,
- autoPlay: false,
- compHeight: 400,
- compWidth: 1280,
- durationInFrames: 150,
- fps: 30,
- id: "skew",
- options: [
- {
- default: 0,
- max: 180,
- step: 1,
- min: -180,
- type: "numeric",
- name: "skew",
- optional: "no",
- },
- ],
+ comp: SkewDemo,
+ autoPlay: false,
+ compHeight: 400,
+ compWidth: 1280,
+ durationInFrames: 150,
+ fps: 30,
+ id: 'skew',
+ options: [
+ {
+ default: 0,
+ max: 180,
+ step: 1,
+ min: -180,
+ type: 'numeric',
+ name: 'skew',
+ optional: 'no',
+ },
+ ],
};
export const scaleDemo: DemoType = {
- comp: ScaleDemo,
- autoPlay: false,
- compHeight: 400,
- compWidth: 1280,
- durationInFrames: 150,
- fps: 30,
- id: "scale",
- options: [
- {
- default: 1,
- max: 4,
- step: 0.01,
- min: -4,
- type: "numeric",
- name: "scale",
- optional: "no",
- },
- ],
+ comp: ScaleDemo,
+ autoPlay: false,
+ compHeight: 400,
+ compWidth: 1280,
+ durationInFrames: 150,
+ fps: 30,
+ id: 'scale',
+ options: [
+ {
+ default: 1,
+ max: 4,
+ step: 0.01,
+ min: -4,
+ type: 'numeric',
+ name: 'scale',
+ optional: 'no',
+ },
+ ],
};
export const opacityDemo: DemoType = {
- comp: OpacityDemo,
- autoPlay: false,
- compHeight: 400,
- compWidth: 1280,
- durationInFrames: 150,
- fps: 30,
- id: "opacity",
- options: [
- {
- default: 1,
- max: 1,
- step: 0.01,
- min: 0,
- type: "numeric",
- name: "opacity",
- optional: "no",
- },
- ],
+ comp: OpacityDemo,
+ autoPlay: false,
+ compHeight: 400,
+ compWidth: 1280,
+ durationInFrames: 150,
+ fps: 30,
+ id: 'opacity',
+ options: [
+ {
+ default: 1,
+ max: 1,
+ step: 0.01,
+ min: 0,
+ type: 'numeric',
+ name: 'opacity',
+ optional: 'no',
+ },
+ ],
};
export const rotateDemo: DemoType = {
- comp: RotateDemo,
- autoPlay: false,
- compHeight: 400,
- compWidth: 1280,
- durationInFrames: 150,
- fps: 30,
- id: "rotate",
- options: [
- {
- default: 0,
- max: 180,
- step: 1,
- min: -180,
- type: "numeric",
- name: "rotateZ",
- optional: "no",
- },
- ],
+ comp: RotateDemo,
+ autoPlay: false,
+ compHeight: 400,
+ compWidth: 1280,
+ durationInFrames: 150,
+ fps: 30,
+ id: 'rotate',
+ options: [
+ {
+ default: 0,
+ max: 180,
+ step: 1,
+ min: -180,
+ type: 'numeric',
+ name: 'rotateZ',
+ optional: 'no',
+ },
+ ],
};
export const pieDemo: DemoType = {
- comp: PieDemo,
- compHeight: 720,
- compWidth: 1280,
- durationInFrames: 150,
- fps: 30,
- id: "pie",
- autoPlay: false,
- options: [
- {
- default: 200,
- max: 1000,
- step: 5,
- min: 1,
- type: "numeric",
- name: "radius",
- optional: "no",
- },
- {
- default: 0.5,
- step: 0.01,
- min: 0,
- max: 1,
- type: "numeric",
- name: "progress",
- optional: "no",
- },
- {
- default: 0,
- step: 0.01,
- min: -3.14 * 2,
- max: 3.14 * 2,
- type: "numeric",
- name: "rotation",
- optional: "no",
- },
- {
- default: true,
- type: "boolean",
- name: "closePath",
- optional: "no",
- },
- {
- default: false,
- type: "boolean",
- name: "counterClockwise",
- optional: "no",
- },
- {
- default: false,
- type: "boolean",
- name: "showStrokeInsteadPreviewOnly",
- optional: "no",
- },
- ],
+ comp: PieDemo,
+ compHeight: 720,
+ compWidth: 1280,
+ durationInFrames: 150,
+ fps: 30,
+ id: 'pie',
+ autoPlay: false,
+ options: [
+ {
+ default: 200,
+ max: 1000,
+ step: 5,
+ min: 1,
+ type: 'numeric',
+ name: 'radius',
+ optional: 'no',
+ },
+ {
+ default: 0.5,
+ step: 0.01,
+ min: 0,
+ max: 1,
+ type: 'numeric',
+ name: 'progress',
+ optional: 'no',
+ },
+ {
+ default: 0,
+ step: 0.01,
+ min: -3.14 * 2,
+ max: 3.14 * 2,
+ type: 'numeric',
+ name: 'rotation',
+ optional: 'no',
+ },
+ {
+ default: true,
+ type: 'boolean',
+ name: 'closePath',
+ optional: 'no',
+ },
+ {
+ default: false,
+ type: 'boolean',
+ name: 'counterClockwise',
+ optional: 'no',
+ },
+ {
+ default: false,
+ type: 'boolean',
+ name: 'showStrokeInsteadPreviewOnly',
+ optional: 'no',
+ },
+ ],
};
export const ellipseDemo: DemoType = {
- comp: EllipseDemo,
- compHeight: 720,
- compWidth: 1280,
- durationInFrames: 150,
- fps: 30,
- id: "ellipse",
- autoPlay: false,
- options: [
- {
- default: 150,
- max: 1000,
- step: 5,
- min: 1,
- type: "numeric",
- name: "rx",
- optional: "no",
- },
- {
- default: 200,
- max: 1000,
- step: 5,
- min: 1,
- type: "numeric",
- name: "ry",
- optional: "no",
- },
- ],
+ comp: EllipseDemo,
+ compHeight: 720,
+ compWidth: 1280,
+ durationInFrames: 150,
+ fps: 30,
+ id: 'ellipse',
+ autoPlay: false,
+ options: [
+ {
+ default: 150,
+ max: 1000,
+ step: 5,
+ min: 1,
+ type: 'numeric',
+ name: 'rx',
+ optional: 'no',
+ },
+ {
+ default: 200,
+ max: 1000,
+ step: 5,
+ min: 1,
+ type: 'numeric',
+ name: 'ry',
+ optional: 'no',
+ },
+ ],
};
export const polygonDemo: DemoType = {
- comp: PolygonDemo,
- compHeight: 720,
- compWidth: 1280,
- durationInFrames: 150,
- fps: 30,
- id: "polygon",
- autoPlay: false,
- options: [
- {
- default: 3,
- max: 12,
- step: 1,
- min: 3,
- type: "numeric",
- name: "points",
- optional: "no",
- },
- {
- default: 100,
- max: 400,
- step: 5,
- min: 1,
- type: "numeric",
- name: "radius",
- optional: "no",
- },
- {
- name: "cornerRadius",
- default: 0,
- max: 140,
- min: 0,
- step: 1,
- type: "numeric",
- optional: "no",
- },
- {
- name: "edgeRoundness",
- default: 0,
- max: 2,
- min: -2,
- step: 0.01,
- type: "numeric",
- optional: "default-disabled",
- },
- ],
+ comp: PolygonDemo,
+ compHeight: 720,
+ compWidth: 1280,
+ durationInFrames: 150,
+ fps: 30,
+ id: 'polygon',
+ autoPlay: false,
+ options: [
+ {
+ default: 3,
+ max: 12,
+ step: 1,
+ min: 3,
+ type: 'numeric',
+ name: 'points',
+ optional: 'no',
+ },
+ {
+ default: 100,
+ max: 400,
+ step: 5,
+ min: 1,
+ type: 'numeric',
+ name: 'radius',
+ optional: 'no',
+ },
+ {
+ name: 'cornerRadius',
+ default: 0,
+ max: 140,
+ min: 0,
+ step: 1,
+ type: 'numeric',
+ optional: 'no',
+ },
+ {
+ name: 'edgeRoundness',
+ default: 0,
+ max: 2,
+ min: -2,
+ step: 0.01,
+ type: 'numeric',
+ optional: 'default-disabled',
+ },
+ ],
};
export const starDemo: DemoType = {
- comp: StarDemo,
- compHeight: 720,
- compWidth: 1280,
- durationInFrames: 150,
- fps: 30,
- id: "star",
- autoPlay: false,
- options: [
- {
- default: 100,
- max: 400,
- step: 5,
- min: 1,
- type: "numeric",
- name: "innerRadius",
- optional: "no",
- },
- {
- default: 200,
- max: 400,
- step: 5,
- min: 1,
- type: "numeric",
- name: "outerRadius",
- optional: "no",
- },
- {
- name: "edgeRoundness",
- default: 1,
- max: 2,
- min: -2,
- step: 0.01,
- type: "numeric",
- optional: "default-disabled",
- },
- {
- name: "points",
- default: 5,
- max: 50,
- min: 3,
- step: 1,
- type: "numeric",
- optional: "no",
- },
- {
- name: "cornerRadius",
- default: 0,
- max: 200,
- min: 0,
- step: 1,
- type: "numeric",
- optional: "no",
- },
- ],
+ comp: StarDemo,
+ compHeight: 720,
+ compWidth: 1280,
+ durationInFrames: 150,
+ fps: 30,
+ id: 'star',
+ autoPlay: false,
+ options: [
+ {
+ default: 100,
+ max: 400,
+ step: 5,
+ min: 1,
+ type: 'numeric',
+ name: 'innerRadius',
+ optional: 'no',
+ },
+ {
+ default: 200,
+ max: 400,
+ step: 5,
+ min: 1,
+ type: 'numeric',
+ name: 'outerRadius',
+ optional: 'no',
+ },
+ {
+ name: 'edgeRoundness',
+ default: 1,
+ max: 2,
+ min: -2,
+ step: 0.01,
+ type: 'numeric',
+ optional: 'default-disabled',
+ },
+ {
+ name: 'points',
+ default: 5,
+ max: 50,
+ min: 3,
+ step: 1,
+ type: 'numeric',
+ optional: 'no',
+ },
+ {
+ name: 'cornerRadius',
+ default: 0,
+ max: 200,
+ min: 0,
+ step: 1,
+ type: 'numeric',
+ optional: 'no',
+ },
+ ],
};
export const noiseDemo: DemoType = {
- comp: NoiseComp,
- compHeight: 720,
- compWidth: 1280,
- durationInFrames: 150,
- fps: 30,
- id: "noise",
- autoPlay: true,
- options: [
- {
- default: 0.01,
- max: 0.025,
- min: 0.001,
- step: 0.001,
- type: "numeric",
- name: "speed",
- optional: "no",
- },
- {
- min: 0,
- max: 100,
- step: 1,
- default: 50,
- name: "maxOffset",
- type: "numeric",
- optional: "no",
- },
- {
- name: "circleRadius",
- default: 5,
- max: 20,
- min: 2,
- step: 1,
- type: "numeric",
- optional: "no",
- },
- ],
+ comp: NoiseComp,
+ compHeight: 720,
+ compWidth: 1280,
+ durationInFrames: 150,
+ fps: 30,
+ id: 'noise',
+ autoPlay: true,
+ options: [
+ {
+ default: 0.01,
+ max: 0.025,
+ min: 0.001,
+ step: 0.001,
+ type: 'numeric',
+ name: 'speed',
+ optional: 'no',
+ },
+ {
+ min: 0,
+ max: 100,
+ step: 1,
+ default: 50,
+ name: 'maxOffset',
+ type: 'numeric',
+ optional: 'no',
+ },
+ {
+ name: 'circleRadius',
+ default: 5,
+ max: 20,
+ min: 2,
+ step: 1,
+ type: 'numeric',
+ optional: 'no',
+ },
+ ],
};
export const fadePresentationDemo: DemoType = {
- comp: FadeDemo,
- compHeight: 280,
- compWidth: 540,
- durationInFrames: 60,
- fps: 30,
- id: "fade",
- autoPlay: true,
- options: [],
+ comp: FadeDemo,
+ compHeight: 280,
+ compWidth: 540,
+ durationInFrames: 60,
+ fps: 30,
+ id: 'fade',
+ autoPlay: true,
+ options: [],
};
export const slidePresentationDemo: DemoType = {
- comp: SlideDemo,
- compHeight: 280,
- compWidth: 540,
- durationInFrames: 60,
- fps: 30,
- id: "slide",
- autoPlay: true,
- options: [
- {
- type: "enum",
- name: "direction",
- default: "from-left",
- optional: "no",
- values: ["from-left", "from-bottom", "from-right", "from-top"],
- },
- ],
+ comp: SlideDemo,
+ compHeight: 280,
+ compWidth: 540,
+ durationInFrames: 60,
+ fps: 30,
+ id: 'slide',
+ autoPlay: true,
+ options: [
+ {
+ type: 'enum',
+ name: 'direction',
+ default: 'from-left',
+ optional: 'no',
+ values: ['from-left', 'from-bottom', 'from-right', 'from-top'],
+ },
+ ],
};
export const flipPresentationDemo: DemoType = {
- comp: FlipDemo,
- compHeight: 280,
- compWidth: 540,
- durationInFrames: 60,
- fps: 30,
- id: "flip",
- autoPlay: true,
- options: [
- {
- type: "enum",
- name: "direction",
- default: "from-left",
- optional: "no",
- values: ["from-left", "from-bottom", "from-right", "from-top"],
- },
- ],
+ comp: FlipDemo,
+ compHeight: 280,
+ compWidth: 540,
+ durationInFrames: 60,
+ fps: 30,
+ id: 'flip',
+ autoPlay: true,
+ options: [
+ {
+ type: 'enum',
+ name: 'direction',
+ default: 'from-left',
+ optional: 'no',
+ values: ['from-left', 'from-bottom', 'from-right', 'from-top'],
+ },
+ ],
};
export const nonePresentationDemo: DemoType = {
- comp: NoneDemo,
- compHeight: 280,
- compWidth: 540,
- durationInFrames: 60,
- fps: 30,
- id: "none",
- autoPlay: true,
- options: [],
+ comp: NoneDemo,
+ compHeight: 280,
+ compWidth: 540,
+ durationInFrames: 60,
+ fps: 30,
+ id: 'none',
+ autoPlay: true,
+ options: [],
};
export const slidePresentationDemoLongThreshold: DemoType = {
- comp: SlideDemoLongDurationRest,
- compHeight: 280,
- compWidth: 540,
- durationInFrames: 90,
- fps: 30,
- id: "slide-long-duration-rest",
- autoPlay: true,
- options: [],
+ comp: SlideDemoLongDurationRest,
+ compHeight: 280,
+ compWidth: 540,
+ durationInFrames: 90,
+ fps: 30,
+ id: 'slide-long-duration-rest',
+ autoPlay: true,
+ options: [],
};
export const wipePresentationDemo: DemoType = {
- comp: WipeDemo,
- compHeight: 280,
- compWidth: 540,
- durationInFrames: 60,
- fps: 30,
- id: "wipe",
- autoPlay: true,
- options: [
- {
- type: "enum",
- name: "direction",
- default: "from-left",
- optional: "no",
- values: [
- "from-left",
- "from-top-left",
- "from-top",
- "from-top-right",
- "from-right",
- "from-bottom-right",
- "from-bottom",
- "from-bottom-left",
- ],
- },
- ],
+ comp: WipeDemo,
+ compHeight: 280,
+ compWidth: 540,
+ durationInFrames: 60,
+ fps: 30,
+ id: 'wipe',
+ autoPlay: true,
+ options: [
+ {
+ type: 'enum',
+ name: 'direction',
+ default: 'from-left',
+ optional: 'no',
+ values: [
+ 'from-left',
+ 'from-top-left',
+ 'from-top',
+ 'from-top-right',
+ 'from-right',
+ 'from-bottom-right',
+ 'from-bottom',
+ 'from-bottom-left',
+ ],
+ },
+ ],
};
export const clockWipePresentationDemo: DemoType = {
- comp: ClockWipeDemo,
- compHeight: 280,
- compWidth: 540,
- durationInFrames: 60,
- fps: 30,
- id: "clock-wipe",
- autoPlay: true,
- options: [],
+ comp: ClockWipeDemo,
+ compHeight: 280,
+ compWidth: 540,
+ durationInFrames: 60,
+ fps: 30,
+ id: 'clock-wipe',
+ autoPlay: true,
+ options: [],
};
export const cubePresentationDemo: DemoType = {
- comp: CubeDemo,
- compHeight: 280,
- compWidth: 540,
- durationInFrames: 60,
- fps: 30,
- id: "cube",
- autoPlay: true,
- options: [
- {
- type: "enum",
- name: "direction",
- default: "from-left",
- optional: "no",
- values: ["from-left", "from-top", "from-right", "from-bottom"],
- },
- ],
+ comp: CubeDemo,
+ compHeight: 280,
+ compWidth: 540,
+ durationInFrames: 60,
+ fps: 30,
+ id: 'cube',
+ autoPlay: true,
+ options: [
+ {
+ type: 'enum',
+ name: 'direction',
+ default: 'from-left',
+ optional: 'no',
+ values: ['from-left', 'from-top', 'from-right', 'from-bottom'],
+ },
+ ],
};
export const customPresentationDemo: DemoType = {
- comp: CustomTransitionDemo,
- compHeight: 280,
- compWidth: 540,
- durationInFrames: 60,
- fps: 30,
- id: "custom-presentation",
- autoPlay: true,
- options: [],
+ comp: CustomTransitionDemo,
+ compHeight: 280,
+ compWidth: 540,
+ durationInFrames: 60,
+ fps: 30,
+ id: 'custom-presentation',
+ autoPlay: true,
+ options: [],
};
export const customTimingDemo: DemoType = {
- comp: CustomTimingDemo,
- compHeight: 280,
- compWidth: 540,
- durationInFrames: 60,
- fps: 30,
- id: "custom-timing",
- autoPlay: true,
- options: [],
+ comp: CustomTimingDemo,
+ compHeight: 280,
+ compWidth: 540,
+ durationInFrames: 60,
+ fps: 30,
+ id: 'custom-timing',
+ autoPlay: true,
+ options: [],
};
export const animationMathDemo: DemoType = {
- comp: AnimationMath,
- compHeight: 280,
- compWidth: 540,
- durationInFrames: 120,
- fps: 30,
- id: "animation-math",
- autoPlay: true,
- options: [],
+ comp: AnimationMath,
+ compHeight: 280,
+ compWidth: 540,
+ durationInFrames: 120,
+ fps: 30,
+ id: 'animation-math',
+ autoPlay: true,
+ options: [],
};
diff --git a/packages/shapes/src/components/heart.tsx b/packages/shapes/src/components/heart.tsx
index 449ab1279f..87e5b94cd9 100644
--- a/packages/shapes/src/components/heart.tsx
+++ b/packages/shapes/src/components/heart.tsx
@@ -11,6 +11,6 @@ export type HeartProps = MakeHeartProps & AllShapesProps;
* @param {Number} size The size of the heart.
* @see [Documentation](https://www.remotion.dev/docs/shapes/heart)
*/
-export const Heart: React.FC<HeartProps> = ({size, ...props}) => {
- return <RenderSvg {...makeHeart({size})} {...props} />;
-};
\ No newline at end of file
+export const Heart: React.FC<HeartProps> = ({width, height, ...props}) => {
+ return <RenderSvg {...makeHeart({width, height})} {...props} />;
+};
diff --git a/packages/shapes/src/test/heart.test.tsx b/packages/shapes/src/test/heart.test.tsx
index 6657bb4d21..a0faceb2da 100644
--- a/packages/shapes/src/test/heart.test.tsx
+++ b/packages/shapes/src/test/heart.test.tsx
@@ -3,12 +3,9 @@ import {Heart} from '../components/heart';
import {render} from './test-utils';
test('Should be able to make a heart svg', () => {
- const {container} = render(<Heart size={100} />);
+ const {container} = render(<Heart width={100} height={100} />);
expect(
- container
- .querySelector('path')
- ?.getAttribute('d')
- ?.startsWith('M 50 85 C'),
+ container.querySelector('path')?.getAttribute('d')?.startsWith('M 50 85 C'),
).toBe(true);
-});
\ No newline at end of file
+});
diff --git a/packages/shapes/src/test/make-heart.test.ts b/packages/shapes/src/test/make-heart.test.ts
index 2ac6050675..4b32786714 100644
--- a/packages/shapes/src/test/make-heart.test.ts
+++ b/packages/shapes/src/test/make-heart.test.ts
@@ -3,7 +3,8 @@ import {makeHeart} from '../utils/make-heart';
test('Should be able to make a heart path', () => {
const heartPath = makeHeart({
- size: 100,
+ width: 100,
+ height: 100,
});
expect(heartPath.width).toEqual(100);
@@ -13,4 +14,4 @@ test('Should be able to make a heart path', () => {
expect(heartPath.instructions[0]).toEqual({type: 'M', x: 50, y: 85});
expect(heartPath.instructions[5]).toEqual({type: 'Z'});
expect(heartPath.path.startsWith('M 50 85 C')).toBeTruthy();
-});
\ No newline at end of file
+});
diff --git a/packages/shapes/src/utils/make-heart.ts b/packages/shapes/src/utils/make-heart.ts
index 01bfd284ee..06b0fb41e7 100644
--- a/packages/shapes/src/utils/make-heart.ts
+++ b/packages/shapes/src/utils/make-heart.ts
@@ -3,7 +3,8 @@ import {serializeInstructions} from '@remotion/paths';
import type {ShapeInfo} from './shape-info';
export type MakeHeartProps = {
- size: number;
+ width: number;
+ height: number;
};
/**
@@ -11,88 +12,56 @@ export type MakeHeartProps = {
* @param {Number} size The size of the heart.
* @see [Documentation](https://www.remotion.dev/docs/shapes/make-heart)
*/
-export const makeHeart = ({size}: MakeHeartProps): ShapeInfo => {
- // Heart shape using a classic approach with proper proportions
- const centerX = size / 2;
- const centerY = size / 2;
-
- // Heart scaling factor
- const scale = size / 100;
-
- // Heart key points
- const bottomX = centerX;
- const bottomY = centerY + 35 * scale; // Bottom point
-
- // Lobe parameters for classic heart shape
- const lobeOffsetX = 25 * scale; // How far lobes are from center
- const lobeRadius = 18 * scale; // Size of each lobe
- const lobeY = centerY - 15 * scale; // Vertical center of lobes
-
- const leftLobeX = centerX - lobeOffsetX;
- const rightLobeX = centerX + lobeOffsetX;
-
- // Create heart with 4 bezier curves (M + 4 C + Z = 6 instructions)
+export const makeHeart = ({width, height}: MakeHeartProps): ShapeInfo => {
const instructions: Instruction[] = [
- // Start at the bottom point
+ /**
+M55 100
+C32.4107 69.2427 0 60.5922 0 27.9126
+C0 13.4951 12.7679 1 27.5 1
+C40.2679 1 50.0893 7.72816 55 17.3398
+
+ */
{
type: 'M',
- x: bottomX,
- y: bottomY,
- },
- // Left side - from bottom to left lobe
- {
- type: 'C',
- cp1x: bottomX - 30 * scale,
- cp1y: bottomY - 15 * scale,
- cp2x: leftLobeX - lobeRadius,
- cp2y: lobeY + lobeRadius * 0.5,
- x: leftLobeX - lobeRadius,
- y: lobeY,
+ x: 55,
+ y: 100,
},
- // Left lobe - semicircular top, ending at center dip
{
type: 'C',
- cp1x: leftLobeX - lobeRadius,
- cp1y: lobeY - lobeRadius,
- cp2x: leftLobeX + lobeRadius * 0.8,
- cp2y: lobeY - lobeRadius,
- x: centerX,
- y: lobeY + lobeRadius * 0.2,
+ cp1x: 32,
+ cp1y: 69,
+ cp2x: 0,
+ cp2y: 60,
+ x: 0,
+ y: 27,
},
- // Right lobe - from center dip to right lobe edge
{
type: 'C',
- cp1x: rightLobeX - lobeRadius * 0.8,
- cp1y: lobeY - lobeRadius,
- cp2x: rightLobeX + lobeRadius,
- cp2y: lobeY - lobeRadius,
- x: rightLobeX + lobeRadius,
- y: lobeY,
+ cp1x: 0,
+ cp1y: 13,
+ cp2x: 12,
+ cp2y: 1,
+ x: 27.5,
+ y: 1,
},
- // Right side - from right lobe back to bottom
{
type: 'C',
- cp1x: rightLobeX + lobeRadius,
- cp1y: lobeY + lobeRadius * 0.5,
- cp2x: bottomX + 30 * scale,
- cp2y: bottomY - 15 * scale,
- x: bottomX,
- y: bottomY,
- },
- {
- type: 'Z',
+ cp1x: 40,
+ cp1y: 1,
+ cp2x: 50,
+ cp2y: 7,
+ x: 55,
+ y: 17,
},
];
const path = serializeInstructions(instructions);
- const width = size;
- const height = size;
return {
path,
width,
height,
- transformOrigin: `${centerX} ${centerY}`,
+ transformOrigin: `${width / 2} ${height / 2}`,
instructions,
};
-};
\ No newline at end of file
+};