Hello all, I am doing a recreation of Pink Floyd’s famous album with a twist - I want every time the mouse is pressed, the colors on the spectrum random and change. This is what I have so far:
PImage img;
PFont helvetica;
PFont helveticaBold;
String band = "PINK FLOYD";
String title = "DARK SIDE OF THE MOON";
color randomC = color(random(1,360),random(1,360),random(1,360));
void setup() {
size (600,600);
img = loadImage ("data/bg.jpg");
helvetica = loadFont ("data/Helvetica-48.vlw");
helveticaBold = loadFont ("data/Helvetica-Bold-48.vlw");
smooth();
}
void draw() {
album();
}
void album() {
//Background image
image(img, 0, 0);
//Album name and band
fill(#FFF7C9);
textLeading(80);
textFont(helveticaBold);
textSize(17);
text(band, 55, 80);
textFont(helvetica);
textSize(17);
text(title, 355,80);
//Triangle
noFill();
stroke(#FFF7C9);
strokeWeight(9);
triangle(300,183,419,390,180,389);
//Left side line
fill(#FFF7C9);
noStroke();
beginShape();
vertex(0,294);
vertex(234,294);
vertex(227,306);
vertex(0,306);
endShape();
colorMode(HSB);
noStroke();
fill(randomC);
quad(355,270,600,270,600,280,360,280);
fill(randomC);
quad(360,280,600,280,600,290,366,290);
fill(randomC);
quad(366,290,600,290,600,300,372,300);
fill(randomC);
quad(372,300,600,300,600,310,378,310);
fill(randomC);
quad(378,310,600,310,600,320,384,320);
}
void mousePressed(){
redraw();
}
I want these quads to change their colors every time I press the button:
fill(randomC);
quad(355,270,600,270,600,280,360,280);
fill(randomC);
quad(360,280,600,280,600,290,366,290);
fill(randomC);
quad(366,290,600,290,600,300,372,300);
fill(randomC);
quad(372,300,600,300,600,310,378,310);
fill(randomC);
quad(378,310,600,310,600,320,384,320);
I under I need to make randomC different each time? Also, currently the redraw() function I have there doesn’t do anything.
Thanks for any help!