开发者

Get variations of a color in AS3

I download a script and in it, it had this code which generates a variation of green. I am not sure I understand it. I would like to modify it to get a desired color with different variations. Can anyone explain th开发者_C百科is snippet to me?

var color:uint = 0 | int(getRandom(80, 256)) << 8 | 0;


I figured it out.

There are three different colors in the uint. RGB.

var color = RED << 16 | GREEN << 8 | BLUE;

That makes up a color in which you can use. To make the example above generate a random yellow color I would just use:

var color = int(getRandom(180, 255)) << 16 | int(getRandom(180, 230)) << 8 | 0;
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