October 18, 2007

proce55ing plactice02

p5_plactice02.jpg

proce55ing / plactice02

クリックするとランダムに形が変わります。

p5_plactice02-1.jpg

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;
}

参考 : Built with Processingデザイン/アートのためのプログラミング入門

posted by yuta : 06:04 PM | comments (1)

October 16, 2007

proce55ing plactice01

p5_plactice01.jpg

proce55ing / plactice01

バリバリの初心者ですが今更proce55ingの練習など…。

Source code: plactice01
.........................................................................

float xx , yy; //位置
float Cx , Cy; //中心
float Angle; //角度
float R; //半径

void setup(){
size(500,500);
background(0);
colorMode(RGB,256);
noStroke();
frameRate(30);

Cx = width / 2;
Cy = height / 2;
Angle = 60;
R = 360;
}

void draw(){
fadeToWhite();

Angle += 3;
xx = Cx + (R * sin(radians(Angle)) );
yy = Cy + (R * cos(radians(Angle)) );

int x = int(random(width));
int y = int(random(height));
int sz = int(random(40));
int angle = 1;
int x_margin = 1;

translate(-150,460);

for(int i=680 ; i > 0 ; i--){

fill(randomRGBColor());
smooth();
pushMatrix();
translate(i*x_margin,150-i);
rotate(radians(i*angle));
rect(xx,yy,sz/10,sz/10);
popMatrix();
}
}

color randomRGBColor(){
color c = color(random(256),random(256),random(256));
return c;
}

void fadeToWhite(){
rectMode(CORNER);
fill(0,2);
rect(0,0,width,height);
}

参考 : Built with Processingデザイン/アートのためのプログラミング入門

posted by yuta : 07:29 PM | comments (31)