滑块效果图
改动百分比效果图
思路
首先绘制一个灰色边框的圆
ctx.translate(150,150);//坐标定位至150,150处
ctx.beginPath();
ctx.lineWidth='20';
ctx.strokeStyle='#EEEEEE';
ctx.arc(0,0,radius,0,2*Math.PI);//绘制一个完整的圆
ctx.stroke();
再绘制一个半径一样、圆心一样蓝色的圆
ctx.beginPath();
ctx.rotate(-Math.PI);//逆时针选择一个π
ctx.lineWidth='20';
ctx.strokeStyle='#6699FF';
ctx.arc(0,0,radius,0,move/180*Math.PI);//根据move的大小绘制圆弧
ctx.stroke();
在圆弧上绘制一个小圆作为指示器
//绘制指针小圆
ctx.save();
ctx.rotate(move/180*Math.PI);//根据move的大小旋转