ctx.clearRect(0, 0, ctx.canvas.width, ctx.canvas.height);
var hours = date.getHours();
var minutes = date.getMinutes();
var seconds = date.getSeconds();
hours = hours > 12 ? hours - 12 : hours;
var hour = hours + minutes / 60;
var minute = minutes + seconds / 60;
ctx.drawImage(clockImage, 0, 0, 500, 500);
ctx.translate(canvas.width / 2, canvas.height / 2);
ctx.textAlign = 'center';
ctx.textBaseline = 'middle';
for (var n = 1; n <= 12; n++) {
var theta = (n - 3) * (Math.PI * 2) / 12;
var x = clockRadius * 0.7 * Math.cos(theta);
var y = clockRadius * 0.7 * Math.sin(theta);
var theta = (hour - 3) * 2 * Math.PI / 12;
ctx.lineTo(clockRadius * 0.5, 1);
ctx.lineTo(clockRadius * 0.5, -1);
var theta = (minute - 15) * 2 * Math.PI / 60;
ctx.lineTo(clockRadius * 0.8, 1);
ctx.lineTo(clockRadius * 0.8, -1);
var theta = (seconds - 15) * 2 * Math.PI / 60;
ctx.lineTo(clockRadius * 0.9, 1);
ctx.lineTo(clockRadius * 0.9, -1);
canvas = document.getElementById('canvas');
ctx = canvas.getContext('2d');
clockImage = new Image();
clockImage.src = 'https://statiwww.jyshare.com/images/mix/125855_nnla_89964.png';
setInterval(drawScene, 1000);