jnordberg / gif.js

JavaScript GIF encoding library
http://jnordberg.github.io/gif.js/
MIT License
4.76k stars 668 forks source link

setDelay with very small delay returns to default? #17

Closed umbrae closed 10 years ago

umbrae commented 10 years ago

Let me say to start that I'm not even sure I'm right on this. I'm seeing some behavior but I don't have a deep enough understanding of the gif spec to know if what I think is true, is.

That said: It looks like when someone uses setDelay with a delay ms < 5 it rounds down to 0, which is the default, and I think is not "run as fast as possible"? I'm not sure on that, but I'm seeing that gifs seem to run a little slow when they come out.

No idea if that's right, just wanted to run it by you.

leeoniya commented 10 years ago

sounds like a limitation imposed by different browser vendors. i think the shortest delay supported by any browser is 20ms (so 50fps) and any less than that reverts to default (100ms?) see: http://nullsleep.tumblr.com/post/16524517190/animated-gif-minimum-frame-delay-browser-compatibility

umbrae commented 10 years ago

Interesting, I am using Chrome but it's possible my logic is rounding to 0.01s and getting rounded up. I'll take a look, thanks @leeoniya.