I draw time on a canvas, but when the time changes, it draws it again. I was thinking about erasing the canvas, but I have other things on it.
function startTime() {
var today = new Date();
var h = today.getHours();
var m = today.getMinutes();
var s = today.getSeconds();
m = checkTime(m);
s = checkTime(s);
ctx.font="20px Arial";
ctx.fillText(h + ':' + m, 4, 24);
var t = setTimeout(startTime, 500);
}
function checkTime(i) {
if (i < 10) {i = "0" + i};
return i;
}
Any help? Thanks!