
書いた星を動かしたいです
この中に組み込みたいと思っています( ; ; )
全然わからなくて困っているので助けてください!
void setup(){
size(800, 800);
background(255);
rect(0,0,800,800);
for (int kazu=0; kazu<50; kazu+=1){
drawStar(30,20);//中心からとげまでの距離
}
}
void drawStar(int Ro,int kosuu){
float vNf = random(5,20); //頂点の数は5-20まででランダム
int vN = int(vNf)*2; //頂点の数
int R; //中心からちょうてん頂点までの距離
int Ri = Ro/2; // 中心から谷間での距離
float Rosf = Ro + random(-Ro/5,Ro/5); int Ros = int(Rosf); color rC = color(random(100,255),random(100,255),random(100,255)); noStroke(); fill(rC,100);
pushMatrix();
translate(width/2+random(-width/2,width/2), height/2+random(-height/2,height/2));
rotate(radians(-90));
for (int ii=0; ii<9; ii+=1){
rotate(PI/9);
scale(1.1);
fill(rC,100-ii10);
beginShape();
for (int i=0; i<vN; i++){
if (i%2 == 0) {
R = Ros;
}
else {
R = Ri;
}
vertex(Rcos(radians(360i/vN)), Rsin(radians(360*i/vN)));
}
endShape(CLOSE);
}
popMatrix();
}
回答1件
あなたの回答
tips
プレビュー