It’s a shame that browsers pulled their support for esc to stop all page animation on GIFs. People forget… but this really was a thing.
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.
Here’s an obligatory GIF to try it out:
Looking great, a couple of minor recommendations:
Maybe we do a small “paused” overlay, so people learn what happened. (a translucent
IIat 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?
Some weird behaviour I noticed here on Meta.
I posted a gif here https://meta.discourse.org/t/badges-and-general-chattiness-of-discourse/187971/19?u=geoff777
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.
testing testing testing …
Maybe we could have a setting which would show on hover of a gif along the “stop current gif” button:
- autoplay gifs on/off (stored in session)
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 gif I posted above won’t pause atm
Then there was a refresh and it does.
I’m guessing now this non-pause issue is just for the gif poster and fixes with a refresh.
Edit - sorry just reading your post above @pmusaraj
Yes that makes sense. It pauses when it is available locally.
So for a short time the pause feature won’t work. Good to know. Thanks
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:
I also added play/pause icons and a few other improvements.
This topic was automatically closed after 6 days. New replies are no longer allowed.
Lightboxing gets in the way, as you can see here. Compare and contrast behavior by clicking / tapping on the below animated GIFs:
It kinda-sorta works on the second one, with the caveat that the lightbox expansion and contraction absorbs one of the clicks to pause/unpause.
Yeah @pmusaraj going to reopen this, we probably want better handling for cases where an animated gif is lightboxed it is very awkward now.
Not sure what the right thing is to do? not lightbox animated gifs? have different click areas for “pause” vs “full size” for these cases?
Maybe this? I am not sure there is anything to gain from lightboxing animated gifs…
I guess technically you could have a gigantic animation to show off.
Maybe we just disable the lightbox for now and see if anyone complains? Agree entirely that it usually is bad news and useless for animated gifs.
Sure, if disabling lightbox is easy for animated gifs, let’s do that. Should probably backport it as well!
This is now done and merged, animated images won’t be lightboxed. The example above has been updated (existing posts need a rebake for this to take effect).
Will backport shortly.
This topic was automatically closed after 4 days. New replies are no longer allowed.
This is a fun one, it’s impossible to play a de-spoilered gif:
Not completely related, but I’ve seen similar issues with spoilered images, where all you want to do is reveal the image and it actually pops up the full size image at the same time. Not related to the gif issue of course, but wanted to mention since it still has to do with clicking images that are behind spoiler tags.