Grille et choix aléatoires
| Artiste | Œuvre | Année |
|---|---|---|
| Zdenek Sykora | Structure | 1976 |
Publié dans Computer Graphics and Art (Mai 1976)
noStroke()
const S = 80;
for (let x = 0; x < width/S; x++) {
for (let y = 0; y < height/S; y++) {
const choice = floor(random() * 10);
const bright = random() > 0.5
fill(bright ? 255 : 0)
rect(x*S, y*S, S)
fill(bright ? 0: 255)
switch(choice) {
case 0: // two horizontally opposed arcs
arc(x * S, (y+0.5) * S, S, S, PI*1.5, HALF_PI)
arc((x+1) * S, (y+0.5) * S, S, S, HALF_PI, PI*1.5)
break;
case 1: // two vertically opposed arcs
arc((x+0.5) * S, y * S, S, S, 0, PI)
arc((x+0.5) * S, (y+1) * S, S, S, PI, TWO_PI)
break;
case 2: // single horizontal arc (on left)
arc(x * S, (y+0.5) * S, S, S, PI*1.5, HALF_PI)
break;
case 3: // single horizontal arc (on left)
arc((x+1) * S, (y+0.5) * S, S, S, HALF_PI, PI*1.5)
break;
case 4: // single vertical arc (on top)
arc((x+0.5) * S, y * S, S, S, 0, PI)
break;
case 5: // single vertical arc (on bottom)
arc((x+0.5) * S, (y+1) * S, S, S, PI, TWO_PI)
break;
case 6: // two aligned horizontals arcs (on right)
arc(x * S, (y+0.5) * S, S, S, PI*1.5, HALF_PI)
arc((x+0.5) * S, (y+0.5) * S, S, S, PI*1.5, HALF_PI)
break;
case 7: // two aligned horizontals arcs (on left)
arc((x+05) * S, (y+0.5) * S, S, S, HALF_PI, PI*1.5)
arc((x+1) * S, (y+0.5) * S, S, S, HALF_PI, PI*1.5)
break;
case 8: // two aligned verticals arcs (on bottom)
arc((x+0.5) * S, y * S, S, S, 0, PI)
arc((x+0.5) * S, (y + 0.5) * S, S, S, 0, PI)
break;
case 9: // two aligned verticals arcs (on top)
arc((x+0.5) * S, (y + 0.5) * S, S, S, PI, TWO_PI)
arc((x+0.5) * S, (y + 1) * S, S, S, PI, TWO_PI)
break;
}
}
}