How to set opacity when draw with cc.Graphics?

How to set opacity when draw with cc.Graphics?
0.0 0

#1

cc.Color does not support opacity now. So how do I set opacity when draw with cc.Graphics?


#2

http://docs.cocos.com/creator/api/zh/modules/cc.html#color

You can set alpha with cc.color


// 1. All channels seperately as parameters
var color1 = new cc.Color(255, 255, 255, 255);
// 2. Convert a hex string to a color
var color2 = new cc.Color("#000000");
// 3. An color object as parameter
var color3 = new cc.Color({r: 255, g: 255, b: 255, a: 255});

#3

Thanks. It worked! I had thought that cc.Color does not support alpha since Cocos Creator IDE warns that can not set opacity.