Before you start drawing your lines, call beginPath() :
function drawX(x, y) { ctx.beginPath(); ctx.moveTo(x - 20, y - 20); ctx.lineTo(x + 20, y + 20); ctx.moveTo(x + 20, y - 20); ctx.lineTo(x - 20, y + 20); ctx.stroke(); }
Updated jsFiddle code: http://jsfiddle.net/h4JvJ/23/
Stefan fandler
source share