0
Javascript canvas image causes TypeError despite using window.onload
I'm trying to import an image to the canvas. I loaded the image in window onload. I tested the image in an <img> tag and it loads. I have no idea why it won't work. I preloaded it and tested the url. https://code.sololearn.com/WK23x01EHA19/?ref=app
2 Answers
+ 4
Youre not drawing an image but youre trying to draw a string. So change the player variable to this
const player = new Image();
player.src = "https://dl.dropbox.com/s/xx9t983ol4jej06/2021-05-09_20.41.09.png?raw=1"
However, you never loaded the image as you claimed in the description
0
Mirielle Thanks