//por Citlali Hernández, 01.11.11, el día binario
//ejercicio para la página de arte generativo
//nodo1
// El código
void setup() {
size(800,600);
noCursor();
}
void draw() {
background(15,15,15);
smooth();
//entraBackground();
conectarNodos1y2();
conectarNodos2y3();
conectarNodos3y4();
conectarNodos4y5();
conectarNodos1y3();
conectarNodos1y4();
conectarNodos1y5();
conectarNodos3y5();
conectarNodos2y4();
conectarNodos2y5();
conectarNodos1y6();
conectarNodos6y2();
conectarNodos6y3();
conectarNodos6y4();
conectarNodos6y5();
//areas
strokeWeight(0.2);
stroke(10);
noFill();
rect(n1centroX, n1centroY, n1anchoX, n1anchoY);
rect(n2centroX, n2centroY, n2anchoX, n2anchoY);
rect(n3centroX, n3centroY, n3anchoX, n3anchoY);
dibujarNodo1();
dibujarNodo2();
dibujarNodo3();
dibujarNodo4();
dibujarNodo5();
dibujarNodo6();
}
//------
// VARIABLES NODO - - - - -
// NODO 1 - - - - - - - - - -
float n1anchoX = 50;
float n1anchoY = 100;
float n1centroX = 400;
float n1centroY = 380;
float n1ruidoX, n1ruidoY, n1posX, n1posY;
float n1varX = 0.0091;
float n1varY = 0.0071;
// NODO 2 - - - - - - - - - -
float n2anchoX = 100;
float n2anchoY = 200;
float n2centroX = 20;
float n2centroY = 40;
float n2ruidoX, n2ruidoY, n2posX, n2posY;
float n2varX = 0.0052;
float n2varY = 0.00707;
//NODO 3 - - - - -
float n3anchoX = 90;
float n3anchoY = 250;
float n3centroX = 390;
float n3centroY = 100;
float n3ruidoX, n3ruidoY, n3posX, n3posY;
float n3varX = 0.0099;
float n3varY = 0.0081;
//NODO 4 - - - - -
float n4anchoX = 60;
float n4anchoY = 100;
float n4centroX = 580;
float n4centroY = 400;
float n4ruidoX, n4ruidoY, n4posX, n4posY;
float n4varX = 0.049;
float n4varY = 0.00451;
//NODO 5 - - - - -
float n5anchoX = 30;
float n5anchoY = 100;
float n5centroX = 750;
float n5centroY = 320;
float n5ruidoX, n5ruidoY, n5posX, n5posY;
float n5varX = 0.0019;
float n5varY = 0.0051;
//NODO 6 - - - - -
float n6anchoX = 30;
float n6anchoY = 100;
float n6centroX = 300;
float n6centroY = 320;
float n6ruidoX, n6ruidoY, n6posX, n6posY;
float n6varX = 0.0099;
float n6varY = 0.0101;
// - - - - - - - - - -
// DIBUJAR NODOS - - - - -
// - - - - - - -NODO 1- - - - -
void dibujarNodo1() {
// calculamos posicion
n1posX = noise(n1ruidoX) * n1anchoX;
n1posY = noise(n1ruidoY) * n1anchoY;
n1ruidoX += n1varX;
n1ruidoY += n1varY;
// dibuajr bolita
fill(255, 255, 255, random ( 60,200));
ellipseMode(CENTER);
ellipse( mouseX, mouseY, 15,15 );
}
// - - - - - - -NODO 2- - - - -
void dibujarNodo2() {
// calculamos posicion
n2posX = noise(n2ruidoX) * n2anchoX;
n2posY = noise(n2ruidoY) * n2anchoY;
n2ruidoX += n2varX;
n2ruidoY += n2varY;
// dibuajr bolita
fill(255);
ellipseMode(CENTER);
ellipse( n2centroX + n2posX, n2centroY + n2posY, 10,10 );
}
// - - - - - - -NODO 3- - - - -
void dibujarNodo3() {
// calculamos posicion
n3posX = noise(n3ruidoX) * n3anchoX;
n3posY = noise(n3ruidoY) * n3anchoY;
n3ruidoX += n3varX;
n3ruidoY += n3varY;
// dibuajr bolita
fill(255);
ellipseMode(CENTER);
ellipse( n3centroX + n3posX, n3centroY + n3posY, 10,10 );
}
// - - - - - - -NODO 4 - - - - -
void dibujarNodo4() {
// calculamos posicion
n4posX = noise(n4ruidoX) * n4anchoX;
n4posY = noise(n4ruidoY) * n4anchoY;
n4ruidoX += n4varX;
n4ruidoY += n4varY;
// dibuajr bolita
fill(255);
ellipseMode(CENTER);
ellipse( n4centroX + n4posX, n4centroY + n4posY, 10,10);
}
// - - - - - - -NODO 5- - - - -
void dibujarNodo5() {
// calculamos posicion
n5posX = noise(n5ruidoX) * n5anchoX;
n5posY = noise(n5ruidoY) * n5anchoY;
n5ruidoX += n5varX;
n5ruidoY += n5varY;
// dibuajr bolita
fill(255);
ellipseMode(CENTER);
ellipse( n5centroX + n5posX, n5centroY + n5posY, 10,10 );
}
// - - - - - - -NODO 6- - - - -
void dibujarNodo6() {
// calculamos posicion
n6posX = noise(n6ruidoX) * n6anchoX;
n6posY = noise(n6ruidoY) * n6anchoY;
n6ruidoX += n6varX;
n6ruidoY += n6varY;
// dibuajr bolita
fill(255);
ellipseMode(CENTER);
ellipse( n6centroX + n6posX, n6centroY + n6posY, 10,10);
}
// CONECTAR NODOS
// QUÉ HUEVA MAMÁ.
void conectarNodos1y2(){
strokeWeight(1);
stroke(255);
line(mouseX, mouseY, n2centroX + n2posX,n2centroY + n2posY);
}
void conectarNodos2y3(){
strokeWeight(1);
stroke(255);
line( n2centroX + n2posX, n2centroY + n2posY, n3centroX + n3posX, n3centroY + n3posY);
}
void conectarNodos3y4(){
strokeWeight(1);
stroke(255);
line( n4centroX + n4posX, n4centroY + n4posY, n3centroX + n3posX, n3centroY + n3posY);
}
void conectarNodos4y5(){
strokeWeight(1);
stroke(255);
line( n4centroX + n4posX, n4centroY + n4posY, n5centroX + n5posX, n5centroY + n5posY);
}
void conectarNodos1y3(){
strokeWeight(1);
stroke(255);
line( mouseX, mouseY, n3centroX + n3posX, n3centroY + n3posY);
}
void conectarNodos1y4(){
strokeWeight(1);
stroke(255);
line( mouseX, mouseY, n4centroX + n4posX, n4centroY + n4posY);
}
void conectarNodos1y5(){
strokeWeight(1);
stroke(255);
line( mouseX, mouseY, n5centroX + n5posX, n5centroY + n5posY);
}
void conectarNodos3y5(){
strokeWeight(1);
stroke(255);
line( n5centroX + n5posX, n5centroY + n5posY, n3centroX + n3posX, n3centroY + n3posY);
}
void conectarNodos2y4(){
strokeWeight(1);
stroke(255);
line( n2centroX + n2posX, n2centroY + n2posY, n4centroX + n4posX, n4centroY + n4posY);
}
void conectarNodos2y5(){
strokeWeight(1);
stroke(255);
line( n2centroX + n2posX, n2centroY + n2posY, n5centroX + n5posX, n5centroY + n5posY);
}
void conectarNodos1y6(){
strokeWeight(1);
stroke(255);
line( mouseX, mouseY, n6centroX + n6posX, n6centroY + n6posY);
}
void conectarNodos6y2(){
strokeWeight(1);
stroke(255);
line( n2centroX + n2posX, n2centroY + n2posY, n6centroX + n6posX, n6centroY + n6posY);
}
void conectarNodos6y3(){
strokeWeight(1);
stroke(255);
line( n3centroX + n3posX, n3centroY + n3posY, n6centroX + n6posX, n6centroY + n6posY);
}
void conectarNodos6y4(){
strokeWeight(1);
stroke(255);
line( n4centroX + n4posX, n4centroY + n4posY, n6centroX + n6posX, n6centroY + n6posY);
}
void conectarNodos6y5(){
strokeWeight(1);
stroke(255);
line( n5centroX + n5posX, n5centroY + n5posY, n6centroX + n6posX, n6centroY + n6posY);
}