Isidora Correa proyecto 7 IE 2012

De Casiopea


TítuloIsidora Correa proyecto 7 Insectario IE 2012
Tipo de ProyectoProyecto de Curso
Palabras Clavetarea 7
Período2012-2012
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.
ProfesorHerbert Spencer

Insectario;

Insectos[] ins; float margin = 60;

void setup() {

size(700, 700); int ynum = 9; int xnum = 9; ins = new Insectos[ynum * xnum]; float ysp = (height - (2 * margin)) / ((float)ynum - 1); float xsp = (width - (2 * margin)) / ((float)xnum - 1); int c = 0; // counter for (float y = margin; y <= height - margin; y+= ysp) {

 for (float x = margin; x <= width - margin; x += xsp) {
   ins[c] = new Insectos(x, y);
   c++;
 }

} smooth(); }


void draw() {

background(#BDCE43); for (int i = 0; i < ins.length; i++) {

 ins[i].render();

} }


class Insectos {

float x, y; float[][] v; // vertices int vn; // número aleatorio de vértices float tam; // tamaño float w, h; // width, height Insectos(float x, float y) {

 this.y = y;
 this.x = x;
 vn = round(random(10, 30));
 v = new float[vn][6];
 tam = 130;
 init();

} void init() {

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

} void trace() {

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

} void render() {

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

} }

void keyPressed() {

if (key == 'a') {

 for (int i = 0; i < ins.length; i++) {
   ins[i].init();
 }

} if (key == 'b') {

 for (int i = 0; i < ins.length; i++) {
   ins[i].tam--;
   ins[i].init();
 }

} if (key == 'c') {

 for (int i = 0; 1 < ins.length; i++) {
   ins[i].tam++;
   ins[i].init();
 }

} }