Skip to content

🎥 Make videos programmatically with React

add animated png to testbed

Jonny Burger735b1d0c3dda
diff --git a/packages/docs/docs/animatedimage.mdx b/packages/docs/docs/animatedimage.mdx
index 0df706483e..c5983e4b73 100644
--- a/packages/docs/docs/animatedimage.mdx
+++ b/packages/docs/docs/animatedimage.mdx
@@ -7,16 +7,14 @@ crumb: 'API'
# `<AnimatedImage>`<AvailableFrom v="4.0.246" />
-Renders an animated GIF, AVIF or WebP image and syncs it with Remotion's timeline.
+Renders an animated GIF, PNG, AVIF or WebP image and syncs it with Remotion's timeline.
Relies on the [`ImageDecoder`](https://developer.mozilla.org/en-US/docs/Web/API/ImageDecoder) Web API, meaning it only works in Google Chrome and Firefox as of writing.
```tsx twoslash title="Loading a remote animated image"
import {AnimatedImage} from 'remotion';
export const WebpAnimatedImage = () => {
- return (
- <AnimatedImage src="https://mathiasbynens.be/demo/animated-webp-supported.webp" />
- );
+ return <AnimatedImage src="https://mathiasbynens.be/demo/animated-webp-supported.webp" />;
};
```
@@ -41,13 +39,10 @@ Remote images need to support [CORS](https://developer.mozilla.org/en-US/docs/We
<summary>More info</summary>
<ul>
<li>
- Remotion's origin is usually <code>http://localhost:3000</code>, but it
- may be different if rendering on Lambda or the port is busy.
+ Remotion's origin is usually <code>http://localhost:3000</code>, but it may be different if rendering on Lambda or the port is busy.
</li>
<li>
- You can{' '}
- <a href="/docs/chromium-flags#--disable-web-security">disable CORS</a>{' '}
- during renders.
+ You can <a href="/docs/chromium-flags#--disable-web-security">disable CORS</a> during renders.
</li>
</ul>
</details>
@@ -87,7 +82,7 @@ You can add a [React ref](https://react.dev/learn/manipulating-the-dom-with-refs
## Differences to `<Gif>`
-- `<AnimatedImage>` also supports AVIF and WebP images.
+- `<AnimatedImage>` also supports AVIF, APNG and WebP images.
- `<AnimatedImage>` uses the [`ImageDecoder`](https://developer.mozilla.org/en-US/docs/Web/API/ImageDecoder) Web API, which has limited browser support.
- `<AnimatedImage>` does not support the `onLoad` prop.
diff --git a/packages/example/public/animated-png.png b/packages/example/public/animated-png.png
new file mode 100644
index 0000000000..98580065b3
Binary files /dev/null and b/packages/example/public/animated-png.png differ
diff --git a/packages/example/src/AnimatedImage/Avif.tsx b/packages/example/src/AnimatedImage/Avif.tsx
index 8a63dce687..f166673269 100644
--- a/packages/example/src/AnimatedImage/Avif.tsx
+++ b/packages/example/src/AnimatedImage/Avif.tsx
@@ -24,6 +24,13 @@ export const AnimatedImages = () => {
/>
<div className="text-7xl font-sans font-bold">GIF</div>
</div>
+ <div className="flex flex-col items-center gap-8">
+ <AnimatedImage
+ className="h-96 inline-block rounded-2xl outline outline-8 outline-[#0B84F3]"
+ src={staticFile('animated-png.png')}
+ />
+ <div className="text-7xl font-sans font-bold">APNG</div>
+ </div>
</AbsoluteFill>
);
};
diff --git a/packages/example/src/Root.tsx b/packages/example/src/Root.tsx
index a46a8398a5..40d1bbbb66 100644
--- a/packages/example/src/Root.tsx
+++ b/packages/example/src/Root.tsx
@@ -727,7 +727,7 @@ export const Index: React.FC = () => {
<Composition
id="animated-images"
component={AnimatedImages}
- width={1920}
+ width={2400}
height={1080}
durationInFrames={200}
fps={30}