const createPixel = this.ctx.getImageData(this.pikaqiuX, this.pikaqiuY, 280, 280)
let data = createPixel.data;
let average = 0;
for (let i = 0; i < data.length; i+=4) {
data[i+3] = 0
}
this.ctx.putImageData(createPixel, this.pikaqiuX, this.pikaqiuY)
把a设置为0,在开发工具上可以透明图像, 在预览中没有发生变化
你好,麻烦提供出现问题的具体机型、微信版本号、系统版本号,以及能复现问题的代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)
片段: https://developers.weixin.qq.com/s/aMZZHBmY70vM
用这个试试呢
https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setGlobalAlpha.html