xxxxxxxxxx
47
// based on Interation of Color by Josef Albers
// chapter 4 exersize
let value = 0;
function mouseDragged(){
if(mouseX > width/2 && value < width){
value += 10;
} else if (mouseX < width/2 && value > 0){
value -= 10;
}
}
function setup() {
createCanvas(400, 500);
}
function draw() {
background(220);
noStroke();
//light blue bg
fill(124,185,232);
rect(0,0, width, height/2);
// orange bg
fill(255,110,0);
rect(0,height/2, width, height);
// dark blue bar
fill(0, 36, 156);
rect(value, height/2-100, width, 100);
// yellow bar
fill(255, 255, 51);
rect(value, height/2, width, 100);
// dk brown squares
fill(146, 103, 71);
rect(width/2.25, 100, 50, 50);
rect(width/2.25, 350, 50, 50);
}