Alumnus Exemplar: Máquina de Dibujo 1 - Espirales

De Casiopea
Revisión del 13:11 3 may 2013 de Hspencer (discusión | contribs.)
(difs.) ← Revisión anterior | Revisión actual (difs.) | Revisión siguiente → (difs.)


TítuloEspiralógrafo
Tipo de ProyectoProyecto de Curso
Palabras Clavetarea 4
Período2013-
AsignaturaImagen Escrita,
Del CursoImagen Escrita 2013 - DIS, Imagen Escrita 2013 - DIS,
CarrerasArquitectura, Diseñ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)Alumnus Exemplar
ProfesorHerbert Spencer


void setup() {
  size(500, 500);
  background(200, 200, 0);
  noFill();
  stroke(0, 100);
}

void draw() {
  float t = dist(mouseX, mouseY, pmouseX, pmouseY);
  if (mousePressed) {
    espiral(mouseX, mouseY, t);
  }
}


void espiral(float x, float y) {
  pushMatrix();
  translate(x, y);
  beginShape(); 
  for (float i= 0;i < 20; i+=0.1) {

    curveVertex((i*2)*sin(i), (i*2)*cos(i));
  } 
  endShape(); 
  popMatrix();
}

void espiral(float x, float y, float tam) {
  pushMatrix();
  translate(x, y);
  beginShape(); 
  for (float i= 0;i < tam; i+=0.1) {

    curveVertex((i*2)*sin(i), (i*2)*cos(i));
  } 
  endShape(); 
  popMatrix();
}

void keyPressed() {
  String filename = "img/retrato-"+year()+"_"+month()+"_"+day()+"___"+hour()+"-"+minute()+"-"+second()+".png";
  if (key == 's' || key == 'S') {
    saveFrame(filename);
    println("se ha grabado exitosamente el archivo "+filename);
  }
  if (key == ' ') {
    setup();
  }
}