- 2007年10月18日 18:04
- proce55ing
proce55ing / plactice02
クリックするとランダムに形が変わります。
Source code: plactice02
.........................................................................
float X,Y; //位置
float Cx,Cy; //中心
float Ang1,Ang2; //動きの角度
float R1,R2; //動きの半径
float Rot1,Rot2; //速度
void setup(){
size(400,400);
colorMode(RGB,100);
background(0);
noStroke();
frameRate(120);
Cx = width / 2;
Cy = height / 2;
Ang1 = Ang2 = 0;
R1 = random(90);
R2 = 51;
Rot1 = random(3);
Rot2 = random(25);
}
void draw(){
Ang1 += Rot1;
Ang2 += Rot2;
float rx = Cx + (R1*sin(radians(Ang1)) );
float ry = Cy + (R1*cos(radians(Ang1)) );
X = rx + (R2*sin(radians(Ang2)) );
Y = ry + (R2*cos(radians(Ang2)) );
rectMode(CENTER);
fill(randomRGBColor());
smooth();
rect(X,Y,2,2);
}
void fadeToWhite(){
rectMode(CORNER);
fill(0,100);
rect(0,0,width,height);
}
void mousePressed(){
if(mouseButton == LEFT){
R1 = random(50)+20;
Rot1 = random(5)+1;
Rot2 = random(50)+3;
fadeToWhite();
}
}
color randomRGBColor(){
color c = color(random(256),random(256),random(256));
return c;
}
- Newer: [ DScratch ]
- Older: Sunset