做老師上課示範的程式
程式碼:
void setup(){
size(500,500);
}
void draw(){
float a=5*frameCount/180.0*3.1415926;
background(255);
for(int x=0;x<=500;x+=40){
for(int y=0;y<=500;y+=40){
noFill();ellipse(x,y,40,40);
fill(0); ellipse(x+20*cos(a),y+20*sin(a),8,8);
}
}
}
----------------------------------------
程式碼:
void setup(){
size(500,500);
}
void draw(){
background(255);
for(int x=0;x<=500;x+=40){
for(int y=0;y<=500;y+=40){
float a=5*(frameCount+x/5+y/5)/180.0*3.1415;
noFill();ellipse(x,y,40,40);
fill(0); ellipse(x+20*cos(a),y+20*sin(a),8,8);
}
}
}
----------------------------------------


沒有留言:
張貼留言