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 : October 18, 2007 06:04 PM
comments

“All the better. It’s an animal I detest,” said Lord Lambeth.
ミュウミュウ 財布 がま口 http://mikunicard.com/guide/miumiubags2.php

Posted by: ミュウミュウ 財布 がま口 : December 10, 2013 06:09 PM
コメントする









名前、アドレスを登録しますか?