Showing posts with label #hand in. Show all posts
Showing posts with label #hand in. Show all posts

Thursday, 7 June 2012

final

This is my final application!

Stars
http://www.openprocessing.org/sketch/63533





My code

float [] x= new float[100];
float [] y= new float[100];
float [] a= new float[100];
float [] b= new float[100];
float [] xdot= new float[500];
float [] ydot= new float[500];

float r = random (-250,250);
float r2 = random (-250,250);
float r3 = random (-250,250);

float centerX= 250;
float centerY= 250;


void setup() {
  size (500, 500);

    int count = 0;
  while (count<500){
  xdot[count] = random (500);
  ydot[count] = random (500);
  count = count+1;
  }

    int i =0;

  while (i<100) {
  x[i] = 250;
  y[i] = 250;
  a[i] = r2;
  b[i] = r3;
    i=i+1;
  }
  }


void draw() {

  background(0);

    int count = 0;
  while (count<500){
  float R = random (0);
  float G = random (100, 150);
  float B= random (100, 200);
  fill (R, G, B);
  noStroke();
  ellipse (xdot[count], ydot[count], 1, 1);
  count = count+1;
  }

  float R = random (0);
  float G = random (100, 150);
  float B= random (100, 200);
  fill (R, G, B);
  noStroke();
  if (mousePressed == true) {
  float r = 5;

      int i =0;
    while (i<100) {
      x[i]= x[i] + ((mouseX-x[i]) / (5.0 + (i*5.0) ));
      y[i]= y[i] + ((mouseY-y[i]) / (5.0 + (i*5.0) ));

      i=i+1;
    }

    int newcirc = 0;
    int arms=7;
    centerX=centerX+((mouseX-centerX)/50.0);
    centerY=centerY+((mouseY-centerY)/50.0);

    while (newcirc<arms) {
      pushMatrix();
      translate(centerX, centerY);
      rotate((TWO_PI/arms)*newcirc);
      translate(-centerX, -centerY);

        i =0;
      while (i<100) {
        ellipse (x[i], y[i], r, r);
       
        i=i+1;
      }

      popMatrix();

      newcirc=newcirc+1;
      }

    ellipse(centerX, centerY, r, r);
  }


  else {

    float r = 5;
    float t = 5;
    int i =0;
    while (i<100) {
      x[i]= x[i] + ((mouseX-x[i]) / (5.0 + (i*5.0) ));
      y[i]= y[i] + ((mouseY-y[i]) / (5.0 + (i*5.0) ));

      i=i+1;
    }

      int newcirc = 0;
      int arms=7;
    while (newcirc<arms) {
      pushMatrix();
      translate(mouseX, mouseY);
      rotate((TWO_PI/arms)*newcirc);
      translate(-centerX, -centerY);

        i =0;
      while (i<100) {

        fill(R, G, B, t);
        ellipse (x[i], y[i], r, r);
        i=i+1;
      }

      popMatrix();

      newcirc=newcirc+1;
    }
    fill(R, G, B, t);
    ellipse(mouseX, mouseY, r, r);
  }
}

void mousePressed (){
  centerX=mouseX;
  centerY=mouseY;
}



Monday, 30 April 2012

Final hand in

These picture represent the development wich I hv chosen as my final hand in. So I chose my final 8 images out of these. Here is also my final code.

 noise :  int ran = 0

 noise :  int ran =1

 noise :  int ran =2

 noise :  int ran =3

noise :  int ran =5
 noise :  int ran = 10

 noise :  int ran = 25

noise :  int ran =50
 noise :  int ran = 100

noise :  int ran = 200

int x = 55;
int y = 55;
int w1 = 10;
int w2 = -100;
int w2a = 100;
int h1 = -10;
int h2 = 10;
int h2a = -100;

