GMU:Actors, Traces, Collectives/SS17/Schachbrettmuster Array: Difference between revisions
From Medien Wiki
(Created page with "<syntaxhighlight lang=javaScript> int [][] rectPos; void setup () { size (800, 800); noLoop(); rectPos = new int [width/20][height/20]; } void draw() { for (int j...") |
m (Max moved page GMU:Actors, Traces, Collectives/Schachbrettmuster Array to GMU:Actors, Traces, Collectives/SS17/Schachbrettmuster Array: gleicher kurs im WS) |
||
(One intermediate revision by one other user not shown) | |||
Line 1: | Line 1: | ||
<syntaxhighlight lang=javaScript> | <syntaxhighlight lang="javaScript"> | ||
int [][] rectPos; | int [][] rectPos; | ||
Line 27: | Line 27: | ||
} | } | ||
} | } | ||
</syntaxhighlight | </syntaxhighlight> |
Latest revision as of 21:29, 13 August 2017
int [][] rectPos;
void setup () {
size (800, 800);
noLoop();
rectPos = new int [width/20][height/20];
}
void draw() {
for (int j = 0; j < height /20; j ++) {
for (int i =0; i < width/20; i ++) {
rectPos [i][j] = rectPos [i][j] + 20*i;
if (i%2==0&&j%2==0) {
fill(0);
}else if(i%2!=0&&j%2!=0){
fill(0);
}else{
fill (255);
}
rect (i*20, j*20, 20, 20 );
}
}
}