8.581
Bearbeitungen
Jneug (Diskussion | Beiträge) Keine Bearbeitungszusammenfassung |
Jneug (Diskussion | Beiträge) Keine Bearbeitungszusammenfassung |
||
Zeile 494: | Zeile 494: | ||
float[] speeds = new float[10]; | float[] speeds = new float[10]; | ||
color[] colors = new color[10]; | color[] colors = new color[10]; | ||
float[] deltas = new float[10]; | |||
void setup() { | void setup() { | ||
Zeile 503: | Zeile 504: | ||
speeds[i] = random(1, 4); | speeds[i] = random(1, 4); | ||
colors[i] = color(int(random(256)), int(random(256)), int(random(256))); | colors[i] = color(int(random(256)), int(random(256)), int(random(256))); | ||
deltas[i] = random(1000); | |||
} | } | ||
} | } | ||
Zeile 510: | Zeile 512: | ||
for( int i = 0; i < xcoords.length; i++ ) { | for( int i = 0; i < xcoords.length; i++ ) { | ||
float xd = sin(deltas[i] + millis()/350.0) * speeds[i]; | |||
ycoords[i] -= speeds[i]; | ycoords[i] -= speeds[i]; | ||
fill(colors[i]); | fill(colors[i]); | ||
ellipse(xcoords[i], ycoords[i], 20, 40); | ellipse(xcoords[i] + xd, ycoords[i], 20, 40); | ||
if( ycoords[i]+40 < 0 ) { | if( ycoords[i]+40 < 0 ) { | ||
Zeile 519: | Zeile 522: | ||
speeds[i] = random(1, 4); | speeds[i] = random(1, 4); | ||
colors[i] = color(int(random(256)), int(random(256)), int(random(256))); | colors[i] = color(int(random(256)), int(random(256)), int(random(256))); | ||
deltas[i] = random(1000); | |||
} | } | ||
} | } | ||
} | } | ||
{{Lösung:End}} | {{Lösung:End}} |
Bearbeitungen