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
没有找到相关结果
已邀请:
5 个回复
ankye
赞同来自: 戴家乎
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();
}
可以用这种方式修改,不过试了在动画中用这个卡顿明显
谷主
赞同来自:
nepyanbin - 80后IT男
赞同来自:
zxx178239
赞同来自:
ankye
赞同来自: