Hey Guys,
I’m trying to do some demo project. What I’d like to do is draw some lines and a rectangle. Those part of the lines will be invisible which are out of the rectangle. I give the end-coordinates of the lines by clicking. I’m using noLoop() because I want to draw the line just before the second end-coordinate is given.
void setup() {
size(800, 800);
noLoop();
}
I want to move the rectangle by pressing a key. Because of the noLoop() function the KeyPressed() function is not working. If I delete the noLoop() the processing keeps drawing lines as I’m moving the mouse.
void setup() {
size(800, 800);
background(100,10,10);
noLoop();
}
void draw(){
if ( (frameCount & 1) == 0 ) {
point(mouseX, mouseY);
return;
}
strokeWeight(1);
DrawARect(x3, y3, x4, y4); //it's a custom function which draws a rectangle
cuting_F(pmouseX, pmouseY, mouseX, mouseY); // it cuts out the part of the lines which are outside the rect.
//and a bunch of code goes here...
}
I’d to store the lines even if they are not visible now, and unhide the parts ofthem if the rectangle is moved into the right spot. Do you have any idea how to do it?