A discussion on the topic “Animated gifs: Make it stop!” began with ganncamp requesting a feature to stop animated GIFs from playing continuously. jesus2099 suggested using a browser extension to hide animated GIFs, while codinghorror recalled that browsers used to support a native feature to stop GIF animations.
pmusaraj implemented a feature that allows users to pause animated GIFs by clicking on them. However, this feature only works for locally uploaded GIFs and not for external links. geoff777 reported issues with the feature, which pmusaraj explained were due to the GIF not being locally uploaded.
sam suggested adding a “paused” overlay to indicate when a GIF is paused, and pmusaraj added play/pause icons and a subtle background color to the canvas element.
The discussion also touched on the issue of lightboxing animated GIFs, with codinghorror pointing out that it can be awkward. pmusaraj suggested disabling lightboxing for animated GIFs, which was later implemented (pmusaraj).
Additionally, awesomerobot reported an issue with playing de-spoilered GIFs, which pmusaraj addressed by disabling lightboxes and pausing animated images inside spoiler elements. seanblue emphasized the importance of maintaining the toggle behavior for spoilers, and pmusaraj implemented a fix that makes blurring one-way for elements with their own click actions.
When people post animated gifs they play over and over and over and over and over and…
Twitter gives me a way to make the animation stop. Slack lets me collapse the image so I don’t see it anymore. Please, please Discourse give me something comparable.
Great feature request @ganncamp, thank you. This is now done (commit) and deployed here on meta. Clicking on the image will pause and then unpause the animation. Due to browser security limitations, the pausing shows only the first frame of the image, it can’t show the frame on the moment it was clicked.
Maybe we do a small “paused” overlay, so people learn what happened. (a translucent II at the bottom right?)
I think, (though I am not sure) that this only works after the gif fully loaded. Some animated gifs can take a while to load. Can you test maybe on local using throttling to see that this pauses even if the gif is not fully loaded?
It wouldn’t pause. I tried two browsers.
I came to this thread as I’d read it the other day.
Clicked on the STOP IT gif and it paused.
Back to my post and that now pauses.
Thanks Geoff, the technical reason why your upload doesn’t work is because this currently only works for uploads that are in the DB. Your upload above is a giphy URL, it doesn’t have a local upload record. We can’t easily extend this to animated images from other URLs because we don’t know for sure if an asset on a specific URL is an animated image or a regular static image.
We can make an educated guess, for giphy URLs for example, but unless the upload is local and processed, we won’t know for sure.
Update: ah, and now the giphy upload in your post above was downloaded locally, and the pausing works.
The pause action works, but the canvas can’t read/draw the first frame until the GIF has fully loaded. I don’t think we can properly fix this, so I added a subtle background color to the canvas element, which will display like this: