lunes, 2 de abril de 2012

Aplicacion y composicion animada

int posicion=0;

void setup() {
size(500,300);
frameRate(50);
smooth();
background(255);
stroke(255);
noFill();
}

void draw() {
posicion++;
strokeWeight(random(20));

stroke(random(0), random(206), random(255),random(30));
ellipse(40,0,posicion,posicion);

stroke(random(128), random(42), random(160),random(30));
ellipse(40,300,posicion,posicion);

stroke(random(0), random(206), random(255),random(30));
ellipse(460,300,posicion,posicion);

stroke(random(128), random(42), random(160),random(30));
ellipse(460,0,posicion,posicion);

stroke(random(227), random(217), random(27),random(30));
ellipse(250,150,posicion,posicion);

if (posicion > width) {

posicion = 0;

}
}



domingo, 25 de marzo de 2012

1er ejercicio processing marzo 2012

int option = 1;
 
void setup() {
 
size(400, 300);
 
smooth();
 
noFill();
 
}
 
 
 
void draw() {
 
background(255);
 
 
 
if (option == 1) {
 
// Option 1: Stitches
 
for (int x = 50; x <= width-50; x += 20) {
 
for (int y = 50; y <= height-50; y+=20) {
 
line(x-5, y-5, x+5, y+5);
 
line(x+5, y-5, x-5, y+5);
 
}
 
}
 
}
 
else if (option == 2) {
 
// Option 2: Perspective
 
for (int x = 50; x <= width-50; x += 20) {
 
for (int y = 50; y <= height-50; y+=20) {
 
line(x, y, width/2, height/2);
 
}
 
}
 
}
 
else if (option == 3) {
 
// Option 3: Overlapping circles
 
for (int x = 50; x <= width-50; x += 20) {
 
for (int y = 50; y <= height-50; y+=20) {
 
ellipse(x, y, 40, 40);
 
}
 
}
 
}
 
else if (option == 4) {
 
// Option 4: Rotating arcs
 
int count = 120;
 
for (int x = 50; x <= width-50; x += 20) {
 
for (int y = 50; y <= height-50; y+=20) {
 
float s = map(count, 120, 0, 0, TWO_PI*2);
 
arc(x, y, 14, 14, s, s + PI);
 
count--;
 
}
 
}
 
}
 
else if (option == 5) {
 
// Option 5: Groups of fiv
for (int x = 50; x < width-50; x += 20) {
for (int y = 50; y < height-50; y+=20) {
//rect(x-10, y-10, 22, 22);
for (int i = 0; i < 16; i+=4) {
line(x + i, y, x + i, y + 12);
}
line(x, y, x + 12, y + 12);
}
}
}
 
else if (option == 6) {
   
for (int x = 50; x < width-50; x += 20) {
for (int y = 50; y < height-50; y+=20) {
rect(x-10, y-10, 22, 22);
for (int i = 0; i < 16; i+=4) {
line(x-9, y-5, x+10, y+9);
line(x+9, y-5, x-10, y+9);
}
}
}
}
 
else if (option == 7) {
  for (int x = 5; x < width-5; x += 10) {
    for (int y = 5; y < height-5; y += 5) {
      line(x, y, x + 10, y + 10);
    }
  }
}
 
else if (option == 8) {
  for (int x = 5; x < width-5; x +=10) {
    for (int y = 5; y < height-5; y +=10) {
    ellipse(x, x, 40, 40);
    line(x, y, x + 10, y + 10);
    ellipse(x+60, x, 40, 40);
    ellipse(x+120, x, 40, 40);
    ellipse(x+240, x, 40, 40);
    ellipse(x+180, x, 40, 40);
    ellipse(x+300, x, 40, 40);
    ellipse(x+360, x, 40, 40);
    ellipse(x-60, x, 40, 40);
    ellipse(x-120, x, 40, 40);
    ellipse(x-180, x, 40, 40);
    ellipse(x-240, x, 40, 40);
    ellipse(x-300, x, 40, 40);
    ellipse(x+410, x, 40, 40);
  }
  }
}
 
else if (option == 9) {
  for (int x = 5; x < width-5; x +=10) {
    for (int y = 5; y < height-5; y +=10) {
    ellipse(x, x, 40, 40);
    ellipse(x+60, x, 40, 40);
    ellipse(x+120, x, 40, 40);
    ellipse(x+240, x, 40, 40);
    ellipse(x+180, x, 40, 40);
    ellipse(x+300, x, 40, 40);
    ellipse(x+360, x, 40, 40);
    ellipse(x-60, x, 40, 40);
    ellipse(x-120, x, 40, 40);
    ellipse(x-180, x, 40, 40);
    ellipse(x-240, x, 40, 40);
    ellipse(x-300, x, 40, 40);
    ellipse(x+410, x, 40, 40);
     
    }
  }
}
 
else if (option == 10) {
   
  for (int x = 5; x < width-5; x +=10) {
    for (int y = 5; y < height-5; y +=10) {
      ellipse (x,y,40,10);
    }
  }
}
 
else if (option == 11) {
   
  for (int x = 50; x < width-50; x +=20) {
    for (int y = 50; y < height-50; y +=20) {
      ellipse (x,y,40,10);
    }
  }
}
 
else if (option == 12) {
   
  for (int x = 50; x < width-50; x +=20) {
    for (int y = 50; y < height-50; y +=20) {
      ellipse (x,y,10,40);
    }
  }
}
 
 
 
else if (option == 13) {
   
  for (int x = 50; x < width-50; x +=20) {
    for (int y = 50; y < height-50; y +=20) {
      ellipse (x,y,40,10);
      ellipse (x,y,10,40);
    }
  }
}
 
}
 
 
 
