Lektion 2
This commit is contained in:
24
Lektion 2/Logische_Operatoren/Pulsieren/Pulsieren.pde
Normal file
24
Lektion 2/Logische_Operatoren/Pulsieren/Pulsieren.pde
Normal 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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user