jnordberg / gif.js

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

Stop/Destroy GIF objects while rendering #41

Open Fauntleroy opened 9 years ago

Fauntleroy commented 9 years ago

Is there any way to stop/destroy a GIF while it's rendering? Something like:

gif = new gifjs.GIF({
    workers: 8,
    quality: options.quality,
    repeat: 0,
    width: options.width,
    height: options.height,
    workerScript: chrome.runtime.getURL('scripts/vendor/gif.worker.js')
});

// add frames here
gif.addFrame(...

gif.render();

// oh god this is taking too long please help
gif.stop(); // or gif.destroy();
jnordberg commented 9 years ago

There's currently no way to abort a frame in progress, it will only stop enqueuing new frames.

1j01 commented 9 years ago

gif.abort() isn't mentioned in the documentation

Fauntleroy commented 9 years ago

Thanks, @1j01 that's what I was looking for. I'd love to see this documented.