securityos/node_modules/gif.js/site/contents/code.md

24 lines
367 B
Markdown
Raw Permalink Normal View History

2024-09-06 15:32:35 +00:00
```javascript
var gif = new GIF({
workers: 2,
quality: 10
});
// add a 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();
```