- 20
- 0
let canvasNode = document.getElementById('canvas'),
ctxs = canvasNode.getContext("2d");
console.log(canvasNode)
class CircleProgress {
constructor(ctxs, width, height, arc) {
this.ctx = ctxs
this.ctx.canvas.width = width
this.ctx.canvas.height = width
this.arc = arc
}
clearFill() {
this.ctx.clearRect(0, 0, this.width, this.width);
}
fillBg() {
this.ctx.beginPath();
this.ctx.lineWidth = this.arc;
this.ctx.strokeStyle = '#ccc';
this.ctx.arc(this.width / 2, this.width / 2, 45, 0, 2 * Math.PI);
this.ctx.stroke();
}
fillArc(x) {
this.ctx.beginPath();
this.ctx.lineWidth = this.arc;
this.ctx.strokeStyle = '#ccc';
this.ctx.arc(this.width / 2, this.width / 2, 45, -90 * Math.PI / 180, (x * 3.6 - 90) * Math.PI / 180);
this.ctx.stroke();
}
fillText(x) {
this.ctx.font = '14px' + ' Arial';
this.ctx.fillStyle = 'red';
this.ctx.textBaseline = "middle";
this.ctx.textAlign = 'center';
this.ctx.fillText(x.toFixed(1) + '%', this.width / 2, this.width / 2);
}
fill(x) {
this.fillBg();
this.fillArc(x);
this.fillText(x);
}
testFn() {
return this.ctx
}
}
let cicle = new CircleProgress(ctxs, 100, 100, 10)
cicle.fill(100) 0
打赏
收藏
点击回答
网站公告
- 扫一扫访问手机版
回答动态

- 神奇的四哥:发布了悬赏问题阿里云幻兽帕鲁服务器更新之后。服务器里面有部分玩家要重新创建角色是怎么回事啊?预计能赚取 0积分收益

- 神奇的四哥:发布了悬赏问题函数计算不同地域的是不能用内网吧?预计能赚取 0积分收益

- 神奇的四哥:发布了悬赏问题ARMS可以创建多个应用嘛?预计能赚取 0积分收益

- 神奇的四哥:发布了悬赏问题在ARMS如何申请加入公测呀?预计能赚取 0积分收益

- 神奇的四哥:发布了悬赏问题前端小程序接入这个arms具体是如何接入监控的,这个init方法在哪里进行添加?预计能赚取 0积分收益

- 神奇的四哥:发布了悬赏问题阿里云幻兽帕鲁服务器刚到期,是不是就不能再导出存档了呢?预计能赚取 0积分收益

- 神奇的四哥:发布了悬赏问题阿里云幻兽帕鲁服务器的游戏版本不兼容 尝试更新怎么解决?预计能赚取 0积分收益

- 神奇的四哥:发布了悬赏问题阿里云幻兽帕鲁服务器服务器升级以后 就链接不上了,怎么办?预计能赚取 0积分收益

- 神奇的四哥:发布了悬赏问题阿里云幻兽帕鲁服务器转移以后服务器进不去了,怎么解决?预计能赚取 0积分收益

- 神奇的四哥:发布了悬赏问题阿里云幻兽帕鲁服务器修改参数后游戏进入不了,是什么情况?预计能赚取 0积分收益
- 回到顶部
- 回到顶部
