float TILE_SIZE = 32;
void setup() {
size(512,512);
colorMode(HSB, 360, 100, 100);
background(200, 80, 80);
noLoop();
TILE_SIZE = width / (width / 32);
}
void draw() {
for (float y = 0; y < height + TILE_SIZE; y += TILE_SIZE) {
for (float x = 0; x < width + TILE_SIZE; x+= TILE_SIZE) {
noStroke();
fill(lerp(190,200,noise(x / 100, y / 100)), 100, 100);
rect(x, y, TILE_SIZE, TILE_SIZE);
stroke(0, 0, 90);
strokeWeight(2);
noFill();
if (random(1) > 0.5f) {
arc(x, y, TILE_SIZE, TILE_SIZE, radians(0), radians(90));
arc(x + TILE_SIZE, y + TILE_SIZE, TILE_SIZE, TILE_SIZE, radians(180), radians(270));
} else {
arc(x + TILE_SIZE, y, TILE_SIZE, TILE_SIZE, radians(90), radians(180));
arc(x, y + TILE_SIZE, TILE_SIZE, TILE_SIZE, radians(270), radians(360));
}
arc(x, y, TILE_SIZE / 2, TILE_SIZE / 2, radians(0), radians(90));
arc(x + TILE_SIZE, y + TILE_SIZE, TILE_SIZE / 2, TILE_SIZE / 2, radians(180), radians(270));
arc(x + TILE_SIZE, y, TILE_SIZE / 2, TILE_SIZE / 2, radians(90), radians(180));
arc(x, y + TILE_SIZE, TILE_SIZE / 2, TILE_SIZE / 2, radians(270), radians(360));
}
}
for (float y = 0; y < height + TILE_SIZE; y += TILE_SIZE) {
stroke(0, 0, 80);
strokeWeight(1);
line(0, y, width ,y);
}
for (float x = 0; x < width + TILE_SIZE; x+= TILE_SIZE) {
stroke(0, 0, 80);
strokeWeight(1);
line(x, 0, x, height);
}
}
void mousePressed() {
saveFrame("tiling-######.png");
}
複雑なパターンにみえるけど、1種類のタイルをランダムな向きに敷き詰めているだけ。
#Processing