tg marcus
tg marcus

Reputation: 167

What is wrong with my drawImage function?

I cant seem to get my drawimage function to work on my canvas. I tried using the onload method I tried using the file on the application. Nothing seems to work, however. All I want to do is print the image from the url into my canvas.

Upvotes: 2

Views: 49

Answers (1)

Lebster
Lebster

Reputation: 309

Change line 5 to let image = document.createElement("img");

When drawing images to a canvas you must provide an image element, created with document.createElement or stored in your index.html

Upvotes: 2

Related Questions