# Circles drawing differently in active and static modes

**URL:** https://discourse.processing.org/t/circles-drawing-differently-in-active-and-static-modes/37735
**Category:** Beginners
**Created:** [June 27, 2022, 4:20pm UTC](https://discourse.processing.org/t/circles-drawing-differently-in-active-and-static-modes/37735 "2022-06-27T16:20:03Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Nicholas](https://avatars.discourse-cdn.com/v4/letter/n/4da419/32.png) [@Nicholas](https://discourse.processing.org/u/Nicholas)
#### Post date: [June 27, 2022, 4:20pm UTC](https://discourse.processing.org/t/circles-drawing-differently-in-active-and-static-modes/37735/1 "2022-06-27T16:20:03Z")

</div>

Hello all

I’ve just installed Processing 4, and when I run the following in static mode I get a smooth circle:

```auto
size(500,500);
noStroke();
circle(width/2,height/2,20);

```

 ![smooth](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/3X/6/b/6bdb707ffc73727ca72926d128c2a8bcc7a715a5.png)

But when I run the same code in active mode it draws more of a square with round corners:

```auto
void setup()
{
  size(500,500);
}

void draw()
{
  noStroke();
  circle(width/2,height/2,20);
}

```

 ![Screenshot 2022-06-27 171202](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/3X/e/0/e068bf964249763329b8a1d3f88112fb75f5e9fa.png)

I know this may seem like a small issue, but I don’t want to lose nice round edges on small shapes, and it’s very frustrating to run into unexpected behaviour on the most basic sketch. Does anyone know how to fix this?

Thanks

Edit:  
Just checked this in P3 and the same thing is happening.

---

<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: [June 27, 2022, 5:11pm UTC](https://discourse.processing.org/t/circles-drawing-differently-in-active-and-static-modes/37735/2 "2022-06-27T17:11:28Z")

</div>

Hello @Nicholas,

Take a look at the reference for `draw()` :

> **[Reference](https://processing.org/reference/draw_.html)**
>
> Called directly after setup(), the draw() function continuously executes the lines of code contained inside its block until the program is stopped or noLoop() is called. draw()…

The answer is in there…

`:)`

---

<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: [June 27, 2022, 9:58pm UTC](https://discourse.processing.org/t/circles-drawing-differently-in-active-and-static-modes/37735/3 "2022-06-27T21:58:06Z")

</div>

You need to clear the previous frame before drawing on top of it:

```auto
void setup()
{
  size(500,500);
}

void draw()
{
  background(200);
  noStroke();
  circle(width/2,height/2,250);
}

```

Otherwise, the semi-transparent pixels add up until they appear fully white.

---

<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: [June 29, 2022, 1:43am UTC](https://discourse.processing.org/t/circles-drawing-differently-in-active-and-static-modes/37735/4 "2022-06-29T01:43:16Z")

</div>

> [@jb4x](#):
>
> Otherwise, the semi-transparent pixels add up until they appear fully white.

Hello,

I believe this is due to the smoothing that is applied each frame and is not related to transparency.

Code to visualize this:

```auto
// Smooth and anti- aliasing
// v1.0.0
// GLV 2022-06-28

PImage img; 

void setup() 
  {
  size(650, 650);
  background(255); // Try (0)
  smooth(2); //Default. Try other values!
  //noSmooth(); // Try it with this!
  frameRate(1); // Slow things down to visualize
  }
  
void draw() 
  {
  noStroke();
  fill(255, 0, 0);
  circle(15, 15, 25);
  img = get(0, 0, 30, 30); // gets a rectangular section of image
  
  translate(30, 30);
  // Magnifies 20x
  int m = 20;
  for(int y = 0; y< img.height; y++)
    {
    for(int x = 0; x< img.width; x++)
      {
      int c = img.pixels[x+y*img.width];
      fill(c);
      rect(x*m, y*m, m, m);
      }
    }
  }
  
// Save a frame
void keyPressed()
  {
  saveFrame(str(frameCount) + ".png");
  }

```

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/3X/1/9/1987c48cb199fff5f39ae7651577413e517ce305.png)

References:

- [https://github.com/processing/processing4/blob/master/core/src/processing/core/PApplet.java#L1133](https://github.com/processing/processing4/blob/master/core/src/processing/core/PApplet.java#L1133)

- [https://processing.org/reference/smooth\_.html](https://processing.org/reference/smooth_.html)

- [Java and anti-aliasing](https://blog.idrsolutions.com/2011/08/java-and-anti-aliasing/) \< Nice explanation.

`:)`

---

<div class="post-metadata">

### Author: ![Nicholas](https://avatars.discourse-cdn.com/v4/letter/n/4da419/32.png) [@Nicholas](https://discourse.processing.org/u/Nicholas)
#### Post date: [June 29, 2022, 12:42pm UTC](https://discourse.processing.org/t/circles-drawing-differently-in-active-and-static-modes/37735/5 "2022-06-29T12:42:17Z")

</div>

Amazing!

Thank you very much everyone for the different levels of explanation, it is all helpful. I’m not new to processing but it’s been a while and this tripped me up 😅  
I’m remaking/ improving an instrument for performing lumia I’ve built previously, if you are interested this it it:

[Linaeyeux](https://wellwood.studio/portfolio/lineayeux-app)

☮
