This question is a few years old, but for those who still come by, here is a link to an addon for p5.js, which I wrote, that makes working with large canvases very easy. (Panning and zooming without redrawing)p5.js addon named p5.5