Andrea Haddad: Pizarra de dibujo

De Casiopea
Pizarra de Dibujo


TítuloPizarra de Dibujo
Tipo de ProyectoProyecto de Curso
Palabras Clavetarea 4
Período2012-
AsignaturaTaller Inicial Común 1ª y 2ª Etapa,
Del CursoImagen Escrita 2012,
CarrerasArquitectura
Alumno(s)Andrea Haddad
ProfesorHerbert Spencer

float[][] coords;   
int numDots = 777;  
float c = 0.01;     
color c1 = color(128,128,128);

void setup() {
  size(700, 700);

  coords = new float[numDots][2]; 


  for (int i = 0; i < numDots; i++) {
   
    coords[i][0] = random(width);  
    coords[i][1] = random(height); 
  }
  smooth();
  background(255);
}

void draw() {
saveFrame ("andrea4.jpg");

  for (int i = 0; i < numDots; i++) {

    int next = (i + 1) % numDots; 

    
    float difx = coords[i][0] - coords[next][0];
    float dify = coords[i][1] - coords[next][1];


    float nx = coords[i][0] -= difx * c;
    float ny = coords[i][1] -= dify * c;

    stroke(0, 20);
    stroke(c1);
    line(coords[i][0], coords[i][1], nx, ny);
  }
}

void keyPressed() {
  // si presiono 'r' dibuja en rojo
  if (key == 'r') {
    c1=color(255, 0, 0);
     stroke(c1);
  }
  // si presiono 'o' dibuja en verde oscuro
  if (key == 'o') {
    c1=color(0,174,0);
     stroke(c1);
  }
  // si presiono 'v' dibuja en verde claro
   if (key == 'v') {
    c1=color(0, 333, 0);
     stroke(c1);
  }
  if (key == 'g') {
    // si preciono aparece un velo gris sobre el dibujo
    noStroke();
    fill(222, 170);
    rect(0, 0, width, height);
    stroke(0, 60);
  }

}