Show HN: jsgif: A GIF player in JavaScript(slbkbs.org) |
Show HN: jsgif: A GIF player in JavaScript(slbkbs.org) |
The source code is a bit of a mess, but if anyone is
interested in the non-bookmarkletized code, I can upload it
somewhere.
How about hosting the source code on GitHub? I'd love to see how this works!https://github.com/icefox/git-achievements
And on icefox.git.com:
Soon as I get a chance, I think I'll relaunch gifexplode with your viewer.
Here's the blog post about how gifexplode was born, it's quite an interesting story: http://www.puremango.co.uk/2009/08/gifexplode-community-powe...
edit: Hmm, using XHR to fetch the gif will give me cross-domain issues unless I first mirror the image on my server. Anyone know of a way around that?
I was using XHR because an important constraint was to do everything client-side, and there's no other way that I could find to get the raw image data. If you have server-side support, though, a lot of things can be made much simpler. Is there a reason not to proxy, like crux_ suggested?
In general, though, there's no way around it, except of course by restructuring gifexplode as a bookmarklet or convincing image host(s) to partner with you:
They can then include the code on the pages they serve up themselves, allow XHR requests via HTML5 or flash mechanisms, or give you base64 data smuggled into a JSONP.
You can set up an onload handler on an image though, yeah.
Add a timeline slider and it's really usable!
ps. for those wanting to read the source more easily,
paste the bookmarklet into http://jsbeautifier.org/
var img = new Image();
img.onload = function(){
//draw to canvas
};
img.src = "image.png";
Could be a stupid answer, or possibly it'd be better to do it your way?( Maybe I can learn something :) )https://developer.mozilla.org/en/Canvas_tutorial/Using_image...
It also uses a canvas element to render each frame but it does support weird disposal methods. You can see the (very sloppy) source by just viewing the source of the plugin window.
You mentioned getting test images for the disposal methods and I found these to be very helpful: http://algif.sourceforge.net/#18
I'd also recommend using some kind of movie player-style control like I used and some kind of "explode" function. They both proved popular.
The next step beyond that is to provide browser extensions for programming network protocols. One-way HTTP over NAT sucks, web-sockets do not and will not work.
We're starting to come back around to the vision of the Internet in the 80s - multi-protocol, multi-host (if you're on the web, you can be a server), mobile code via bytecode (or source code), and with pervasive remote access (VNC and X11/NX).
What does pin/unpin do? (I clicked it with no obvious effect on playback.)