Tarea 3: Curvas que responden al mouse

De Casiopea
Tarea 3: curvas respondiendo al mouse


TítuloTarea 3: curvas respondiendo al mouse
Tipo de ProyectoProyecto de Curso
Palabras Clavetarea 3
Período2012-2012
AsignaturaImagen Escrita 2012,
Del CursoImagen Escrita 2012,
CarrerasArquitectura
Alumno(s)Eduardo Andrés Segovia Jeria
ProfesorHerbert Spencer

//este trabajo consiste en lineas curvas que responden al mouse

float y, n; float m;

void setup() {

 size(500, 500);}

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 t = tam/1; 
 stroke(204, 400, 0);
 line(x-t, y-t, x+t, y+t);
 line(x-t, y+t, x+t, y-t);}

void draw() {

 background(255); 
 grilla(100, 100); 
 for (int x = 0; x < height; x++) {
   
   n = norm(x, 5, width);  
   m = map(mouseY, 300, width, 1, 0);
   y = pow(n, m) * height;  
  

cruz(x, y, mouseX); cruz(mouseX, y, 10);}

 println(m);}