+ 1
Why the image is not showing on the canvas?
Link to the code https://code.sololearn.com/WtHQUQskQ0tp/?ref=app
1 Answer
+ 10
Here's how I fixed the JavaScript section:
window.onload = () => {
var cvs=document.getElementById("canvas");
var ctx=cvs.getContext("2d");
var image= new Image;
image.onload = () => {
ctx.drawImage(image,10,10);
}
image.src="https://upload.wikimedia.org/wikipedia/commons/4/4b/Phaethon_lepturus_-Midway_Atoll%2C_USA_-flying-8.jpg";
};