View Full Version : Check this out...what am i doing here?
NazWeb
12-13-2001, 09:46 PM
r = random(10);
g = random(10);
b = random(10);
col = r.r.g.g.b.b;
I must be thinking wrong--but Im trying to create a random RGB value -- I figured i could concenate these values to make a RGB number--but nothing is showing up...am I doing something wrong with this?
thanks tv
r = random(255);
g = random(255);
b = random(255);
x = (r*256*256)+(g*256)+(b);
myColor = new Color("newMC"+count);
myColor.setRGB(x);
i believe this came out of one of the toots on this site, used it a long time ago, and i take crappy notes.
NazWeb
12-14-2001, 03:20 AM
I figured it out ..thanks for the hellp, that would probably work,,
what I did is made the rgb variables -- char. data instead of numeric so that I could use the + sign to combine the variable, whereas if they were numeric they would have just added together...thanks for your help!
tv
here is the code :(showing just the B part--R&G are the same):
if (i ==1) {
...(R&G up here)...
b = random(6);
if (b == 1 || b==0) {
b = "f";
}
if (b == 2) {
b = "c";
}
if (b == 3) {
b = "0";
}
if (b == 4) {
b = "6";
}
if (b == 5) {
b = "9";
}
col=r+r+g+g+b+b;
myColor = new Color(light);
myColor.setRGB(parseInt(col, 16));
this worked,,, I will change some more things to make this movie more interesting but here is what I did it for - www.tvance.net/flasher.html --I was bored and am out of work (SO if you have any projects you want a good coder w/ PHP and MYSQL and other knowledge--email me) so I thought i would do somethin..
peace. tv
|
vBulletin® v3.8.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.