xxxxxxxxxx
42
let hue1 = 0;
let hue2 = 90;
function setup() {
createCanvas(windowWidth, windowHeight);
colorMode(HSL, 360, 100, 100, 100);
noStroke();
background(220);
}
//Use two forward slashes to create a comment. This technique also enables you to comment out or deactiviate blocks of code. The shortcut for do so is to highlight line or lines of code and pressed Cmd or Ctrl + /
function draw() {
background(220);
//Break in quarters
//rect 1
fill(hue1, 100, 50);
rect(0, 0, width/2, height/2);
//rect2
fill(hue2, 100, 50);
rect(width/2, 0, width/2, height/2);
}
//how to press mouse once and keep change
function mousePressed(){
if (mouseX < width/2 && mouseY < height/2){
//random color change
hue1 = random(360)
}
if (mouseX > width/2 && mouseY < height/2){
hue2 = random(360)
}
}