Lektion 2

This commit is contained in:
2023-09-27 18:25:19 +02:00
parent c00b7c1e38
commit 4c00f4785c
4 changed files with 70 additions and 0 deletions

View File

@@ -0,0 +1,24 @@
int d = 50;
boolean touched = false;
void setup() {
size(400,400);
}
void draw() {
background(255);
ellipse(width/2, height/2, d, d);
// increase and decrease ellipse
if (d < width && touched == false) {
d++;
} else if (d > 50 && touched == true) {
d--;
}
// switch between increasing and decreasing
if (touched == true && d == 50) {
touched = false;
}
if (d == width) {
touched = true;
}
}