OLD | NEW |
1 | 1 |
2 ```javascript | 2 ```javascript |
3 var gif = new GIF({ | 3 var gif = new GIF({ |
4 workers: 2, | 4 workers: 2, |
5 quality: 10 | 5 quality: 10 |
6 }); | 6 }); |
7 | 7 |
8 // add a image element | 8 // add a image element |
9 gif.addFrame(imageElement); | 9 gif.addFrame(imageElement); |
10 | 10 |
11 // or a canvas element | 11 // or a canvas element |
12 gif.addFrame(canvasElement, {delay: 200}); | 12 gif.addFrame(canvasElement, {delay: 200}); |
13 | 13 |
14 // or copy the pixels from a canvas context | 14 // or copy the pixels from a canvas context |
15 gif.addFrame(ctx, {copy: true}); | 15 gif.addFrame(ctx, {copy: true}); |
16 | 16 |
17 gif.on('finished', function(blob) { | 17 gif.on('finished', function(blob) { |
18 window.open(URL.createObjectURL(blob)); | 18 window.open(URL.createObjectURL(blob)); |
19 }); | 19 }); |
20 | 20 |
21 gif.render(); | 21 gif.render(); |
22 | 22 |
23 ``` | 23 ``` |
OLD | NEW |