In 1994 I was in high school, and there were no animated GIFs. One way you could make images move in the web browser was to use a mechanism similar to this.<p>I wrote a C program which would load 6 frames of a smiley face animation and would feed them sequentially, in an endless loop, to anyone who requested the image. Mosaic was happy to animate them.<p>I get called in to the web mistress's office. The web server is down. We had a donated Silicon Graphics Origin server, if my memory serves me correctly. This was a beefy machine.<p>The cgi-bin C program would load 6 images, as fast as it possibly could, and dump them into a network socket. It would not throttle. It would not check if the client disconnected. It had one job. It did it efficiently, and ruthlessly.<p>Poor server.
I did something similar long time ago with multipart/x-mixed-replace content type. <a href="http://zabasoft.xf.cz/clock.gif" rel="nofollow">http://zabasoft.xf.cz/clock.gif</a>
This is absolutely awesome.<p>I wonder if this can be used to stream regular GIFs, so that you don't have to wait for the whole thing to load before seeing the animation.<p>I'm currently working on a project focusing on GIFs (<a href="https://www.gifsonic.com" rel="nofollow">https://www.gifsonic.com</a>), I'll definitely study this to see if it's possible.
I did the same thing about fifteen years ago by generating a mJPEG stream from a PHP-script. As far as I can remember, it seemed more reliable than using GIF. See <a href="https://en.wikipedia.org/wiki/Motion_JPEG" rel="nofollow">https://en.wikipedia.org/wiki/Motion_JPEG</a>
This technique used to be used to embed "videos" into html emails years ago. Haven't seen it used in a long time maybe email clients block the streaming behavior now (for good reason).
Tried to make it output with chunked-encoding:<p>- In Chrome it shows nothing (looks like it waits for end of stream)<p>- In Safari it shows only the first frame<p>- In Firefox it works (shows animated clock)<p>Branch with chunked encoding: <a href="https://github.com/kolen/time.gif/tree/chunked-encoding" rel="nofollow">https://github.com/kolen/time.gif/tree/chunked-encoding</a>
This is really cool! Completely suboptimal but fascinating none the less. Great project and idea :) would be interested in hearing some people's ideas for real applications of this
So this was done during a programming paradigms course at KIT? I'm teaching functional programming basics using Haskell at my university. At the end of the semester we aren't quite that far. But I am far from sure whether this exercise, just looking at the given types, has didactic value and I wonder how much of the stuff the instructor has given and how much the students worked out themselves given the course materials.<p>I would be a bit hesitant (teaching-wise), to talk about any function of the type IO () -> IO Char -> (Frame -> IO ()) -> IO ()<p>Although, not to be a spoil sport, it seems like a fun thing to do over a long weekend.
see also raytracing clock on PNG: <a href="http://www.ioccc.org/2013/mills/hint.html" rel="nofollow">http://www.ioccc.org/2013/mills/hint.html</a>
When you are running out of time, but still got a decent video player ready:<p><pre><code> $ mpv --cache=no https://hookrace.net/time.gif</code></pre>
This reminds me of a project I've created a few years ago that does live video streaming with endless GIFs: <a href="https://github.com/jbochi/gifstreaming" rel="nofollow">https://github.com/jbochi/gifstreaming</a>
Very interesting from a tech perspective, make sure you lazy load the gif if you plan on using it after window load event otherwise it's never going to happen and you'll just get the endless spinner :D
eBay sometimes sends out emails with auction countdowns in them that do something similar.<p>The first time that I saw an accurate countdown ticking away in an email, it surprised the heck out of me.
Hey, cool, I wanted to do the exact same thing the other day but as a countdown clock. For those saying this has no practical use, a countdown definitely does :)
This is great. If I were to serve this over apache is there a limit on the connections? I'm asking because I'm assuming there is only a specific number of concurrent connections per child in apache(?).<p>So if gif 2 is embedded in 100 sites will it bring my server down since children are not closing connections?
Also check out <a href="https://github.com/ErikvdVen/php-gif" rel="nofollow">https://github.com/ErikvdVen/php-gif</a>
It generates real-time GIF images with PHP, such as countdown, etc.
Am still waiting for it to finish looping ;)<p>There's probably a cheap optimization in there somewhere. Diffing frames on each tick, but for that size it probably doesn't matter. Thanks for the link to GifStream!
[gifsockets](<a href="https://github.com/videlalvaro/gifsockets" rel="nofollow">https://github.com/videlalvaro/gifsockets</a>) is another version of this
> It is written in Haskell and works by dynamically generating each frame of the GIF and slowly feeding them over the HTTP connection.<p>This seems rather difficult. These are dynamically generated. There are 24<i>60</i>60=86400 possible slides, but at download time, we have to find the correct starting point. Did I get that right?
I don't understand why this is getting so much attention. From the description:<p>"[It] works by dynamically generating each frame of the GIF and slowly feeding them over the HTTP connection."<p>So there is nothing (AFAICT) new or interesting going on here. It's just an animation generated by the server in real time that happens to be formatted as a gif. It's no different from what many low-end web-enabled security cameras do.
it is one of those thing you do because you can do that. If you try to open the GIF only it won't work well and if you try to save it as image it won't work.<p>for me it has no real application that I can think of, it consume lot of bandwidth and processing even for small size gif.<p>good knowledge for developer, I certainly cannot even think in that line. But no use of it in current form.