var canvas = document.getElementById('canvas'); var ctx = canvas.getContext('2d'); clock(); function clock() { var date = new Date(); var hour = date.getHours(); var min = date.getMinutes(); var sec = date.getSeconds(); ctx.clearRect(0, 0, 300, 300); ctx.save(); ctx.translate(150, 150); ctx.strokeStyle = '#666'; var pitch = Math.PI * 2 / 12; for (var i = 0; i < 12; i++) { ctx.beginPath(); ctx.line