年賀状出さないけど、きたものには返すことにしている。
今年も届いたので作るんだけど、せっかくなんでProcessingで犬を描くことにした。
Processingで作る意義として、色と顔とサイズがそれぞれ若干異なる犬を生成できるようにした。
void setup(){
size(1000,1000);
background(255);
}
void draw(){
pushMatrix();
translate(random(-100,width),random(-100,height));
scale(random(1));
dog();
popMatrix();
saveFrame("data/######.png");
}
void dog(){
color a = color(random(100,255),random(100,255),random(255));
color b = color(random(255),random(255),random(255));
color c = color(random(200,255),random(200,255),random(200,255));
color d = color(255,random(255),random(255));
stroke(0);
strokeWeight(2);
fill(a);
beginShape();
vertex(20,30);
quadraticVertex(10,70,50,70);
quadraticVertex(90,70,80,30);
quadraticVertex(80,0,60,20);
quadraticVertex(50,15,40,20);
quadraticVertex(20,0,20,30);
endShape(CLOSE);
fill(b);
beginShape();
vertex(25,28);
quadraticVertex(24,8,35,21);
endShape(CLOSE);
beginShape();
vertex(75,28);
quadraticVertex(76,8,65,21);
endShape(CLOSE);
noStroke();
fill(c);
ellipse(50,55,30,20);
noStroke();
fill(d);
ellipse(30,50,10,5);
ellipse(70,50,10,5);
stroke(0);
strokeWeight(2);
fill(0);
float eyesize = random(1,6);
float nosesize = random(5,10);
ellipse(40,40,eyesize,eyesize);
ellipse(60,40,eyesize,eyesize);
ellipse(50,50,nosesize,nosesize);
stroke(0);
strokeWeight(2);
noFill();
beginShape();
vertex(40,60);
quadraticVertex(50,60,50,50);
quadraticVertex(50,60,60,60);
endShape();
}