Asignar el color verde según la distancia del mouse con el centro.
float green = dist(mouseX,mouseY,width/2,height/2);
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); }