gif.js icon indicating copy to clipboard operation
gif.js copied to clipboard

Can I control the render step by step?

Open faace opened this issue 9 years ago • 2 comments

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

faace avatar Feb 18 '16 09:02 faace

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)+"%");
});

:)

am9x avatar Nov 23 '16 08:11 am9x

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();

1j01 avatar Jan 19 '17 02:01 1j01