94.hatenadiary.jp
これをいじった。
camera()は受け取る数値が多い(9種類)ので、使うのが億劫。
最近買ったサンプラーを触ってばかりいたので更新が滞っている。
案件が終わったら記事にする。
float a = 0;
int b = 1;
float c = 0.1;
int re = 100;
void setup(){
size(500,500,P3D);
reset();
}
void draw(){
background(255);
translate(width/2,height/2);
float R = sin(radians(frameCount));
for(int i = 0;i<360;i+=5){
pushMatrix();
rotateY(radians(i+a));
translate(0,0,100*R);
rotateX(radians((i+a)*b));
strokeWeight(1);
line(0,re*R,0,0,-re*R,0);
translate(0,re*R,0);
fill(0);
sphere(2);
translate(0,-re*2*R,0);
fill(0);
sphere(2);
popMatrix();
}
camera(100*sin(radians(frameCount)),
50 -50*cos(radians(frameCount/2)),
-200*cos(radians(frameCount*3)),
width/2,height/2,0,
0,1,0);
a+=c;
if(R < 0.01 && R > -0.01){
reset();
}
}
void reset(){
b = int(random(1,5));
c = random(0.1,0.7);
re = int(random(20,300));
println(b,c,re);
}