Maithé Esccobar: tarea 7

De Casiopea
tarea 7


Títulotarea 7
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)Maithé Escobar
ProfesorHerbert Spencer

apretar "e" "w" o "q"

Insect[] ins; float margin = 100;

void setup() {

size(700, 700); int ynum = 11; int xnum = 11; ins = new Insect[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 Insect(x, y);
   c ++ ;
 }

} smooth(); }


void draw() {

background(255); for (int m = 0; m < ins.length; m++) {

 ins[m].render();

} }


class Insect {

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

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

} void init() {

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

} void trace() {

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

} void render() {

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

} }

void keyPressed() {

if (key == 'q') {

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

} if (key == 'w') {

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

} if (key == 'e') {

 for (int m = 0; m < ins.length; m= m+7) {
   ins[9].tam--;
   ins[20].init();
 }

} }