gif.js 详细介绍gif.js 是一个可直接在浏览器上运行的 JavaScript GIF 编码器。支持的浏览器包括:
Google ChromeFirefox 17Safari 6Internet Explorer 10Mobile Safari iOS 6
使用方法:
var gif = new GIF({
workers: 2,
quality: 10
});
// add an image element
gif.addFrame(imageElement);
// or a canvas element
gif.addFrame(canvasElement, {delay: 200});
// or copy the pixels from a canvas context
gif.addFrame(ctx, {copy: true});
gif.on('finished', function(blob) {
window.open(URL.createObjectURL(blob));
});
gif.render();
相关资源:在js中显示gif图片