Closed Nickstr closed 7 years ago
var gif = new GifEncoder(420, 240); var canvas = new Canvas(420, 240); var ctx = canvas.getContext('2d'); gif.start(); gif.setRepeat(0); gif.setDelay(500); gif.setTransparent('#000000'); gif.setDispose(2) ctx.fillStyle = 'yellow'; ctx.fillRect(43, 34, 100, 100); gif.addFrame(ctx); ctx.fillStyle = 'red'; ctx.fillRect(0, 0, 100, 100); gif.addFrame(ctx); ctx.fillStyle = 'blue'; ctx.arc(150,150,50,0,Math.PI*2,true); ctx.fill(); gif.addFrame(ctx); gif.finish();
Result:
I expected it to dispose frames when it goes to the next one and only show 1 shape per frame.
@Nickstr You must clear the canvas between frames to have the desired effect.
Result:
I expected it to dispose frames when it goes to the next one and only show 1 shape per frame.