HTML Canvas Images
googletag.cmd.push(function() { googletag.display('div-gpt-ad-1422003450156-2'); });
HTML Canvas Images
❮ Previous
Next ❯
Canvas - Images
To draw an image on a canvas, use the following method:
- drawImage(image,x,y)
Example
JavaScript:
window.onload =
function() {
var canvas = document.getElementById("myCanvas");
var ctx = canvas.getContext("2d");
var img = document.getElementById("scream");
ctx.drawImage(img, 10, 10);
};
Try it Yourself »
❮ Previous
Next ❯