
September 20th, 2012, 06:42 AM
|
 |
Contributing User
|
|
Join Date: Sep 2012
Posts: 148
Time spent in forums: 18 h 39 m 9 sec
Reputation Power: 1
|
|
|
Canvas image & text (click problem)
Hi!
I've tried everything to get this working. I have to click the button that calls the draw function twice for the text to appear, only the image appears on the first click now..
Code:
function draw(){
var canvas = document.getElementById('myCanvas');
var context = canvas.getContext('2d');
var picture = new Image();
picture.onload = function(){
context.drawImage(picture, 0, 0, 1280, 720);
context.font="70px Lobster";
context.fillText(document.myForm.naam.value, 100, 150);
}
picture.src = 'images/picture.jpg';
}
|