javascript - Uncaught TypeError: Type error with drawImage -
i new html5 , canvas element , in last few weeks have been trying understand better. anyways getting uncaught typeerror: type error when trying change red square code http://jsfiddle.net/kmhzt/10/ image http://i.imgur.com/k73egsw.png. when try uncaught typeerror: type error. here code have http://jsfiddle.net/ccdfs/.
if need me explain better ask.
you're trying pass url drawimage, can't - need load image element , pass instead, after image has finished loading.
this article has examples of i'm describing.
the code end this:
var img = new image(); img.onload = function() { context.drawimage(img, 2, 2); } img.src = 'http://i.imgur.com/k73egsw.png'; in fact, code when loads , draws tiles.
Comments
Post a Comment