let canvas = document.querySelector('canvas') let ctx = canvas.getContext('2d'); //绘制圆形 ctx.beginPath(); //绘制圆形的方法:x,y,r,起始弧度,结束弧度,是否逆时针绘制 ctx.arc(250,250,20,0,2*Math.PI,true);//radius = 5 //设置填充颜色 ctx.fillStyle = 'red' ; ctx.fill(); //圆形边框宽度 ctx.lineWidth = '15' //边框颜色 ctx.strokeStyle='blue' //绘制边框 ctx.stroke(); ctx.context.closePath();