Alvaro Aedo: Curva que responde al mouse

De Casiopea
Curvas que responden al mouse


TítuloCurvas que responden al mouse
Tipo de ProyectoProyecto de Curso
Palabras Clavetarea 3
Período2012-2012
AsignaturaImagen Escrita 2012,
Del CursoImagen Escrita 2012,
CarrerasArquitectura
Alumno(s)Alvaro Aedo
ProfesorHerbert Spencer

En una grilla o cuadricula se generan multiples curvas relacionadas a dos curvas mayores que responden al mouse

float y, n; 
float m;     
void setup() {
  size(700, 700);
}
void grilla(int divsX, int divsY) {
  stroke(240); 
  float xSpacer = width/(float)divsX;  
  float ySpacer = height/(float)divsY; 

  for (float y = ySpacer; y < height; y +=ySpacer) {
    line(0, y, width, y);
  }
  for (float x = xSpacer; x < width; x +=xSpacer) {
    line(x, 0, x, height);
  }
}

void cruz(float x, float y, float tam, float z) {
  float t = (tam/100)*100; 
  stroke(123, 20, 50, 30);
  line(x-t, y+t, x+(t+1), y-1);
  line(x-t, y+t, x*t/2, y-1);
}

void draw() {
  background(255); 
  grilla(40, 20);   

  for (int x = 2; x < width; x++) {

    n = norm(x, 0, width);  
    m = map(mouseX, 0, width, 1, 10); 
    y = pow(n, m) * height;  

    cruz(y, x, 10, y);
    cruz(x, height-y, 5, 3);
  }
  println(m);
}