Canvas | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
+ 1

Canvas

How to add image in canvas

24th Jan 2019, 3:51 AM
Praveen Lakra
Praveen Lakra - avatar
1 Antwort
+ 1
Try this: var img = new Image(); img.onload = function() { context.drawImage(img, x, y); }; img.src = "example.jpg"; The x and y coordinates are where to insert the image, "example.jpg" is a link to the image.
24th Jan 2019, 4:56 AM
Игорь Яковенко
Игорь Яковенко - avatar