Tarea final de trimestre
De Casiopea
Título | Moscas que se mueven |
---|---|
Tipo de Proyecto | Proyecto de Curso |
Palabras Clave | Tarea final de trimestre |
Período | 2012- |
Asignatura | Taller Inicial 1ª y 2ª Etapa, |
Del Curso | Imagen Escrita 2012, |
Carreras | Arquitectura |
Alumno(s) | Paula Ramírez Guevara |
Profesor | Herbert Spencer |
En esta tarea, he modificado algunas cosas de la anterior, aumentando el tamaño de objetos que aparecen, y también, quise buscar una forma especifica para todas las figuras, llegando asi, a ésta, que da la impresión, de ser puras moscas, que al apretar "a" y/o "d" aumentan o disminuyen, respectivamente, creando sólo lineas, lo que parece como si fuera el recorrido de estas moscas.
Insect[] ins; float margin =50; void setup() { size(609, 1223); int ynum = 11; int xnum = 9; ins = new Insect[ynum * xnum]; float ysp = (height - (2 * margin)) / ((float)ynum - .5); float xsp = (width - (2 * margin)) / ((float)xnum - .5); 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 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; this.y = y; vn = round(random(15, 20)); v = new float[vn][2]; tam = 10; init(); } void init() { w = tam/8; 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(0); strokeWeight(0.25); beginShape(); arc(10, 20, 30, 40, 50, 10); triangle(0, 1, 0, 20, 0, 15); for (int i = 0; i < vn; i++) { curveVertex(v[i][0], v[i][1]); arc( v[i][0], 4, 6, 6, v[i][1], 2); } vertex(v[vn-10][0], v[vn-3][1]); endShape(); } void render() { pushMatrix(); { translate(x, y); trace(); scale( 2, - 2); trace(); } popMatrix(); } } void keyPressed() { if (key == 'd') { //disminuir for (int i = 0; i < ins.length; i++) { ins[i].tam--;// disminuir el tamaño ins[i].init(); } } if (key == 'a') { //agranda for (int i = 0; i < ins.length; i++) { ins[i].tam++;// aumentar el tamaño ins[i].init(); } } if (key == 'f') { // foto saveFrame("img/###.jpg"); } }