I want to play gif inside the canvas. I used the following code. bt it does not work. plz tel me wat is wrong in my code or any other way of doing this.
var drawingCanvas = document.getElementById('myDrawingCanvas'); if(drawingCanvas.getContext) { var context = drawingCanvas.getContext('2d'); var imgObj = new Image(); imgObj.onload = function () { context.drawImage(imgObj, 0, 0, 1024, 600); } imgObj.src='HTML Images/Spell Bee/images/mainscreen.gif'; }
source share