Beginners question: toggle between stroke/noStroke
in
Programming Questions
•
2 years ago
I've just started learning processing with Reas & Fry's book and wonder if someone could help me with a little problem?
I've tried to modify example 2-2 in the book "make circles".
I've tried to add key commands for: erase screen, stop, and draw .
I've tried to toggle between stroke/noStroke to create a "eraser".
My key commands works quite good but I wonder how to erase/draw background while in stop mode?
My other question is why I don't get strokeWeight(1); when releasing the mouse?
Thanks!
Michel
void setup() {
size(screen.width,screen.height);
background(80);
smooth();
loop();
noLoop();
}
void draw() {
if (mousePressed) {
noStroke();
fill(80);
} else {
strokeWeight(1);
fill(190);
}
ellipse(mouseX, mouseY, 40, 40);
}
void drawBackground() {
size(screen.width,screen.height);
background(80);
}
void keyPressed() {
if(key== 'e') drawBackground();
if(key== 's') noLoop();
if(key== 'd') loop();
}
1

Michel