# Why does the persistence of vision remain

**URL:** <https://discourse.processing.org/t/why-does-the-persistence-of-vision-remain/4668>\
**Category:** Coding Questions\
**Created:** [October 20, 2018, 12:12am UTC](https://discourse.processing.org/t/why-does-the-persistence-of-vision-remain/4668 "2018-10-20T00:12:36Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![koba](https://avatars.discourse-cdn.com/v4/letter/k/6de8d8/32.png) [@koba](https://discourse.processing.org/u/koba)\
**Post date:** [October 20, 2018, 12:12am UTC](https://discourse.processing.org/t/why-does-the-persistence-of-vision-remain/4668/1 "2018-10-20T00:12:36Z")

</div>

why does the persistence of vision remain in this program ?

```auto
int x = 0;
void setup(){
  size(400,400);
  noStroke();
}
void draw(){
  fill(255);
  ellipse(x,200,10,10);
  x++;
  fill(0);
  ellipse(x,200,10,10);
}

```

---

<div class="post-metadata">

**Author:** ![TfGuy44](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/tfguy44/32/41_2.png) [@TfGuy44](https://discourse.processing.org/u/TfGuy44)\
**Post date:** [October 20, 2018, 12:18am UTC](https://discourse.processing.org/t/why-does-the-persistence-of-vision-remain/4668/2 "2018-10-20T00:18:57Z")

</div>

What you drew in the previous frame remains drawn unless you clear it. This is most easily done with a call to `background()`:

```auto
int x = 0;

void setup() {
  size(400, 400);
  noStroke();
}

void draw() {
  background(196);
  x++;
  fill(0);
  ellipse(x, 200, 10, 10);
}

```

---

<div class="post-metadata">

**Author:** ![koba](https://avatars.discourse-cdn.com/v4/letter/k/6de8d8/32.png) [@koba](https://discourse.processing.org/u/koba)\
**Post date:** [October 27, 2018, 1:46am UTC](https://discourse.processing.org/t/why-does-the-persistence-of-vision-remain/4668/3 "2018-10-27T01:46:47Z")

</div>

Thank you for your reply.  
And sorry for my luck of explainning.  
My question is why the vision remain although I overwrote an ellipse at exactlly same place and same size.

---

<div class="post-metadata">

**Author:** ![kll](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kll/32/964_2.png) [@kll](https://discourse.processing.org/u/kll)\
**Post date:** [October 27, 2018, 1:59am UTC](https://discourse.processing.org/t/why-does-the-persistence-of-vision-remain/4668/4 "2018-10-27T01:59:57Z")

</div>

```auto
  x++;
  ellipse(x, 200, 10, 10);

```

that gives a circle what moves 1 pix to the right every loop

without

> background(0,200,200);

like @TfGuy44 said, you see them all.

---

<div class="post-metadata">

**Author:** ![koba](https://avatars.discourse-cdn.com/v4/letter/k/6de8d8/32.png) [@koba](https://discourse.processing.org/u/koba)\
**Post date:** [October 29, 2018, 2:59am UTC](https://discourse.processing.org/t/why-does-the-persistence-of-vision-remain/4668/5 "2018-10-29T02:59:05Z")

</div>

thank you for your reply.  
instead of  
backrgound(255);

why I cannot use  
fill(255);  
ellipse(x,200,10,10); //x is the place where old ellipse written in previous loop.

---

<div class="post-metadata">

**Author:** ![TfGuy44](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/tfguy44/32/41_2.png) [@TfGuy44](https://discourse.processing.org/u/TfGuy44)\
**Post date:** [October 29, 2018, 4:49am UTC](https://discourse.processing.org/t/why-does-the-persistence-of-vision-remain/4668/6 "2018-10-29T04:49:50Z")

</div>

Good question. Basically, your screen is made up of square pixels, and if you tried to draw a round circle made up of square pixels, it looks terrible. So instead, Processing automatically smooths out the edges. This means that the pixels at the edge of the circle might be a slightly different color from the circle itself.

You can tell Processing to stop doing this with the `noSmooth()` function:

```auto
int x = 0;

void setup(){
  size(400,400);
  noStroke();
  noSmooth();
}

void draw(){
  fill(255);
  ellipse(x,200,10,10);
  x++;
  fill(0);
  ellipse(x,200,10,10);
}

```

---

<div class="post-metadata">

**Author:** ![jb4x](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jb4x/32/789_2.png) [@jb4x](https://discourse.processing.org/u/jb4x)\
**Post date:** [October 29, 2018, 12:09pm UTC](https://discourse.processing.org/t/why-does-the-persistence-of-vision-remain/4668/7 "2018-10-29T12:09:50Z")

</div>

There was a thread about the same problem: [Having a visual problem with overlapping ellipses (solved)](https://discourse.processing.org/t/having-a-visual-problem-with-overlapping-ellipses-solved/3253/7)

---

<div class="post-metadata">

**Author:** ![koba](https://avatars.discourse-cdn.com/v4/letter/k/6de8d8/32.png) [@koba](https://discourse.processing.org/u/koba)\
**Post date:** [October 30, 2018, 1:03am UTC](https://discourse.processing.org/t/why-does-the-persistence-of-vision-remain/4668/8 "2018-10-30T01:03:00Z")

</div>

Thank you for your reply again.  
finally I got it .  
I did not know noSmooth() function.  
Thanks a lot !
