Skip to content

🎥 Make videos programmatically with React

export gif fill mode

Jonny Burgerb1d76facf706
diff --git a/packages/gif/src/canvas.tsx b/packages/gif/src/canvas.tsx
index 92c9be7a74..f52c414790 100644
--- a/packages/gif/src/canvas.tsx
+++ b/packages/gif/src/canvas.tsx
@@ -5,10 +5,11 @@ import {
useRef,
useState,
} from 'react';
+import type {GifFillMode} from './props';
import {useElementSize} from './use-element-size';
const calcArgs = (
- fit: 'fill' | 'contain' | 'cover',
+ fit: GifFillMode,
frameSize: {
width: number;
height: number;
@@ -90,7 +91,7 @@ type Props = {
frames: ImageData[];
width?: number;
height?: number;
- fit: 'fill' | 'contain' | 'cover';
+ fit: GifFillMode;
className?: string;
style?: React.CSSProperties;
};
diff --git a/packages/gif/src/index.ts b/packages/gif/src/index.ts
index 8971c66818..c08c92ddb0 100644
--- a/packages/gif/src/index.ts
+++ b/packages/gif/src/index.ts
@@ -1,3 +1,3 @@
export {getGifDurationInSeconds} from './get-gif-duration-in-seconds';
export {Gif} from './Gif';
-export {RemotionGifProps} from './props';
+export {GifFillMode, RemotionGifProps} from './props';
diff --git a/packages/gif/src/props.ts b/packages/gif/src/props.ts
index 8e419d0616..e27bd89168 100644
--- a/packages/gif/src/props.ts
+++ b/packages/gif/src/props.ts
@@ -9,7 +9,7 @@ export type RemotionGifProps = {
frames: ImageData[];
}) => void;
onError?: (error: Error) => void;
- fit?: 'contain' | 'fill' | 'cover';
+ fit?: GifFillMode;
style?: React.CSSProperties;
};
@@ -19,3 +19,5 @@ export type GifState = {
width: number;
height: number;
};
+
+export type GifFillMode = 'contain' | 'cover' | 'fill';