Herramientas de usuario

Herramientas del sitio


otros:interactive0

¡Esta es una revisión vieja del documento!


Programación interactiva (0)

Básico

Pequeños trucos

Asignar el color verde según la distancia del mouse con el centro.

float green = dist(mouseX,mouseY,width/2,height/2);

Reflejos

void mouseDragged () {
  float red = map(mouseX, 0, width, 0, 255);
  float blue = map(mouseY, 0, width, 0, 255);
  float green = dist(mouseX,mouseY,width/2,height/2);
 
  float speed = dist(pmouseX, pmouseY, mouseX, mouseY);
  float alpha = map(speed, 0, 20, 0, 10);
  println(alpha);
  float lineWidth = map(speed, 0, 10, 10, 1);
  lineWidth = constrain(lineWidth, 0, 10);
  stroke(red, green, blue, 255);
  strokeWeight(lineWidth);
    line(width/2+((width/2)-pmouseX), pmouseX, width/2+((width/2)-mouseX), mouseY);
}
otros/interactive0.1372031626.txt.gz · Última modificación: 2020/05/09 09:25 (editor externo)