Beispiel: Meine Lieblingsstädte
String[] cities = new String[5];
PFont font;
void setup() {
size(1920, 1080);
cities[0] = "Paderborn";
cities[1] = "Münster";
cities[2] = "Amsterdam";
cities[3] = "Lisbon";
cities[4] = "Paris";
font = createFont("sans.otf",1000);
}
void draw() {
background(0);
int index = int(map(mouseX,0,width,0,cities.length));
float w = width/cities.length;
noStroke();
fill(#444444);
rect(w*index,0,w,height);
fill(#f1f1f1);
push();
translate(width/2,height/2);
textFont(font);
textSize(300);
textAlign(CENTER,CENTER);
text(cities[index],0,0);
pop();
fill(#ff0000);
ellipse(mouseX,mouseY,40,40);
rec();
}
copy
Smiling Stag