2009年6月16日 星期二

MIDTERM ON PROCESSING

THESE ARE MY WORK BEFORE MID-TERM, 2009 SPRING SEMESTER,
HOPE YOU ENJOY THE SORTING AND THE METHOD RETYPING!!
AND HOPE IT IS NOT TO LATE FOR HANDING IN...

PICTUREPSEUDO CODE / code / -METHOD
SIZE=400,400
BACKGROUND=BLACK

(1,1)=WHITE
FOR I=0;I IS LESS THAN WIDTH;I++, J=0;J IS LESS THAN HEIGHT;J++
{
INT X=RANDOM(0 TO 2)
IF( X IS 0 )
COLOR OF (I,J) = COLOR OF (I,J-1)
ELSE
COLOR OF (I,J) = COLOR OF (I-1,J)
}

//A CERTAIN CHANCE MAKES THE WHITE DOT (1,1)
//GROW TO THE BOTTOM RIGHT
SAME AS ABOVE,
THE ONLY DIFFERENCE IS ADDING A FOR-LOOP
TO MAKE THE DEFAULT WHITE DOTS COVERED ON TOP AND LEFT SIDES
void setup(){
size(400,400);
background(255);
}

void draw(){
int [][] a = new int[width][height];
int b = 0;
int c = 0;
for(int j=0;j"<"width;j++){ a[j][c++] = (b++)%255; } c = 0; for(int i=0;i"<"width;i++){ stroke(a[i][c++]); point(i,0); } for(int j=1;j"<"height;j++){ for(int i=0;i"<"width;i++){ stroke(get(i,j-1)); point((i+1)%width,j); } } }
-ARRAY FOR JPG TO FIT IN
-RANDOM COLOR
-TINTING EACH JPG
LOOKS LIKE THE FAMOUS PIECE FROM ANDY WARHOL!
SIZE=400,400
BACKGROUND=WHITE

//SET FIRST ROW'S COLOR TO BLACK
FOR J=0;J"<"WIDTH;J++ (J,0)=BLACK; //GIVE9999/10000CHANCE TO LET BLACK GROW ONE PIXEL DOWNWARDS FOR I=0;I"<"WIDTH;I++, J=1;J"<"HEIGHT;J++ {{ X = RANDOM(0 TO 10000); IF(X=0) DO NOTHING; ELSE COPY COLOR FROM (I,J-1) TO (I,J) }}
for(int k=0;k"<"width/5;k++){ for(int l=0;l"<"height/5;l++){ stroke(cell[k][l]); point(k+i*width/5,l+j*height/5); } } -COPY (J,K) TO (J+WIDTH/5,K) -COPY (J,K) TO (K,K+HEIGHT/5)...ETC
VER.1

VER.2
void setup(){
size(400,400);
background(255);
}
void draw(){
int [][] cell = new int [width/5][height/5];
int [][] form =
{{1,2,1,2,1},
{2,3,2,3,2},
{3,4,3,4,3},
{2,3,2,3,2},
{1,2,1,2,1},};
for(int i=0;i"<"width/5;i++){ j="0;j" i="0;i<5;i++){" j="0;j<5;j++){" k="0;k" l="0;l">
-RANDOM START POINT OF LINE
-RANDOM LENGTH OF LINE (=SQRT(2X^2))
SHORT DURATION

LONG DURATION
-RANDOM START POINT OF LINE
-RANDOM LENGTH OF LINE
-RANDOM SLOPE OF LINE
-INCREASES ALONG TIME DURATION
VER.1

VER.2

VER.3
" void setup(){
size(400,400);
background(0);
noLoop();
}

void draw(){
for(int i=1;i"<"width;i++){ for(int j=1;j"<"height;j++){ if(i == j){ stroke((get(i-1,j-1)+int(random(10)))%255); point(i,j); } else if(i "<" j){ stroke((get(i,j-1)+int(random(10)))%255); point(i,j); } else if(i ">" j){
stroke((get(i-1,j)+int(random(10)))%255);
point(i,j);
}
}
}
for(int i=0;i"<"width;i++){ for(int j=0;j"<"height;j++){ float c = saturation(get(i,j)); stroke(c); point(i,j); } } }"
"
void setup(){
size(400,400);
background(0);
}
void draw(){
noStroke();
fill(0, 10);
rect(0, 0, width, height);

stroke(random(255));
curve(0.0, 0.0, random(width), random(height), random(width), random(height), float(width), float(height));
}
void mousePressed(){
loop();
}
void mouseReleased(){
noLoop();
}

"
"
void setup(){
size(400,400);
background(0);
}
void draw(){
noStroke();
fill(0, 20);
rect(0, 0, width, height);

stroke(random(255));
curve(random(width), random(height), 0, 0, width, height, random(height), random(height));
curve(random(width), random(height), 0, width, height, 0, random(height), random(height));
curve(random(width), random(height), width/2, 0, width/2, height, random(height), random(height));
curve(random(width), random(height), 0, height/2, width, height/2, random(height), random(height));
}

void mousePressed(){
loop();
}
void mouseReleased(){
noLoop();
}

"

沒有留言:

張貼留言