Ummm, could you try to rephrase your problem? I don’t understand what you’re trying to achieve… are you trying to create a spray paint effect from scratch? or are you using some library?
maybe you could find some help here on how to make your question more understandable.
thanks for your reply!
I want to make a spray paint effect,and partly completed.
It will dripping if I press the mouse for more than 3-5 seconds,but how to cancel the splashing effect for the dripping?
Thanks!!
my code:
final int maxIterations = 20;
float x=0;
float y=0;
void setup () {
size (500, 700);
background(255);
stroke(0);
}
void draw () {
if (mousePressed ) {
brush () ;
brushX();
}
}
void brush () {
int width1=40;
float radx;
float rady;
float angle1;
float x;
float y;
for (int i=0; i < maxIterations; i++) {
radx=random(width1);
rady=random(width1);
angle1= random(600);
x=(radx*cos(radians(angle1)))+mouseX;
y=(rady*sin(radians(angle1)))+mouseY;
strokeWeight(3);
point(x, y);
}
}
void brushX () {
int x=0;
int y=0;
for (int i=0; i < 2; i++) {
x=mouseX;
y=mouseY;
strokeWeight(2);
line(mouseX, mouseY, mouseX, mouseY++);
}
}
I was thinking maybe you could use some sort of statement including the dist(mouseX,mouseY,pmouseX,pmouseY) function.
Another good option is using a statement including time elapsed like @glv suggested.
About the fact that the dripping effect had a spray effect too, maybe it’s because of too little variables and the fact that the same variable controls the spray effect and the line effect. I didn’t read into your code fully as it was kind of long, but I hope you find a solution and send the fixed code here as I would be interested in seeing it.
GL!