27 lines
420 B
Plaintext
27 lines
420 B
Plaintext
int x = 0;
|
|
color fillColor;
|
|
|
|
void draw() {
|
|
background(0);
|
|
|
|
// Linien zum Markieren der Zone
|
|
stroke(255);
|
|
line(25, 0, 25, height);
|
|
line(75, 0, 75, height);
|
|
|
|
// hier wird animiert...
|
|
fill(fillColor);
|
|
ellipse(x, 50, 20, 20);
|
|
x++;
|
|
if (x > width) {
|
|
x = 0;
|
|
}
|
|
|
|
// Roter Ball
|
|
if (x > 25 && x < 75) {
|
|
fillColor = color(255, 0, 0);
|
|
} else {
|
|
fillColor = color(255);
|
|
}
|
|
}
|