func drawNiddles(ctx *canvas.CanvasRenderingContext2D, r int) { hourR := float64(r - 30) minuteR := float64(r - 20) secondR := float64(r - 13) now := time.Now() hourAngle := (1 - float64(now.Hour()%12)/12) * math.Pi * 2 minuteAngle := (1 - float64(now.Minute())/60) * math.Pi * 2 secondAngle := (1 - float64(now.Second())/60) * math.Pi * 2 rotateAngle := math.Pi ctx.Save() ctx.Rotate(int(-1 * rotateAngle)) ctx.StrokeStyle = "black" ctx.LineWidth = 4 ctx.MoveTo(0, 0) ctx.LineTo(int(hourR*math.Sin(hourAngle)), int(hourR*math.Cos(hourAngle))) ctx.Stroke() ctx.LineWidth = 2 ctx.MoveTo(0, 0) ctx.LineTo(int(minuteR*math.Sin(minuteAngle)), int(minuteR*math.Cos(minuteAngle))) ctx.Stroke() ctx.LineWidth = 1 ctx.MoveTo(0, 0) ctx.LineTo(int(secondR*math.Sin(secondAngle)), int(secondR*math.Cos(secondAngle))) ctx.Stroke() ctx.Restore() }