This is because you're trying to pass a string (the dataURL version of the image) to drawImage when the drawImage function is expecting an image/canvas. The drawImage function can take in a canvas element as its argument, which will do what you want.Instead of doing: img = canvas.toDataURL(); ctx.drawImage(img, 0,0); Just do: ctx.drawImage(canvas, 0,0);

This animation requires a browser that supports the HTML5 <canvas> feature.