====== 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); 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); } ==== Ejemplos ==== === Curso de programación interactiva === * {{:otros:interactiveprogramming:week_1_code_samples_sonicpainterdesktop.zip|Semana 1}} Carga de sonidos y reflejo. {{:otros:interactiveprogramming:pantallazo-sonicpainterdesktop.png?200|}}