HTML Canvas Images
Canvas - Images
To draw an image on a canvas, use the following method:
- drawImage(image,x,y)
Example
JavaScript:
window.onload =
function() {
const canvas = document.getElementById("myCanvas");
const ctx = canvas.getContext("2d");
const img = document.getElementById("scream");
ctx.drawImage(img, 10, 10);
};
Try it Yourself »
See Also:
Copyright 1999-2023 by Refsnes Data. All Rights Reserved.