Camila Saavedra: tarea 7
De Casiopea
Título | Camila Saavedra: tarea 7 |
---|---|
Tipo de Proyecto | Proyecto de Curso |
Palabras Clave | tarea 7 |
Asignatura | Imagen Escrita 2012, |
Del Curso | Imagen Escrita 2012, |
Carreras | Diseñ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) | Camila Saavedra |
Profesor | Herbert Spencer |
Insect[] ins; float margin = 2; void setup() { size(800, 800); int ynum = 11; int xnum = 9; ins = new Insect[ynum* xnum]; float ysp = (height - (.2 * margin)) / ((float)ynum - .2); float xsp = (width - (.2 * margin)) / ((float)xnum - .2); 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(#E88C8C); for (int i = 0; i < ins.length; i=i+1) { ins[i].render(); } } class Insect { float x, y; float[][]q; // vertices int vn; // número aleatorio de vértices float tama; // tamaño float w, h; // width, height Insect(float x, float y) { this.x = x; this.y = y; vn =round (random(70,40)); q = new float[vn][8]; tama = 28; init(); } void init() { w = tama/.7; h = tama/ .7; for (int i = 1; i < vn; i++) { q[i][0] = random(w); q[i][1] = random(-h/3, h/3); } } void trace() { noFill(); stroke(#996346); strokeWeight(.80); beginShape(); vertex(q[1][0], q[0][1]); for (int i = 0; i < vn; i=i+3) { curveVertex(q[1][0], q[i][1]); } vertex(q[vn-2][0], q[vn-8][0]); endShape(); } void render() { pushMatrix(); { translate(x, y); trace(); scale(1, -1); trace(); } popMatrix(); } } void keyPressed() { if (key == 'v') { for (int i = 0; i < ins.length; i++) { ins[i].tama++; ins[i].init(); } } }