Every time I google this, it gives me answers to the reverse solution - drawing stuff over images. I know how to do this.
My problem is that I want to draw my image over some canvas stuff. No matter what I do, it seems that the drawing always overlaps the image.
Could the problem be that I am doing this in an animation loop, and that is somehow not drawing the image?
You can see my code here. (It's only short).
As you can see, in my draw function I have the image to be drawn AFTER the other stuff is drawn. I checked the image is drawing correctly by commenting out the code and hey presto, the image appears. The drawImage code can be seen below:
var drawCanvasImage = new Image();
drawCanvasImage.src = "https://www.w3.org/html/logo/downloads/HTML5_Logo_256.png";
drawCanvasImage.onload = function(){
ctx.drawImage(drawCanvasImage, 0, 0);
}
Can anyone provide insight into this? Thanks.