Maquina de Dibujo, Rubén Miranda (1)

De Casiopea


TítuloMaquina de Dibujo, Rubén Miranda (1)
Tipo de ProyectoProyecto de Curso
Palabras Clavetarea 4
Período2013-
AsignaturaImagen Escrita
Del CursoImagen Escrita 2013 - ARQ, Imagen Escrita 2013 - DIS
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., Diseño Industrial"Diseño Industrial" is not in the list (Arquitectura, Diseño, Magíster, Otra) of allowed values for the "Carreras Relacionadas" property.
Alumno(s)Rubén Antonio Miranda Benítez
ProfesorHerbert Spencer
float tam;
int fondo = 255; // fondo blanco

void setup() {
  size(500, 500);
  background(255);
  fill(0, 75);
  noStroke();
  strokeWeight(1);
  smooth(500);
}
void draw() {
  if (mousePressed) {
    line(mouseX, mouseY, pmouseX, pmouseY);
    println("vertex("+mouseX+", "+mouseY+");");
  } 
  if (keyPressed)

    if (mousePressed)
    {
      figura();
    }
}

void figura() {
  tam = dist(mouseX, mouseY, pmouseX, pmouseY);
  if (mousePressed) {
    achurado(mouseX, mouseY, tam);
  }
}

void achurado(float x, float y, float mag) {
  pushMatrix();
  translate(x, y);
  for (int i = 0; i < 5; i ++) {
    line(random(-mag), random(mag), random(mag), random(-mag));
  }
  popMatrix();
}
void keyPressed() {
  if (key=='0') {
    strokeWeight(1);
  } 
  if (key=='1') {
    strokeWeight(2);
  }
  if (key=='2') {
    strokeWeight(3);
  }
  if (key=='3') {
    strokeWeight(4);
  }
  if (key=='4') {
    strokeWeight(5);
  } 
  if (key=='a' || key == 'A') { //CAMBIAR COLOR A ROJO
    stroke(#FA1E05);
  }     
  if (key=='s' || key == 'S') { //CAMBIAR COLOR A ANARANJADO
    stroke(#FA7C05);
  }
  if (key=='d' || key == 'D') { //CAMBIAR COLOR A AMARILLO
    stroke(#FAE605);
    smooth(2);
  }
  if (key=='f' || key == 'F') { //CAMBIAR COLOR A VERDE/AMARILLO
    stroke(#97FA05);
  }   
  if (key=='g' || key == 'G') { //CAMBIAR COLOR A VERDE
    stroke(#2B8B25);
  }
  if (key=='h' || key == 'H') { //CAMBIAR COLOR A CIAN 
    stroke(#13E5A4);
    smooth(2);
  }
  if (key=='j' || key == 'J') { //CAMBIAR COLOR A CELESTE
    stroke(#05C1F2);
  }
  if (key=='k' || key == 'K') { //CAMBIAR COLOR A AZUL
    stroke(#054AF2);
  }
  if (key=='l' || key == 'L') { //CAMBIAR COLOR A VIOLETA
    stroke(#7B05F2);
  }
  if (key==' ') { // Presionar espacio para borrar todo
    background(fondo);
  }
  String filename = "img/dibujosupercachilupi-"+year()+"_"+month()+"_"+day()+"___"+hour()+"-"+minute()+"-"+second()+".png";
  if (key == '*') {
    saveFrame(filename);
    println("se ha grabado exitosamente el archivo "+filename);
  }
}