Skip to content

🎥 Make videos programmatically with React

testbed

Jonny Burger170b3cb712b3
diff --git a/packages/example/src/Paths/ShapesMorph.tsx b/packages/example/src/Paths/ShapesMorph.tsx
new file mode 100644
index 0000000000..bc3e8311a9
--- /dev/null
+++ b/packages/example/src/Paths/ShapesMorph.tsx
@@ -0,0 +1,31 @@
+import {interpolatePath} from '@remotion/paths';
+import {makeCircle, makePolygon} from '@remotion/shapes';
+import {AbsoluteFill, interpolate, useCurrentFrame} from 'remotion';
+
+export const ShapesMorph: React.FC = () => {
+ const frame = useCurrentFrame();
+
+ const {path: circlepath} = makeCircle({
+ radius: 200,
+ });
+
+ const {path: polygonpath} = makePolygon({
+ points: 5,
+ radius: 80,
+ });
+
+ const interpolation = interpolate(frame, [30, 60], [0, 1], {
+ extrapolateLeft: 'clamp',
+ extrapolateRight: 'clamp',
+ });
+
+ const interpolated = interpolatePath(interpolation, polygonpath, circlepath);
+
+ return (
+ <AbsoluteFill className="bg-gray-100 items-center justify-center">
+ <svg viewBox="0 0 720 720">
+ <path d={interpolated} />
+ </svg>
+ </AbsoluteFill>
+ );
+};
diff --git a/packages/example/src/Root.tsx b/packages/example/src/Root.tsx
index d1e1c9f385..d15d047cf1 100644
--- a/packages/example/src/Root.tsx
+++ b/packages/example/src/Root.tsx
@@ -36,6 +36,7 @@ import {
calculateMetadataFn,
} from './OffthreadRemoteVideo/OffthreadRemoteVideo';
import {OrbScene} from './Orb';
+import {ShapesMorph} from './Paths/ShapesMorph';
import {PremountedExample} from './Premount';
import {PremountedRemoteVideos} from './Premount/RemoteVideos';
import InfinityVideo from './ReallyLongVideo';
@@ -964,6 +965,14 @@ export const Index: React.FC = () => {
height={1080}
width={1080}
/>
+ <Composition
+ id="shapes-morph"
+ component={ShapesMorph}
+ durationInFrames={500}
+ fps={30}
+ height={1080}
+ width={1080}
+ />
</Folder>
<Folder name="gif">
<Composition