I am trying to fix some awful flickering issues and normally one would create a tempCanvas to do all the drawing and then copy it to the real one.
I tried to hack something like that together but I am getting weird results. Is it even possible to do this?
Normally one would do this (from: https://stackoverflow.com/a/10357038/1214469):
// canvas element in DOM
var canvas1 = document.getElementById('canvas1');
var context1 = canvas1.getContext('2d');
// buffer canvas
var canvas2 = document.createElement('canvas');
canvas2.width = 150;
canvas2.height = 150;
var context2 = canvas2.getContext('2d');
// create something on the canvas
context2.beginPath();
context2.moveTo(10,10);
context2.lineTo(10,30);
context2.stroke();
//render the buffered canvas onto the original canvas element
context1.drawImage(canvas2, 0, 0);