実行結果
操作方法
- JARファイルを実行したら、ウィンドウ内でマウスポインタを動かす。
- マウスポインタの周りを追尾するように、小さな円が大きな円を描いてくるくるまわります。
ソースコード
int[] posx = new int[30];
int[] posy = new int[30];
float arg = 0;
void setup(){
for(int i=0;i<30;i++){
posx[i] = 0;
posy[i] = 0;
}
size(800,600);
noStroke();
}
void draw(){
if(arg>=TWO_PI) arg = 0f;
for(int i=29;i>0;i--){
posx[i] = posx[i-1];
posy[i] = posy[i-1];
}
posx[0] = (int)(mouseX + 100*cos(arg));
posy[0] = (int)(mouseY + 100*sin(arg));
background(0);
for(int i=29;i>=0;i--){
float r = (1-(float)i/30);
fill(255*r);
ellipse(posx[i], posy[i],20*r,20*r);
}
arg += 0.1;
}
最終更新:2009年01月29日 17:23