Juan Francisco Rojas: Cangrejos
De Casiopea
Título | Juan Francisco Rojas: Cangrejos |
---|---|
Tipo de Proyecto | Proyecto de Curso |
Palabras Clave | tarea 7 |
Período | 2012- |
Asignatura | Taller Inicial 1ª y 2ª Etapa, |
Del Curso | Imagen Escrita 2012, |
Carreras | Arquitectura |
Alumno(s) | Juan Francisco Rojas |
Profesor | Herbert Spencer |
- El trabajo consiste en una perfección de la tarea 7, aplicándole nuevas características como colores o diversidad de tamaños entre los cangrejos
- Apretar la tecla espacio para cambiar los cangrejos
- Apretar la tecla g para sacar una img
import processing.pdf.*; cangrejos[] cang; // creo un conjunto de elementos que seran los insectos float margen = 150; // margen interno de la img PFont tipografia; void setup() { tipografia = createFont("Old English Text MT", 20); textFont(tipografia, 17); size(650, 700); smooth(); int yNum = 6; // cantidad de cangrejos en y int xNum = 5; // cantidad de cangrejos en x cang = new cangrejos[yNum * xNum]; float ysp = (height - (2 * margen)) / ((float)yNum - 1); float xsp = (width - (2 * margen)) / ((float)xNum - 1); int c = 0; // contador for (float y = margen; y <= height - margen; y+= ysp) { for (float x = margen; x <= width - margen; x += xsp) { cang[c] = new cangrejos(x, y); c++; } } smooth(); // suavizado de la línea } void draw() { background(#FAD58B); // color playa para el fondo texto(); for (int i = 0; i < cang.length; i++) { cang[i].render(); } } void texto() { fill(#000000); text("Juan Francisco Rojas", width - margen*1.5, 650); text("1 Año Arquitectura", width - margen*1.351, 667); } class cangrejos { float x, y; float[][] v; // vertices int vn; // número aleatorio de vértices float tam; // tamaño float w, h; // width, height = ancho, alto cangrejos(float x, float y) { float t = random (40, 80); this.x = x; this.y = y; vn = round(random(10, 25)); // hace que salga un número aleatorio entre 10 y 25 v = new float[vn][5]; tam = t; init(); } void init() { w = tam/2; h = (tam/2)-5; for (int i = 0; i < vn; i++) { v[i][0] = random(w); v[i][1] = random(-h/2, h/2); } } void trace() { colorMode(RGB); float a = random(170, 255); float b = random(70, 105); fill(a, b, 0); stroke(#000000); // color del trazo strokeWeight(.25); // grosor de la línea beginShape(); vertex(v[0][0], v[0][1]); for (int i = 0; i < vn; i++) { curveVertex(v[i][0], v[i][1]); } 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 == 'g') { // apretar tecla g para guardar la img saveFrame("insectos##.jpg"); } if (key == ' ') { // se crea un función a la tecla de espacio for (int i = 0; i < cang.length; i++) { cang[i].init(); } } }