← Back to context

Comment by initramfs

11 hours ago

I found APNG suffer the same issue, but there may be some workarounds:

https://share.google/aimode/X1Q5rp3z2tEbtDSPf

"Yes, but not natively just by using a standard <img> tag in web browsers. Because native APNGs play continuously like a traditional GIF, you need to use one of the following methods to pause them: [1, 2, 3, 4]

1. The Canvas Method (Best for Web Controls) To add play/pause functionality, you cannot use an <img> tag. Instead, you need to render the APNG onto an HTML <canvas> element and control it using a JavaScript library like apng-js. This provides precise, video-like control over the frames. [1, 2, 3, 4]

2. The Cover Method (Simplest Fallback) If you just want to freeze an APNG on its first frame, you can layer a static .png of the first frame directly over the APNG. When you uncover or hide the static image, the underlying APNG will be revealed and play as normal. [1]

3. Use CSS Animation Alternatives [1] If you are designing the animation yourself, an alternative is to build it as a single static image (a filmstrip of all frames side-by-side) and animate it using CSS background-position. This allows you to pause the image natively using the CSS animation-play-state property. [1, 2, 3]"