开发者

Get variations of a color in AS3

开发者 https://www.devze.com 2023-03-18 01:57 出处:网络
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 any

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

精彩评论

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