gif.js
gif.js copied to clipboard
Can I control the render step by step?
for example, I use canvas to show an animation. when first frame is shown, i add this canvas to the GIF then i show the second frame, and i add the second canvas to the GIF and so on
check the sourcecode i found we can do this.
gif.on("progress",function(pst){
//console.log("gifprogress",pst,this);
myprogress.value=pst;
//log("gifprogress"+Math.round(pst*100)+"%");
});
:)
The answer to this is yes. You just have to call gif.addFrame
each step, and then at some point stop adding frames and call gif.render
. You can use a flag var recording = true;
and only add frames if recording
, and then when you want to finish the recording, recording = false; gif.render();