求助一个processing的问题,挺急的,求指导
processing吧
全部回复
仅看楼主
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
level 1
JLLKº 楼主
theta = map(sin(millis()/500.0), -1, 1, 0, PI/6); float num=6;
这句里的 millis()是什么,,,为什么要再加个sin()
2018年10月08日 16点10分 2
level 1
JLLKº 楼主
void branch(float len)
这里的len是什么,为什么之后反复出现
2018年10月08日 16点10分 3
level 1
糖果架你好
2018年10月09日 09点10分 4
level 11
millis()是获取毫秒数据,void branch(float len)里面的len是一个自定义的变量,相当于方程里面的x,你定义了之后,后面肯定要用的啊。这些都是基础的知识,建议你可以看看官方的参考文档。
2018年10月10日 14点10分 6
1