Danilo y su Imagen por Rebote

De Casiopea
Danilo y su imagen por círculos



TítuloDanilo y su imagen por círculos
Tipo de ProyectoProyecto de Curso
Palabras Clavetarea 6, Danilo Garrido
Del CursoImagen Escrita 2012,
CarrerasDiseño Gráfico"Diseño Gráfico" is not in the list (Arquitectura, Diseño, Magíster, Otra) of allowed values for the "Carreras Relacionadas" property.
Alumno(s)Danilo Garrido
ProfesorHerbert Spencer

consiste en una imagen que se forma con un conjunto de círculos de colores que siguen un trayecto, y que la velocidad del trayecto depende de el arrastre del mouse



 PFont tipografia;
 int d = 50;   //diámetro
int c; //color
float sec= random(10,50); //variable que aumentará la velocidad

float posX;
float posY;

float xspeed = 2+sec;  
float yspeed = 2+sec;  
int xdirection = 1;  
int ydirection = 1;

void setup (){
  size (600,600);
  tipografia= createFont("arial",12);
  textFont (tipografia,12);
  background(100,10);
  smooth();
frameRate(100);
   posX = random(100,120);
  posY = random (100,140);
c= color(255);
text("Presiona Click izquierdo para iniciar imagen",10,10);
text("Presiona Click Derecho Para Borrar",300,10);
text("Click+Mover el Mouse Para Cambiar velocidad",300,560);
text("Soltar Click Para Nomralizar Velocidad",300,580);
text("Presiona A Para Color Azul",10,520);
text("Presiona R Para Color Rojo",10,540);
text("Presiona B Para Color Blanco",10,560);
text("Presiona Y Para Color Amarillo",10,580);
text("Presiona N Para Color Negro",300,520);
text("Presiona V Para Color Verde",300,540);
stroke(255);

}
void draw (){
 
   
 posX = posX +(xspeed * xdirection);
  posY = posY +(yspeed * ydirection);
  
  
     if (posX > 500-d || posX < 0) {
    xdirection *= -1;
  }
      if (posX < 150-d || posX < 0) {
    xdirection *= -1;
  }
 if (posY < 150-d || posY < 0) {
    ydirection *= -1;
  }
  
  if (posY > 450-d || posY < 0) {
    ydirection *= -1;
  }
   if (mouseButton==RIGHT){
    background(100,10);
      xspeed = 2.8-sec;
      yspeed = 2.1-sec;  
      posX=random (100,120);
      posY=random (100,140);
fill(255);
      text("Presiona Click izquierdo para iniciar imagen",10,10);
text("Presiona Click Derecho Para Borrar",300,10);
text("Click+Mover el Mouse Para Cambiar velocidad",300,560);
text("Soltar Click Para Nomralizar Velocidad",300,580);
text("Presiona A Para Color Azul",10,520);
text("Presiona R Para Color Rojo",10,540);
text("Presiona B Para Color Blanco",10,560);
text("Presiona Y Para Color Amarillo",10,580);
text("Presiona N Para Color Negro",300,520);
text("Presiona V Para Color Verde",300,540);
stroke(255);
  }
if (mouseButton == LEFT){
  if(mousePressed){
     fill(c,50);
  stroke(0,10);
  ellipse (posX+d/2,posY+d/2,d,d);
  }
      
  
  }}
  void mouseDragged(){
  if(mousePressed){
  xspeed++;
   yspeed++;
 
   
   if(xspeed > 10){
     xspeed = 2.8-sec;
 
   }
     if(yspeed>10){
        yspeed = 2.1-sec;
     }
  }
  }
  void keyPressed(){
 if(key=='r'){
c= color(#A50A0A);  
 }
 if (key=='a'){
 c=color (#6D83F0);
 }
 if(key=='v'){
 c=color(#255F25);
 }
 if(key=='b'){
   c=color(#FAFAFA);
 }
 if(key=='y'){
 c=color(#E9F200);
 }
 if(key=='n'){
 c=color(#000000);
  }
  if(key=='3'){
    c++; 
  }
  if(key=='4'){
    c--;
  }
  }