brt
Full Member
Offline
Posts: 101
question about random color!
May 10th , 2009, 3:15pm
Hey guys! im new in this forum, and im new into programming.
i started today and after playing a little with the drawing tools i started programing random appearing of ellipses and stuff and then i wanted to make a random color change to every ellipse and i got to this code
import processing.video.*; MovieMaker mm; //------ random color ----- float hUE = random(50, 280)/5; float sAT = random(50,100); float bRT= random(40,80); float Rincrement = hUE; float Gincrement = sAT; float Bincrement = bRT; //---- random position float xoff = random(20, 255); float yoff = random(10, 255); float aoff = random(1, 255); float boff = random(10, 255); float xincrement = yoff*2000; float yincrement = xoff*2000; //---- ----- ------- ------ void setup(){ size(720,576); colorMode(HSB); mm = new MovieMaker(this, width, height, "randomcores7.mov", 30); background(255); smooth(); } void draw(){ fill(hUE,sAT,bRT,90); noStroke(); mm.addFrame(); float a = random(10,100); float b = random(100,500); float d = noise(xoff,yoff)*1000; float e = noise(yoff,xoff)*800; ellipse(d,e, a,a); xoff += xincrement; yoff+= yincrement; hUE += Rincrement/5; sAT += Gincrement*2; bRT += Bincrement*2; } void keyPressed() { if (key == ' ') { mm.finish(); // Finish the movie if space bar is pressed! } }
which i found that it doesn't work that bad, but instead of going completly random, i get kind of random but going towards red.... so i fugure i would divide the float .... but i can't get it to not stay in red once it gets there...
sorry if my english isn't that good and don't mind the names like hUE or Rincrement ( it was because i was working with rgb before, and it was an increment in red.... :s)
if somebody could help me it would be great
thanks in advanced