Cocos Creator 创建的图形设置alpha无效

Cocos Creator中,创建了一个图形  fgui.GGraph ,设置其alpha时无效,请问是否正常?

代码如下;
const bg = fgui.UIObjectFactory.newObject(fgui.ObjectType.Graph).asGraph;
this.view.addChildAt(bg, 0);
bg.setSize(fgui.GRoot.inst.width, fgui.GRoot.inst.height);
bg.center();
bg.addRelation(fgui.GRoot.inst, fgui.RelationType.Width);
bg.addRelation(fgui.GRoot.inst, fgui.RelationType.Height);
bg.drawRect(0, this.modalColor, this.modalColor);

// 设置alpha无效
// bg.alpha = 0.5
已邀请:

ankye

赞同来自: 戴家乎

//设置graphics图像alpha值
export function graphAlpha(g:fgui.GGraph,alpha:number):void {
let gp = g.node.getComponent(cc.Graphics);
let color = g.color;
color.a = alpha * 255;
gp.fillColor = color;
gp.stroke();
gp.fill();
}
可以用这种方式修改,不过试了在动画中用这个卡顿明显

谷主

赞同来自:

你看看你的ccc版本多少了。曾经有ccc版本出现过设置透明度无效的。

nepyanbin

赞同来自:

Cocos Creator 2.4.0

zxx178239

赞同来自:

你好,这个问题解决了么? 我用的也是2.4.0版本的,发现fairy gui编辑的动作改变alpha无效

ankye

赞同来自:

2.4试了都不支持修改透明度了,mmp,要改源码,升级引擎挺烦的

要回复问题请先登录注册