miércoles, 9 de noviembre de 2011

código con musica

    
              
int kolor=0;
float Xmono, Ymono, Xojo1, Yojo1, Xojo2, Yojo2;
import ddf.minim.*;

AudioPlayer player;
Minim minim;

void setup() {
  size(600, 600);
  background(0);
  rectMode(CENTER);
  minim = new Minim(this);
 

  player = minim.loadFile("caca.mp3", 2048);
  // play the file
  player.play();
  Xmono=width/2;
  Ymono=height/2;
}
void draw() {
  background(0);
  for (int i=0;i<width+20;i+=10) {
    line(i, mouseY, mouseX, i);
    stroke(kolor, mouseY, mouseX);
    strokeWeight(4);
    smooth();
    if (kolor>256)kolor=10;
    else
      kolor= kolor + 4;
  }



  Xojo1=map(mouseX, -width, width, Xmono-51, Xmono-9);
  Yojo1=map(mouseY, -height, height, Ymono-51, Ymono-9);
  Xojo2=map(mouseX, width, -width, Xmono+31, Xmono-12);
  Yojo2=map(mouseY, -height, height, Ymono-51, Ymono-9);
  fill(240);
  ellipse(Xmono, Ymono, 120, 120);
  fill(0);
  rect(width/2-20, height/2-20, 30, 30);
  rect(width/2+20, height/2-20, 30, 30);
  fill(255);
  rect(Xojo1, Yojo1, 9, 9);
  rect(Xojo2, Yojo2, 9, 9);
  fill(0);
  rect(Xmono, Ymono+27, 30, 10);
}

void stop()
{
  // always close Minim audio classes when you are done with them
  player.close();
  minim.stop();
 
  super.stop();
}

adelanto examen

código para el examen falta colocar sonido

http://openprocessing.org/visuals/?visualID=45516
exxxxxxxaaaaaammmmeeeeeennnnnn

int kolor=0;
float Xmono,Ymono,Xojo1,Yojo1,Xojo2,Yojo2;
void setup(){
  size(600,600);
  background(0);
  rectMode(CENTER);
  Xmono=width/2;
  Ymono=height/2;
}
void draw(){
      background(0);
      for(int i=0;i<width+20;i+=10){
      line(i,mouseY,mouseX,i);
      stroke(kolor,mouseY,mouseX);
      strokeWeight(4);
      smooth();
      if (kolor>256)kolor=10;
      else
      kolor= kolor + 4;
      }
  
  
  
  Xojo1=map(mouseX,-width,width,Xmono-51,Xmono-9);
  Yojo1=map(mouseY,-height,height,Ymono-51,Ymono-9);
  Xojo2=map(mouseX,width,-width,Xmono+31,Xmono-12);
  Yojo2=map(mouseY,-height,height,Ymono-51,Ymono-9);
  fill(240);
  ellipse(Xmono,Ymono,120,120);
  fill(0);
  rect(width/2-20,height/2-20,30,30);
  rect(width/2+20,height/2-20,30,30);
  fill(255);
  rect(Xojo1,Yojo1,9,9);
  rect(Xojo2,Yojo2,9,9);
  fill(0);
  rect(Xmono,Ymono+27,30,10);

}

martes, 27 de septiembre de 2011

ante- proyecto.

para mi ante-proyecto quisiera trabajar en Processin con variables, y con estas poder realizar una calculadora.

miércoles, 7 de septiembre de 2011

=)

size (500,500);
fill(8,253,50);
ellipse (50,50,50,50);
fill (5,114,245);
ellipse (70,70,70,70);
fill (237,194,19);
ellipse (90,90,90,90);
fill (255,3,19);
ellipse (99,110,110,110);
fill (250,149,255);
ellipse (100,130,130,130);
fill(249,250,10);
ellipse (110,150,150,150);
fill (180,180,162);
ellipse (115,170,170,170);
fill (3,211,250);
ellipse (120,190,190,190);
fill (198,11,4);
ellipse (125,210,210,210);
fill (0,4,64);
ellipse (130,230,230,230);
fill (27,147,96);
ellipse (135,250,250,250);
fill (99,240,19);
ellipse (140,230,230,230);
fill (156,173,146);
ellipse (145,210,210,210);
fill (151,77,162);
ellipse (150,190,190,190);
fill (7,0,8);
ellipse (155,170,170,170);
fill (232,227,131);
ellipse (160,150,150,150);

miércoles, 31 de agosto de 2011

PROCESSING clase

ROBOT



