Francisca Romero, tarea 7, imagen escrita

De Casiopea
Revisión del 15:07 31 may 2012 de Franciscarb (discusión | contribs.) (Página creada con '{{Proyecto |Título=Francisca Romero, Tarea 7 |Palabras Clave=tarea 7 |Carreras Relacionadas=Diseño Gráfico, Diseño Industrial |Cursos Relacionados=Imagen Escrita 2012, |Pro...')
(difs.) ← Revisión anterior | Revisión actual (difs.) | Revisión siguiente → (difs.)
Francisca Romero, Tarea 7



TítuloFrancisca Romero, Tarea 7
Palabras Clavetarea 7
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., 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)Francisca Romero Bugueño
ProfesorHerbert Spencer
 

Insect[] ins; 

float margin =1;

void setup() {

  size(700, 700);
  int ynum = 7;
  int xnum = 7;
  ins = new Insect[xnum * ynum];
  float ysp = (height - (5 * margin)) / ((float)ynum - .5);
  float xsp = (width - (5 * margin)) / ((float)xnum - .5);
  int c = 0; // counter
  for (float y = margin; y <= height - margin; y+= xsp) {
    for (float x = margin; x <= width - margin; x += ysp) {
      ins[c] = new Insect(y, x);
      c++;
    }
  } 
  smooth();
}


void draw() {

  background(#FFFFFF);
  for (int i = 0; i < ins.length; i++) {
    ins[i].render();
  }
}


class Insect {

  float x, y;
  float[][] v; 
  int vn; 
  float tam;  
  float w, h;
  Insect(float x, float y) {
    this.x = x-2;
    this.y = y-2;
    vn = round(random(20, 10));
    v = new float[vn][2];
    tam = 20;
    init();
  }
  void init() {
    w = tam/.5;
    h = tam;
    for (int i = 0; i < vn; i++) {
      v[i][0] = random(h);
      v[i][1] = random(-h/2, h/2);
    }
  }
  void trace() {
    noFill();
    stroke(100, 10, 50);
    strokeWeight(1);
    beginShape();
    vertex(v[0][0], v[0][0]);
    for (int i = 5; i < vn; i++) {
      curveVertex(v[i][0], v[i][1]);
    }
    vertex(v[vn-2][0], v[vn-3][1]);
    endShape();
  }
  void render() {
    pushMatrix();
    {
      translate(x, y);
      trace();
      scale( 2, - 2);
      trace();
    }
    popMatrix();
  }
}

void keyPressed() {

  if (key == 'q') {
    for (int i = 13; i < ins.length; i++) {
      ins[i].init();
    }
  }
  if (key == 'w') {
    for (int i = 1; i < ins.length; i++) {
      ins[i].tam++;
      ins[i].init();
    }
  }
}