# Hello, some question from a beginner (drip effect)

**URL:** https://discourse.processing.org/t/hello-some-question-from-a-beginner-drip-effect/32041
**Category:** Coding Questions
**Created:** [September 1, 2021, 1:36am UTC](https://discourse.processing.org/t/hello-some-question-from-a-beginner-drip-effect/32041 "2021-09-01T01:36:57Z")
**Posts on this page:** 15
**Page:** 1

<div class="post-metadata">

### Author: ![asacool](https://avatars.discourse-cdn.com/v4/letter/a/58956e/32.png) [@asacool](https://discourse.processing.org/u/asacool)
#### Post date: [September 1, 2021, 1:36am UTC](https://discourse.processing.org/t/hello-some-question-from-a-beginner-drip-effect/32041/1 "2021-09-01T01:36:57Z")

</div>

Hi,  
I want to do spray paint effect,but how to cancel the point of the drip effect? (just want only "line "drip)  
sorry,I just the beginner.

thanks!!

my code:

```auto
final int maxIterations = 20; //
float x=0;
float y=0;

void setup () {
  size (500, 700);
  background(255);
  stroke(0); // red
}
void draw () {

  if (mousePressed ) {
    brush () ;
    brushX();
  }
}
void brush () {
  int width1=40; //
  //
  float radx; // Radius
  float rady;
  float angle1; // angle
  float x; // result
  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++);
  }
}

```

---

<div class="post-metadata">

### Author: ![asacool](https://avatars.discourse-cdn.com/v4/letter/a/58956e/32.png) [@asacool](https://discourse.processing.org/u/asacool)
#### Post date: [September 1, 2021, 1:41am UTC](https://discourse.processing.org/t/hello-some-question-from-a-beginner-drip-effect/32041/2 "2021-09-01T01:41:12Z")

</div>

just like this!

![spray-paint-vector-elements-isolated-260nw-1655127337](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/3/305df052704f45ff852e1a0c915e028fbf514e2c.webp)

---

<div class="post-metadata">

### Author: ![KaliBrain](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kalibrain/32/10811_2.png) [@KaliBrain](https://discourse.processing.org/u/KaliBrain)
#### Post date: [September 5, 2021, 5:20pm UTC](https://discourse.processing.org/t/hello-some-question-from-a-beginner-drip-effect/32041/3 "2021-09-05T17:20:09Z")

</div>

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](https://discourse.processing.org/t/guidelines-asking-questions/2147/9) on how to make your question more understandable.

---

<div class="post-metadata">

### Author: ![Chrisir](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/chrisir/32/45_2.png) [@Chrisir](https://discourse.processing.org/u/Chrisir)
#### Post date: [September 5, 2021, 6:32pm UTC](https://discourse.processing.org/t/hello-some-question-from-a-beginner-drip-effect/32041/4 "2021-09-05T18:32:09Z")

</div>

please remember

- to use ctrl-t in pocessing to get auto-format before posting
- after you pasted your code: in the forum select your code with the mouse and hit ctrl-e (or in the small command bar the sign `</>`)
- to use more empty lines, between functions for example

Hey, and welcome to the forum!

Warm regards,

Chrisir

---

<div class="post-metadata">

### Author: ![asacool](https://avatars.discourse-cdn.com/v4/letter/a/58956e/32.png) [@asacool](https://discourse.processing.org/u/asacool)
#### Post date: [September 9, 2021, 1:08am UTC](https://discourse.processing.org/t/hello-some-question-from-a-beginner-drip-effect/32041/5 "2021-09-09T01:08:44Z")

</div>

> [@Chrisir](#):
>
> - to use ctrl-t in pocessing to get auto-format before posting
> - after you pasted your code: in the forum select your code with the mouse and hit ctrl-e (or in the small command bar the sign `</>` )
> - to use more empty lines, between functions for example
> 
> Hey, and welcome to the forum!
> 
> Warm regards,
> 
> Chrisir

Hello Chrisir,  
thanks so much!

---

<div class="post-metadata">

### Author: ![asacool](https://avatars.discourse-cdn.com/v4/letter/a/58956e/32.png) [@asacool](https://discourse.processing.org/u/asacool)
#### Post date: [September 9, 2021, 1:22am UTC](https://discourse.processing.org/t/hello-some-question-from-a-beginner-drip-effect/32041/6 "2021-09-09T01:22:15Z")

</div>

Hello KaliBrain,

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:

```auto
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++);
  }
}

```

---

<div class="post-metadata">

### Author: ![asacool](https://avatars.discourse-cdn.com/v4/letter/a/58956e/32.png) [@asacool](https://discourse.processing.org/u/asacool)
#### Post date: [September 9, 2021, 1:32am UTC](https://discourse.processing.org/t/hello-some-question-from-a-beginner-drip-effect/32041/7 "2021-09-09T01:32:38Z")

</div>

![未命名-1](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/b/b92798ab74f135ca2a06bd9d5d5753293c41f9ec.jpeg)

---

<div class="post-metadata">

### Author: ![glv](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/glv/32/18785_2.png) [@glv](https://discourse.processing.org/u/glv)
#### Post date: [September 9, 2021, 2:18am UTC](https://discourse.processing.org/t/hello-some-question-from-a-beginner-drip-effect/32041/8 "2021-09-09T02:18:25Z")

</div>

Hello,

This is useful for timing:

> **[Reference](https://processing.org/reference/millis_.html)**
>
> Returns the number of milliseconds (thousandths of a second) since starting an applet. This information is often used for timing animation sequences.

There are many examples of timers in this forum.

I created a “rough” dripping effect with circle() and random() using mouseReleased():

```auto
void mouseReleased()
  {
  x = mouseX;
  y = mouseY;
  // Add code for effect here
  } 

```

![image](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/4/45f51642ece1da235d324241b8f25da25c5fd6d7.png)

Have fun!

`:)`

---

<div class="post-metadata">

### Author: ![asacool](https://avatars.discourse-cdn.com/v4/letter/a/58956e/32.png) [@asacool](https://discourse.processing.org/u/asacool)
#### Post date: [September 10, 2021, 6:30am UTC](https://discourse.processing.org/t/hello-some-question-from-a-beginner-drip-effect/32041/9 "2021-09-10T06:30:43Z")

</div>

Hi glv,

Big thanks for share!!!

---

<div class="post-metadata">

### Author: ![KaliBrain](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kalibrain/32/10811_2.png) [@KaliBrain](https://discourse.processing.org/u/KaliBrain)
#### Post date: [September 10, 2021, 12:20pm UTC](https://discourse.processing.org/t/hello-some-question-from-a-beginner-drip-effect/32041/10 "2021-09-10T12:20:54Z")

</div>

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!

---

<div class="post-metadata">

### Author: ![asacool](https://avatars.discourse-cdn.com/v4/letter/a/58956e/32.png) [@asacool](https://discourse.processing.org/u/asacool)
#### Post date: [September 15, 2021, 11:58pm UTC](https://discourse.processing.org/t/hello-some-question-from-a-beginner-drip-effect/32041/11 "2021-09-15T23:58:24Z")

</div>

> [@KaliBrain](#):
>
> 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!

Thakns @KaliBrain  
I will keep trying!!!

---

<div class="post-metadata">

### Author: ![Chrisir](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/chrisir/32/45_2.png) [@Chrisir](https://discourse.processing.org/u/Chrisir)
#### Post date: [September 16, 2021, 7:04am UTC](https://discourse.processing.org/t/hello-some-question-from-a-beginner-drip-effect/32041/12 "2021-09-16T07:04:18Z")

</div>

> [@KaliBrain](#):
>
> About the fact that the dripping effect had a spray effect too,

You change mouseY

That’s not a good thing

Instead copy mouseY to a new variable when dripping starts and then work with the new variable

---

<div class="post-metadata">

### Author: ![paulgoux](https://avatars.discourse-cdn.com/v4/letter/p/b9bd4f/32.png) [@paulgoux](https://discourse.processing.org/u/paulgoux)
#### Post date: [September 21, 2021, 5:41pm UTC](https://discourse.processing.org/t/hello-some-question-from-a-beginner-drip-effect/32041/13 "2021-09-21T17:41:39Z")

</div>

> **[Graffiti Painter - OpenProcessing](https://openprocessing.org/sketch/1223721)**
>
> Font: Calligraffitti, from Google Fonts.

---

<div class="post-metadata">

### Author: ![asacool](https://avatars.discourse-cdn.com/v4/letter/a/58956e/32.png) [@asacool](https://discourse.processing.org/u/asacool)
#### Post date: [October 7, 2021, 9:29am UTC](https://discourse.processing.org/t/hello-some-question-from-a-beginner-drip-effect/32041/14 "2021-10-07T09:29:17Z")

</div>

@paulgoux Thx for sharing!!!

---

<div class="post-metadata">

### Author: ![asacool](https://avatars.discourse-cdn.com/v4/letter/a/58956e/32.png) [@asacool](https://discourse.processing.org/u/asacool)
#### Post date: [October 7, 2021, 9:30am UTC](https://discourse.processing.org/t/hello-some-question-from-a-beginner-drip-effect/32041/15 "2021-10-07T09:30:04Z")

</div>

@Chrisir Thanks!! 😉
