ラベル processing の投稿を表示しています。 すべての投稿を表示
ラベル processing の投稿を表示しています。 すべての投稿を表示

2011年1月11日火曜日

Drawing program Ver2 (internal version V3A)

In addition to the drawing ability, this program enable to remember up to 9 drawing.
Try to draw several geometries with left clicks and right click.
After making more than one geometry, hit a 1~9 key of your keyboard.
You will see older geometries.

Because of the system of Blogger, I can not upload the program so that please click the following link to see my program.

http://www.afterpopgallery.toypark.in/programs/drawing-software/

Source Code:

http://www.afterpopgallery.toypark.in/programs/drawing-software/source.txt


2011年1月10日月曜日

practice

Practicing Array.

this program will draw ellipses with color.

the scale, location and color of the ellipses will gradually but randomly change.


int[] circle = {100, 120, 30, 90};
float[] colorManager = new float[3];

void setup(){
size(200, 200);
initialColor();
}
void draw(){
for(int i=0; i<=3; i++){
circle[i] += random(-1,2);
}
for(int i=0; i<=2; i++){
colorManager[i] += random(-2,2);
if ((colorManager[i]>255)||(colorManager[i]<0)){
initialColor();
}
}
fill(colorManager[0],colorManager[1],colorManager[2]);
ellipse(circle[0],circle[1],circle[2],circle[3]);
}


void initialColor(){
for(int i=0; i<=2; i++){
colorManager[i] = random(255);
}
}

practice

practicing Array and Class

drawCircle circle;

float[] ra = new float[2];

void setup(){
size(400, 400);
}

void draw(){
background(125);
randomProcess();
circle = new drawCircle(200, 200, ra[0], ra[1]);
circle.drawC();
}


void randomProcess(){
ra[0]=random(100, 200);
ra[1]=random(150, 180);
}

class drawCircle{
int x;
int y;
float vx;
float hy;
drawCircle(int locationX, int locationY, float verticalScale, float horizonalScale){
x = locationX;
y = locationY;
vx = verticalScale;
hy = horizonalScale;
}
void drawC(){
ellipse(x, y, vx, hy);
}
}

2010年12月26日日曜日

Learning fill command



float R,G,B,A;
int Rcounter=0;
int Gcounter=0;
int Bcounter=0;
int Acounter=0;


void setup(){
size(600,600);
background(0);
R=0;
G=0;
B=10;
A=0;
}

void draw(){
if(Acounter==0){
A++;
if(A==255){
Acounter=1;
}
}
else if (Acounter==1){
A--;
if(A==0){
Acounter=0;
ArandomSection();
}
}

if(Rcounter==0){
R++;
if(R==255){
Rcounter=1;
}
}
else if (Rcounter==1){
R--;
if(R==0){
Rcounter=0;
}
}

if(Gcounter==0){
G++;
if(G==255){
Gcounter=1;
}
}
else if (Gcounter==1){
G--;
if(G==0){
Gcounter=0;
}
}

if(Bcounter==0){
B++;
if(B==255){
Acounter=1;
ArandomSection();
}
}
else if (Bcounter==1){
B--;
if(B==0){
Bcounter=0;
}
}


fill(R,G,B,A);
ellipse(mouseX,mouseY,80,80);
}


void ArandomSection(){
R = random(0,255);
G = random(0,255);
B = random(0,255);
}