168
rated 0 times
[
169]
[
1]
/ answers: 1 / hits: 65850
/ 13 Years ago, thu, december 8, 2011, 12:00:00
I want to display a image on canvas and insert a text on top of that image.
window.onload = function() {
var canvas = document.getElementById(myCanvas);
var context = canvas.getContext(2d);
var imageObj = new Image();
imageObj.onload = function() {
context.drawImage(imageObj, 10, 10);
};
imageObj.src = darth-vader.jpg;
context.font = 40pt Calibri;
context.fillText(My TEXT!, 20, 20);
};
I'm getting only an image over here but not the text; the text is behind the image.
How to insert the text on top of the image?
More From » canvas