beginner exercise
in
Programming Questions
•
1 year ago
Hi,
As a total beginner with Processing, I created an exercise for myself. The idea is that a line will be drawn from (100, 50) to (mouseX, mouseY), starting with a blue background, and everytime the mouse is clicked the background changes color. So I got it to change from blue to green, but I can't figure out how to change to a third background color on the next mouse click. Can anyone help me with this?
Also, I don't understand why the drawing starts with a line from the upper left corner to the point of the first line at 100, 50. Can someone explain where the code is for this?
Here's what I have so far:
void setup() {
size(400, 400);
stroke(175, 200, 0, 150);
strokeWeight(8);
smooth();
background(0, 0, 200);
}
void draw() {
smooth();
line(100, 50, mouseX, mouseY);
saveFrame("output.png");
}
void mousePressed() {
background(0, 175,40);
smooth();
}
THANKS, in advance, for your help!
As a total beginner with Processing, I created an exercise for myself. The idea is that a line will be drawn from (100, 50) to (mouseX, mouseY), starting with a blue background, and everytime the mouse is clicked the background changes color. So I got it to change from blue to green, but I can't figure out how to change to a third background color on the next mouse click. Can anyone help me with this?
Also, I don't understand why the drawing starts with a line from the upper left corner to the point of the first line at 100, 50. Can someone explain where the code is for this?
Here's what I have so far:
void setup() {
size(400, 400);
stroke(175, 200, 0, 150);
strokeWeight(8);
smooth();
background(0, 0, 200);
}
void draw() {
smooth();
line(100, 50, mouseX, mouseY);
saveFrame("output.png");
}
void mousePressed() {
background(0, 175,40);
smooth();
}
THANKS, in advance, for your help!
1