level 1
JLLKº
楼主
float theta;
float a;
float col;
float num;void setup() {
size(600,610);
}void draw() {
background(#F2F2F2);
translate(width/2, height/2);
theta = map(sin(millis()/500.0), -1, 1, 0, PI/6); float num=6;
for (int i=0; i<num; i++) {
a =300;
rotate(TWO_PI/num);
branch(a);
}
}void branch(float len) {
col=map(len, 0, 90, 100, 255);
fill(col, 80, 84);
stroke (col, 80, 84);
line(0, 0, 0, len);
ellipse(0, len, 3, 3);
len*=0.7; if (len>30) {
pushMatrix();
translate(0, -30);
rotate(theta);
branch(len);
popMatrix();
pushMatrix();
translate(0, -30);
rotate(-theta);
branch(len);
popMatrix(); }
}
2018年10月08日 16点10分
1
float a;
float col;
float num;void setup() {
size(600,610);
}void draw() {
background(#F2F2F2);
translate(width/2, height/2);
theta = map(sin(millis()/500.0), -1, 1, 0, PI/6); float num=6;
for (int i=0; i<num; i++) {
a =300;
rotate(TWO_PI/num);
branch(a);
}
}void branch(float len) {
col=map(len, 0, 90, 100, 255);
fill(col, 80, 84);
stroke (col, 80, 84);
line(0, 0, 0, len);
ellipse(0, len, 3, 3);
len*=0.7; if (len>30) {
pushMatrix();
translate(0, -30);
rotate(theta);
branch(len);
popMatrix();
pushMatrix();
translate(0, -30);
rotate(-theta);
branch(len);
popMatrix(); }
}