Paul Guitard: Medallas Pokemon

De Casiopea
Medallas Pokemon


TítuloMedallas Pokemon
Tipo de ProyectoProyecto de Curso
Palabras Clavetarea 7
Período2012-
AsignaturaTaller Inicial Común 1ª y 2ª Etapa,
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)Paul Guitard
ProfesorHerbert Spencer
Forma[] form;
float margin = 60;

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

  int yfilas = 12; //Cantidad de objetos en el eje Y
  int xfilas = 9; //Cantidad de objetos en el eje X
  form = new Forma[yfilas * xfilas];

  float ysp = (height - (2 * margin)) / ((float)yfilas - 1);
  float xsp = (width - (2 * margin)) / ((float)xfilas - 1);

  int c = 0; // contador

  for (float y = margin; y <= height - margin; y+= ysp) {
    for (float x = margin; x <= width - margin; x += xsp) {
      form[c] = new Forma(x, y);
      c++;
    }
  } 
}

void draw() {
  background(255);
  for (int i = 0; i < form.length; i++) {
    form[i].render();
  }
}

class Forma {
  float x, y;
  float[][] v; // vertices
  int vn;
  float tam;  // tamaño
  float w, h;

  Forma(float x, float y) {
    this.x = x;
    this.y = y;
    vn = round(random(10, 10));
    v = new float[vn][10];
    tam = 40;
    init();
  }

  void init() {
    w = tam/2;
    h = tam/2;
    for (int i = 0; i < vn; i++) {
      v[i][0] = random(h/2);
      v[i][1] = random(-h/2, h/2);
    }
  }

  void trace() {
    fill(0);
    stroke(0);
    strokeWeight(5);
    beginShape();
    vertex(v[1][0], v[1][1]);
    for (int i = 0; i < vn; i++) {
      curveVertex(v[0][1], v[i][0]);
    }
    vertex(v[vn-1][0], v[vn-1][1]);
    endShape();
  }

  void render() {
    pushMatrix();
    {
      translate(x, y);
      trace();
      scale(-1, -1);
      trace();
    }
    popMatrix();
  }
}

void keyPressed() {
  if (key == ' ') {
    for (int i = 0; i < form.length; i++) {
      form[i].init();
    }
  }
  }