miércoles, 24 de agosto de 2011

Ejercicios siguiendo al mouse

void setup(){
size (400, 400);
}
void draw(){
line (pmouseX, pmouseY, mouseX, mouseY);
}









void setup(){
size(400,400);
smooth();
background(0);
frameRate(30);
}
void draw(){
stroke(mouseX, 0 , mouseY);
float distance = dist(pmouseX, pmouseY, mouseX, mouseY);
float maxStroke = 15;
strokeWeight(maxStroke - constrain(distance, 0, maxStroke));
line(pmouseX, pmouseY, mouseX, mouseY);
}
void mouseClicked(){
rectMode(CENTER);
fill(mouseY, 255, mouseX);
noStroke();
rect(mouseX, mouseY, 30, 30);
}
void keyPressed(){
background(0);
}

No hay comentarios:

Publicar un comentario