void setup()
{
  size(1020, 1020);
     
  background(255);
   stroke(0);
  int i=0;
 
 
  while (i<200)
  {
    int xoffset = i*85;
   
    int j=0;
   
   
    while(j<100)
    {
      int yoffset = j*85;
     
      float r = 255-j*i*2;
      float g = 255-j*i*2;
      float b = 255;
      fill (r, g, b);
     
       /*
       float r = random(77,170);
      float g = random(21,135);
      float b = random(12,77);
      fill (r, g, b);
      */
     
     
      /*color from = color(77, 21, 12);
      color to = color(170, 135, 77);
      color interA = lerpColor(from, to, random(0.0, 1.0));
      fill(interA);*/
     
     
     
      int ran  = 0;

       float r1 = random(-ran,+ran);
       float r2 = random(-ran,+ran);

      strokeWeight(random(1,1));
        
      beginShape();
      vertex(xoffset + x  +r1  , y + yoffset+h1  +r2  );//1
      vertex(xoffset + x+w1+(w2/2)-(w2a/2)  +r1  , yoffset+ y+h1+h2/2-(h2a/2)  +r2  );//2
     
      r1 = random(-ran,+ran);
      r2 = random(-ran,+ran);
      vertex(xoffset + x+w1  +r1  , y+yoffset+random(-ran,+ran)  +r2  );//3
      vertex(xoffset + x+w1+w2  +r1  , y+yoffset+random(-ran,+ran)  +r2  );//4
     
      r1 = random(-ran,+ran);
      r2 = random(-ran,+ran);
     
      vertex(xoffset + x+w1+(w2/2)+(w2a/2)  +r1  , y+h1+h2/2-(h2a/2)+yoffset+random(-ran,+ran)  +r2  );//5
      vertex(xoffset + x+w1*2+w2  +r1  , y+h1+yoffset+random(-ran,+ran)  +r2  );//6
     
      r1 = random(-ran,+ran);
      r2 = random(-ran,+ran);
     
      vertex(xoffset + x+w1*2+w2  +r1  , y+h1+h2+yoffset+random(-ran,+ran)  +r2  );//7
      vertex(xoffset + x+w1+(w2/2)+(w2a/2)  +r1  , y+h1+h2/2+(h2a/2)+yoffset +random(-ran,+ran)  +r2  );//8
     
      r1 = random(-ran,+ran);
      r2 = random(-ran,+ran);
     
      vertex(xoffset + x+w1+w2  +r1  , y+h1*2+h2 +yoffset+random(-ran,+ran)  +r2  );//9
      vertex(xoffset + x+w1  +r1  , y+h1*2+h2 +yoffset+random(-ran,+ran)  +r2  );//10
     
      r1 = random(-ran,+ran);
      r2 = random(-ran,+ran);
     
      vertex(xoffset + x+w1+(w2/2)-(w2a/2)  +r1  , y+h1+h2/2+(h2a/2) +yoffset+random(-ran,+ran)  +r2  );//11
      vertex(xoffset + x  +r1  , y+h1+h2 +yoffset+random(-ran,+ran)  +r2  );//12
      endShape(CLOSE);
        
      /*beginShape();
      vertex(xoffset + x+random(-ran,+ran), y + yoffset+h1+random(-ran,+ran));//1
      vertex(xoffset + x+w1+(w2/2)-(w2a/2)+random(-ran,+ran), yoffset+ y+h1+h2/2-(h2a/2)+random(-ran,+ran));//2
     
      vertex(xoffset + x+w1+random(-ran,+ran), y+yoffset+random(-ran,+ran));//3
      vertex(xoffset + x+w1+w2+random(-ran,+ran), y+yoffset+random(-ran,+ran));//4
     
      vertex(xoffset + x+w1+(w2/2)+(w2a/2)+random(-ran,+ran), y+h1+h2/2-(h2a/2)+yoffset+random(-ran,+ran));//5
      vertex(xoffset + x+w1*2+w2+random(-ran,+ran), y+h1+yoffset+random(-ran,+ran));//6
     
      vertex(xoffset + x+w1*2+w2+random(-ran,+ran), y+h1+h2+yoffset+random(-ran,+ran));//7
      vertex(xoffset + x+w1+(w2/2)+(w2a/2)+random(-ran,+ran), y+h1+h2/2+(h2a/2)+yoffset +random(-ran,+ran));//8
     
      vertex(xoffset + x+w1+w2+random(-ran,+ran), y+h1*2+h2 +yoffset+random(-ran,+ran));//9
      vertex(xoffset + x+w1+random(-ran,+ran), y+h1*2+h2 +yoffset+random(-ran,+ran) );//10
     
      vertex(xoffset + x+w1+(w2/2)-(w2a/2)+random(-ran,+ran), y+h1+h2/2+(h2a/2) +yoffset+random(-ran,+ran) );//11
      vertex(xoffset + x+random(-ran,+ran), y+h1+h2 +yoffset+random(-ran,+ran));//12
      endShape(CLOSE);*/
     
     
     
      /*beginShape();
      vertex(xoffset + x, y + yoffset+h1);//1
      vertex(xoffset + x+w1+(w2/2)-(w2a/2), yoffset+ y+h1+h2/2-(h2a/2));//2
     
      vertex(xoffset + x+w1, y+yoffset);//3
      vertex(xoffset + x+w1+w2, y+yoffset);//4
     
      vertex(xoffset + x+w1+(w2/2)+(w2a/2), y+h1+h2/2-(h2a/2)+yoffset);//5
      vertex(xoffset + x+w1*2+w2, y+h1+yoffset);//6
     
      vertex(xoffset + x+w1*2+w2, y+h1+h2+yoffset);//7
      vertex(xoffset + x+w1+(w2/2)+(w2a/2), y+h1+h2/2+(h2a/2)+yoffset );//8
     
      vertex(xoffset + x+w1+w2, y+h1*2+h2 +yoffset);//9
      vertex(xoffset + x+w1, y+h1*2+h2 +yoffset );//10
     
      vertex(xoffset + x+w1+(w2/2)-(w2a/2), y+h1+h2/2+(h2a/2) +yoffset );//11
      vertex(xoffset + x, y+h1+h2 +yoffset);//12
      endShape(CLOSE);*/
     
     
      smooth();
     
      j=j+1;
    }

    i=i+1;
  }
 
}

void draw()
{
 
}

void mousePressed (){
  save (selectOutput()+".png");
}