Felipe Rojas Montenegro: Imagen Escrita: Máquina para dibujar

De Casiopea


TítuloMáquina para Dibujar
Tipo de ProyectoProyecto de Taller
Palabras Clavetarea 4
Período2013-2013
AsignaturaImagen Escrita,
Del CursoImagen 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)Felipe Rojas Montenegro
ProfesorHerbert Spencer


float tam;

void setup() {
  size(800, 600);
  background(255);
  stroke(10,50);
}

void draw() {
  tam = dist(mouseX, mouseY, pmouseX, pmouseY); 
  if (mousePressed) {
    int cantidad = round(map(tam, 0, 5, 0, 5));
    lineas(mouseX, mouseY, cantidad, tam);
  }
}

void lineas(float x, float y, int mag, float tam) {
  pushMatrix();
  translate(x, y);
  for (int i = 1; i < mag; i ++) {
    line(random(-tam), random(-tam), random(tam), random(tam));
  }
 rotate(y);
  for (int i = 1; i < mag; i ++) {
    line(random(-tam), random(tam), random(-tam), random(tam));
  }
  popMatrix();
}

void keyPressed() {
  String filename = "img/retrato-"+year()+"_"+month()+"_"+day()+"___"+hour()+"-"+minute()+"-"+second()+".png";
  if (key == 's' || key == 'S') {  //Para guardar la imagen.
    saveFrame(filename);
    println("se ha grabado exitosamente el archivo "+filename);
  }
  if (key == 'b' || key == 'B') {  //Cambia a pincel blanco.
    stroke(255);
    println("Color Blanco Seleccionado");
    
  }
  if (key == 'n' || key == 'N') {  //Cambia a pincel negro.
    stroke(0);
    println("Color Negro Seleccionado");
  }
}