Skip to content

Latest commit

 

History

History
29 lines (26 loc) · 563 Bytes

NOTES.md

File metadata and controls

29 lines (26 loc) · 563 Bytes

// Initializing var gif = new GIF({ workers: 2, quality: 1, repeat: 0 });

// Adding a frame var img = new Image(), serialized = new XMLSerializer().serializeToString(document.querySelector("svg")), svg = new Blob([serialized], {type: "image/svg+xml"}), url = URL.createObjectURL(svg); img.onload = function() { gif.addFrame(img, { delay: 50, copy: true }); }

img.src = url;

// Rendering gif.on("finished", function(blob) { d3 .select("body") .append("img") .attr("src", URL.createObjectURL(blob)); }); gif.render();