canvas安卓阴影显示问题
发布于 7 年前 作者 longping 2600 次浏览 来自 问答

-代码

var me = this;

var CanvasContext = wx.createCanvasContext(‘myCanvas’, this);

var windowWidth = me.data.windowWidth;

var windowHeight = me.data.windowHeight;

var bili = 1;

var centerX = windowWidth / 2;

var gao = (windowHeight * 0.65) * (1 / 3);

var centerY = (windowHeight * 0.65) * (1 / 3);

bili = imageWidth / imageHeight;

var kuan = bili * gao;

CanvasContext.setShadow(10, 15, 1, ‘#000000’);

// CanvasContext.shadowOffsetX = 10;

// CanvasContext.shadowOffsetY = 15;

// CanvasContext.shadowColor = ‘#000000’;

// CanvasContext.shadowBlur = 1;

CanvasContext.drawImage(lingbuPath, 0, 0, kuan + 40, gao + 80, centerX - 20, centerY - 40, kuan + 40, gao + 80);

CanvasContext.setShadow(0, 0, 0, ‘black’);

CanvasContext.drawImage(jutiaoPath, 0, 0, kuan + 5, gao + 5, centerX - 2.5, centerY - 2.5, kuan + 5, gao + 5);

CanvasContext.drawImage(imagePath, 0, 0, imageWidth, imageHeight, centerX, centerY, kuan, gao);

CanvasContext.draw();

开发工具和ios显示正常,安卓显示如下图

  • 当前 Bug 的表现

直接绘制一个矩形,则安卓阴影显示正常

  • 预期表现
1 回复

麻烦提供出现问题的具体机型、微信版本号、系统版本号,以及能复现问题的代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)

回到顶部