我正在尝试Konva.Rect
用作图像过滤器的叠加层。当使用带有透明色标的径向渐变时,在 IOS 模拟器上它可以完美运行,但在设备上它无法识别透明并用纯色填充它。
我尝试使用transparent
,rgba(0,0,0,0)
但结果是一样的。有什么替代方法可以尝试吗?
这是我的示例代码;
this.filterOverlay = new Konva.Rect({
name: 'overlayRect',
width: this.backgroundImage.width() * this.backgroundImage.scaleX(),
height: this.backgroundImage.height() * this.backgroundImage.scaleY(),
globalCompositeOperation: 'multiply',
fillRadialGradientStartPoint: { x: this.backgroundImage.width()/2, y: this.backgroundImage.height()/2 },
fillRadialGradientStartRadius: 0,
fillRadialGradientEndPoint: { x: this.backgroundImage.width()/2, y: this.backgroundImage.height()/2 },
fillRadialGradientEndRadius: this.backgroundImage.width()-100,
//fillRadialGradientColorStops: [0, 'transparent', 0.8, 'transparent', 1, '#222222'],
fillRadialGradientColorStops: [0, 'rgba(0,0,0,0)', 0.8, 'rgba(0,0,0,0)', 1, '#222222'],
});
this.baseLayer.add(this.filterOverlay);
this.baseLayer.draw();