...
| Code Block | ||||
|---|---|---|---|---|
| ||||
void setup() {
size(200600, 200400);
}
void draw() {
loadPixels();
// loop through all rows
for (int xy=0; x<widthy<height; xy++) {
// loop through all columns per row
for (int yx=0; y<heightx<width; yx++) {
// calculate pixel location in list
int loc = x+y*width + x;
// set color depending on if color is dividable by two (even, odd)
if (x%2x%10 == 0) {
pixels[loc] = color(255);
} else {
pixels[loc] = color(0);
}
}
}
updatePixels();
}
|
Wenn wir das für jeden zweiten zenten x-Wert machen erhalten wir beispielsweise folgendes Bild:
Aufgaben
- Versucht andere Muster mit Hilfe des Pixel-Arrays zu zeichnen.
- Versucht folgendes Muster mit der gelernten Methode zu zeichnen:
...