size (800, 440);
smooth ();
strokeWeight (2);
background (204);
ellipseMode (RADIUS);
// neck
stroke (102); //setea groosor a gris
line (266,257,266, 162); //izquieerdo
line (276, 257, 276, 162); //mitad
line (286,257,286,162); // derecho

//antena
line (276,155,246,112); //pequeño
line (276,155,306,56); //alto
line (276,155,342,170); //medio

//cuerpo
noStroke (); //
fill (102); //setea relleno a gris
ellipse (264,377,33,33); //orbita
fill (0); //rellenar cn  negro
rect (219,257,90,120); // cuerpo robot
fill (102); // setea relleno a gris 
rect (219, 274,90,6); //raya gris

//cabeza
fill (0);
ellipse (276,155,45,45);
fill (255);
ellipse (288,150,14,14); //tamaño ojo
fill (0); //seta relleno a negro
ellipse (288,150,3,3); //pupila
fill (153); 
ellipse (263,148, 5,5); //ojo 1
ellipse (296,130,4,4); //ojo2
ellipse (305,163,3,3);

 EDICIÓN ROBOT

size (800, 440);
smooth ();
strokeWeight (2);
background (204);
ellipseMode (RADIUS);
// neck
stroke (#CC0000); //setea groosor a gris
line (266,257,266, 162); //izquieerdo
line (276, 257, 276, 162); //mitad
line (286,257,286,162); // derecho

//antena
line (276,155,246,112); //pequeño
line (276,155,306,56); //alto
line (276,155,342,170); //medio

//cuerpo
noStroke (); //
fill (#009900); //setea relleno a gris
ellipse (264,377,33,33); //orbita
fill (#FFFF00); //rellenar cn  negro
rect (219,257,90,120); // cuerpo robot
fill (#3300FF); // setea relleno a gris 
rect (219, 274,90,6); //raya gris

//cabeza
fill (#FF00FF);
ellipse (276,155,45,45);
fill (255);
ellipse (288,150,14,14); //tamaño ojo
fill (#00CC00); //seta relleno a negro
ellipse (288,150,3,3); //pupila
fill (#000099); 
ellipse (263,148, 5,5); //ojo 1
ellipse (296,130,4,4); //ojo2
ellipse (305,163,3,3);


martes, 16 de agosto de 2011

PROCESSING

Color Demo
size(300, 300);

background(0);


noStroke();

fill(225, 0, 0);

rect(0, 0, 100, 50);

fill(0, 80, 0);

rect(100, 0, 100, 50);

fill(150, 150, 255);

rect(200, 0, 100, 50);

fill(128);

rect(0, 50, 300, 100);

Rect Demo
size(300, 300);
noStroke();
background(0);
rect(75, 10, 50, 150);
rectMode(CENTER);
fill(185);
rect(20, 100, 40, 55);
rectMode(CORNERS);

Ellipse mode 



size(700, 700);
noStroke();
background(0);
smooth();
ellipseMode(CORNER);
ellipse(75, 10, 50, 150);
ellipseMode(CENTER);
fill(185);
noSmooth();
ellipse(50, 100, 100, 55);
smooth();
ellipseMode(CORNERS);
fill(64);
ellipse(0, 155, 200, 190);
rectMode(CORNERS);
noFill();
strokeWeight(2);
stroke(255);
rect(0,155,200,190);

CIRCULOS
void setup (){
size(480,120);
smooth (); }
void draw (){
if (mousePressed){
fill (0);
}else {
fill (255);
}
ellipse (mouseX, mouseY, 80, 80);
}

INTERSECCIÓN
void setup (){
size(680,320);
smooth (); }
void draw (){
if (mousePressed){
fill (#FF0000);
}else {
fill (#99FF00);
}
rect (mouseX, mouseY, 80, 80);
}


void setup(){
size (400, 400);
}
void draw(){
line (pmouseX, pmouseY, mouseX, mouseY);
}

void setup(){
size(400,400);
smooth();
background(0);
frameRate(30);
}
void draw(){
stroke(mouseX, 0 , mouseY); 
float distance = dist(pmouseX, pmouseY, mouseX, mouseY);
float maxStroke = 15;
strokeWeight(maxStroke - constrain(distance, 0, maxStroke));
line(pmouseX, pmouseY, mouseX, mouseY);
}
void mouseClicked(){

fill(mouseY, 255, mouseX);
noStroke();
rect(mouseX, mouseY, 30, 30);
}
void keyPressed(){

background(0);
}