ジェネラティブアート+繰り返し図形描画で壁紙作成
float angle = 0; int nx, ny; float xnoise = random(1); float ynoise = random(1); int drawMode = 0; void setup() { size(750, 1334); noFill(); stroke(0, 10); background(255); } void draw() { if (drawMode == 0) { gen(); } else if (drawMode == 1) { colorMode(HSB, 360, 100, 100, 100); noStroke(); for (int y = 0; y <= height; y+=100) { for (int x = 0; x <= width; x+=100) { fill(x, 100, 100, 100); moyou1(x, y); } } } } void gen() { translate(width/2, height/2); rotate(angle); nx = (int)(noise(xnoise) * 200); ny = (int)(noise(ynoise) * 200); line(0, 0, nx, ny); xnoise += 0.01; ynoise += 0.01; angle += 0.005; } void moyou1(float x, float y) { pushMatrix(); translate(x, y); //書きたい場所に描画キャンバスを移動 scale(0.5); for (int i = 0; i < 20; i++) { rotate(radians(18)); //18度ずつ回転(360度 / 20) fill(i*18, 100, 100, 30); //1周で360. 色相環が1周する. rect(50, 20, 20, 20); } popMatrix(); } void keyPressed() { if (keyCode==ENTER) { saveFrame("image-####.png"); } else if (key == ' ') { drawMode = 1; } }
Copy