void mousePressed() {
 
option++;
 
if (option > 13) option = 1;
 
}

miércoles, 16 de noviembre de 2011

PImage imagen;
void setup(){
size(400,450,P3D);
imagen = loadImage("tipas.jpg");
noStroke();

background(0);

}
void draw(){

color este;
int x = int( random(400) );
int y = int( random(450) );
este = imagen.get( x , y );
fill( red(este) , green(este) , blue(este) , 100 );

float lado = random(3,20);
smooth();
noLights();
translate( x , y , lado );
sphere(10);

}
void mousePressed(){
background(255);

}





PImage imagen;
void setup(){
size(400,450);
imagen = loadImage("tipas.jpg");
noStroke();

background(0);

}
void draw(){

color este;
int x = int( random(400) );
int y = int( random(450) );
este = imagen.get( x , y );
fill( red(este) , green(este) , blue(este) , 100 );
stroke(este);
float lado = random(3,20);
smooth();
ellipse( x , y, lado , lado );
}
void mousePressed(){
background(0);

}



martes, 15 de noviembre de 2011

3D para examen

void setup(){

    size(500,500,P3D);
    background(#FFD700);
    fill(#C71585);

}
void draw(){

   
  translate( random(width) , random(height) , 0 );

lights();
noStroke();
   
   
    sphere(30);
   
}
void mousePressed(){

    background(#C71585);
    fill(#FFD700);
    translate( random(width) , random(height) , 0 );

lights();
noStroke();
   
    sphere(30);
   

}

void keyPressed(){

    background(#FFD700);
    fill(#C71585);
    translate( random(width) , random(height) , 0 );

lights();
noStroke();
   
    sphere(30);

}





practicando 3D para EXAMEN


void setup(){
size(500,500,P3D);
background(0);
stroke(255,150,20);
smooth();
lights();
}

void draw(){

translate(300, 250, 62);
rotateY(0.6);
rotateX(0.6);
box(120);
sphere(85);

translate(-150, -100, 0);
sphere(33);

translate(120, -100,0);
sphere(55);

translate(-120,250,0);
sphere(20);

}
void mousePressed() {
  translate(mouseX,mouseY,1);
sphere(20);
}

algo de variables


int x=150;


void setup() {
size(200,200);
background(#269884);
}
void draw() {
if(mousePressed){
line(20,20,180,180);
fill(#5CF511);
ellipse(100,100,20,20);
}

else{
fill(#C10225);
ellipse(50,50,90,90);
ellipse(150,150,90,90);
fill(#FC8B00);
triangle(20,30,80,10,60,90);
triangle(180,120,160,110,180,100);
}
}