Venetian blinds
in
Programming Questions
•
1 year ago
i am trying to make blinds that when you click on the end of the string the, it follows the mouse location and when you pull the string down the blinds go up.. revealing a window.
i am currently stuck on making the string follow my mouse. if i mess with the background it either makes another square next to the original square or does nothing at all but erases the lines.
int y = 0;
void setup() {
size(200,200);
background(255);
}
void draw() {
//draw blinds
while (y < height) {
stroke(1);
line(0,y,width,y);
y = y + 5;
}
//draw string
line (150,60,150,0);
strokeWeight(1);
//draw button at end of string
rectMode(CENTER);
fill(0);
rect(150,60,10,10);
}
void mousePressed() {
if (mouseX > 150 && mouseX < 150+10 && mouseY > 55 && mouseY < 55+10) {
rect(mouseX,mouseY,10,10);
}
}
1