async init() {
this.ctx = uni.createCanvasContext('canvas');
this.ctx.clearRect(0, 0, 384.9, 847.45);
for (let i = 0; i < this.data.length - 1; i++) {
let start = this.data[i].split(',')
let end = this.data[i + 1].split(',')
await this.draw(start, end)
}
},
draw(start, end) {
return new Promise((resolve, reject) => {
setTimeout(() => {
let x = start[3] / 20;
let y = start[2] / 20;
let x1 = end[3] / 20;
let y1 = end[2] / 20;
if (start[4] !== '0') {
let width = 1
this.ctx.beginPath()
this.ctx.moveTo(x, y)
this.ctx.lineTo(x1, y1)
this.ctx.closePath();
this.ctx.stroke();
this.ctx.draw()
}
resolve()
}, 0)
})
}

1***@163.com
- 发布:2021-11-19 18:19
- 更新:2024-04-07 00:56
- 阅读:1015
2 个回复
g***@live.cn
老哥,这个问题你之前解决了吗
2***@qq.com
this.ctx.draw() => this.ctx.draw(true)