Skip to content

🎥 Make videos programmatically with React

still component

Jonny Burgerebd375177be8
diff --git a/packages/core/src/Composition.tsx b/packages/core/src/Composition.tsx
index dc61084201..3afcf25c4b 100644
--- a/packages/core/src/Composition.tsx
+++ b/packages/core/src/Composition.tsx
@@ -20,15 +20,18 @@ export type CompProps<T> =
component: AnyComponent<T>;
};
-type Props<T> = {
+export type StillProps<T> = {
width: number;
height: number;
- fps: number;
- durationInFrames: number;
id: string;
defaultProps?: T;
} & CompProps<T>;
+type CompositionProps<T> = StillProps<T> & {
+ fps: number;
+ durationInFrames: number;
+};
+
export const Composition = <T,>({
width,
height,
@@ -37,7 +40,7 @@ export const Composition = <T,>({
id,
defaultProps: props,
...compProps
-}: Props<T>) => {
+}: CompositionProps<T>) => {
const {registerComposition, unregisterComposition} = useContext(
CompositionManager
);
diff --git a/packages/core/src/Still.tsx b/packages/core/src/Still.tsx
new file mode 100644
index 0000000000..a1b9dddc84
--- /dev/null
+++ b/packages/core/src/Still.tsx
@@ -0,0 +1,5 @@
+import {Composition, StillProps} from './Composition';
+
+export const Still = <T,>(props: StillProps<T>) => {
+ return <Composition fps={1} durationInFrames={1} {...props} />;
+};
diff --git a/packages/core/src/index.ts b/packages/core/src/index.ts
index be2b50aafb..de14810f66 100644
--- a/packages/core/src/index.ts
+++ b/packages/core/src/index.ts
@@ -34,6 +34,7 @@ export * from './ready-manager';
export {registerRoot} from './register-root';
export {Sequence} from './sequencing';
export * from './spring';
+export * from './Still';
export * from './use-frame';
export * from './use-video-config';
export * from './video';