本文介绍了canvas如何绘制钟表的方法,分享给大家,具体如下: 效果图为 上代码: var canvas = document.getElementById('canvas'); var ctx = canvas.getContext('2d'); var year,month,day,hour,second,minute; // 绘制表盘 function drawClockPie(){ ctx.beginPath(); ctx.lineWidth = 2; ctx.strokeStyle = '#333'; ctx.arc(150,150,146,0,