在for循环中绘制画布 每次旋转之后会往上平移一段距离
ctx.save()
ctx.translate(item.x / 2, item.y / 2)
ctx.strokeRect(0, 0, item.width / 2, item.height / 2)
ctx.translate(item.x / 4, item.y / 4)
ctx.rotate(30 * Math.PI / 180)
ctx.fillRect(-item.x / 4, -item.y / 4, item.width / 2,item.height / 2)
ctx.restore()
图一是不旋转绘制的结果 图二就是如上代码绘制的结果
2***@qq.com (作者)
这个已经不需要 但是uni的画布操作编译到支付宝没有效果
2022-08-13 13:24