My issue is that I am having problems loading locally hosted images on to the canvas. I have tried hosting the code on a web server, using XAMPP, and locally, and the LightB
For me, putting the src after, makes things WORSE.. and here's the thing - in my case this is being updated every 25ms. Two needles first (not shown) then this little round cover over the needles.
The needles work absolutely every time - the top appears when it sees fit.
ctx.save();
ctx.beginPath();
ctx.translate(cX, cY);
if (centre.complete) ctx.drawImage(centre, kn1, kn2, kn3, kn4);
else centre.onload = function () { ctx.drawImage(centre, kn1, kn2, kn3, kn4); }
ctx.restore();