How to ensure images all loaded before I reference in my HTML canvas [closed]
- by mark stephens
I want to draw some images in on a HTML canvas with
context.drawImage(Im1 ,205,18,184,38);
In order to make sure it loads I need to put in code like this but then I cannot draw things with it
var Im1 = new Image();
Im1.src="rechnung11014page1/img/1/Im1.png";
Im1.onload = function() {
context.drawImage(Im1 ,205,18,184,38);
}
Is there a way…