# Why do my ellipse become bigger when it "further away" processing

**URL:** https://discourse.processing.org/t/why-do-my-ellipse-become-bigger-when-it-further-away-processing/39690
**Category:** Coding Questions
**Created:** [November 13, 2022, 12:06pm UTC](https://discourse.processing.org/t/why-do-my-ellipse-become-bigger-when-it-further-away-processing/39690 "2022-11-13T12:06:54Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![returng](https://avatars.discourse-cdn.com/v4/letter/r/97f17d/32.png) [@returng](https://discourse.processing.org/u/returng)
#### Post date: [November 13, 2022, 12:06pm UTC](https://discourse.processing.org/t/why-do-my-ellipse-become-bigger-when-it-further-away-processing/39690/1 "2022-11-13T12:06:54Z")

</div>

Hello, I have a problem the ellipse size becomes smaller when I use mousePressed but as it is further away it becomes bigger and bigger.

```auto
float gravity = .4;
int particle_each_time = 4;
ArrayList<Particle> particle= new ArrayList<Particle>(); // ArrayList to manage to list of all particles

void setup() {
  size(640,480);
}

void draw() {
  background(0);
  for (int i = 0; i < particle_each_time; i++) {
    particle.add(new Particle(mouseX,mouseY));
  }
  for (int i = 0; i < particle.size(); i++) {
    Particle p = particle.get(i);
    p.update(gravity);
    p.draw();
  }
  
}
 void mousePressed() {
}

class Particle{
  float x; //X Position
  float y; //Y Position
  float velX; //velocity on X axis
  float velY; //velocity on Y axis
  float size; // Size of the particle
  float lifespan; // duration of the particle
  float col;//create fire type colours
  
  Particle(float x,float y){
    this.velY = random(-10,10);
    this.velX = random(-10,10);
    this.x = x;
    this.y = y;
    this.size = 15;
    lifespan = 220.0;
    col = random(#DE8816);
  }
  
  void update(float gravity){
    this.x += velX; // direction of X axis
    velY += gravity; // gravity affectiing the velocity on Y axis causing to fall
    this.y += velY; //direction of Y axis
    lifespan -= 1.0;
    if (mousePressed ) {
      size--;
    }
   
  }
  
  boolean isDead() {
    if (lifespan < 0.0) {
      return true;
    } else {
      return false;
    }
  } 
  
  void draw() {
    stroke(0,lifespan);
    fill(#DE8816,lifespan);
    ellipse(x,y,size,size);
  }
  
}

```

---

<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: [November 13, 2022, 12:08pm UTC](https://discourse.processing.org/t/why-do-my-ellipse-become-bigger-when-it-further-away-processing/39690/2 "2022-11-13T12:08:49Z")

</div>

size of the ellipse can get smaller than 0

Then it’s getting bigger and bigger (probably the right side being left now…)

Check `if (size<0)` and then set `size=1;`

---

<div class="post-metadata">

### Author: ![returng](https://avatars.discourse-cdn.com/v4/letter/r/97f17d/32.png) [@returng](https://discourse.processing.org/u/returng)
#### Post date: [November 13, 2022, 12:22pm UTC](https://discourse.processing.org/t/why-do-my-ellipse-become-bigger-when-it-further-away-processing/39690/3 "2022-11-13T12:22:13Z")

</div>

I see thank you very much, dint know that
