Daniela Paz Araya:Floats
De Casiopea
Título | Daniela Paza Araya:Floats |
---|---|
Tipo de Proyecto | Proyecto de Taller, Proyecto de Curso |
Palabras Clave | Floats |
Período | 2011- |
Asignatura | Taller Inicial 1ª y 2ª Etapa, |
Del Curso | Imagen Escrita, |
Carreras | Arquitectura |
Alumno(s) | Daniela Paz Araya |
Profesor | Herbert Spencer |
float mx, my, nx, ny; float[][] coords; void setup() {
size(800, 700);
mx = 50; // margen horizontal my = 50; // margen vertical nx = 20; // número de elementos en X ny = 20; // número de elementoa en Y
// defino el # de coordenadas coords = new float[(int)(nx*ny)][2]; float spx, spy, px, py; // calculo los espaciadores verticales y horizontales spx = (width - (1.5 * mx)) / (nx-5); spy = (height - (1.5 * my)) / (ny-5);
// construyo todos los puntos for (int y = 0; y < ny; y++) { for (int x = 0; x < nx; x++) { coords[(int)((ny*y)+x)][0] = mx + (x * spx); coords[(int)((ny*y)+x)][1] = my + (y * spy); } } smooth(); /** * Hue. * * Hue is the color reflected from or transmitted through an object * and is typically referred to as the name of the color (red, blue, yellow, etc.) * Move the cursor vertically over each bar to alter its hue. */
int barWidth = 5; int[] hue;
{
size(800, 700); colorMode(HSB, 360, height, height); hue = new int[width/barWidth]; noStroke();
}
{
int j = 0; for (int i=0; i<=(width-barWidth); i+=barWidth) { if ((mouseX > i) && (mouseX < i+barWidth)) { hue[j] = mouseY; } fill(hue[j], height/1.2, height/1.2); rect(i, 0, barWidth, height); j++; }
} }
void draw() {
for (int i = 0; i < nx*ny; i++) { for (int j = 0; j < i; j++) { // calcula la distancia entre los puntos 'i' y 'j' float d = dist(coords[i][0], coords[i][1], coords[j][0], coords[j][1]); // si la distancia es menor que ... if (d < 80.5) { // dibuja la línea stroke(3); line(coords[i][0], coords[i][1], coords[j][0], coords[j][1]); } }
// mueve un poco los puntos coords[i][0] += random(5, 1); coords[i][1] += random(-5, 1); // dibuja los puntos ellipse(coords[i][0], coords[i][1], 3, 3); }
// dibujo un velo blanco para que se dibuje la estela noStroke(); fill(255, 15); rect(0, 0, width, height);
}