
float x = (mouseX);
float y = (mouseY);
float px;
float py;
float easing= .05;
int colorR;
int colorG;
int colorB;
boolean new_draw;
void setup() {
size(700,700);
background(255);
smooth();
noStroke();
colorR = 0;
colorG = 0;
colorB = 0;
new_draw = false;
}
void draw() {
if(mousePressed==true){
stroke(colorR, colorG, colorB);
float targetX=mouseX;
x += (targetX-x) *easing;
float targetY=mouseY;
y+= (targetY-y) *easing;
float weight = dist(x,y, px, py);
strokeWeight(weight);
line(x,y, px, py);
py=y;
px=x;
if(new_draw == true) {
float x=mouseX;
float y=mouseY;
}
}
else{
colorR = (colorR + (int)random(255) ) % 255;
colorG = (colorG + (int)random(255) ) % 255;
colorB = (colorB + (int)random(255) ) % 255;
}
}
void mouseReleased() {
new_draw = true;
}