# Ellipse not moving

**URL:** <https://discourse.processing.org/t/ellipse-not-moving/15351>\
**Category:** Coding Questions\
**Created:** [November 9, 2019, 2:46pm UTC](https://discourse.processing.org/t/ellipse-not-moving/15351 "2019-11-09T14:46:32Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tobias](https://avatars.discourse-cdn.com/v4/letter/t/c67d28/32.png) [@Tobias](https://discourse.processing.org/u/Tobias)\
**Post date:** [November 9, 2019, 2:46pm UTC](https://discourse.processing.org/t/ellipse-not-moving/15351/1 "2019-11-09T14:46:32Z")

</div>

I used to know almost all the features in processing like a year ago, and now I decided to get back and try again. I just made a simple script telling the console to show a circle with some gravity, and everything works fine but one thing. The circle is redrawing every frame, but not deleting the old frames. Just copy the code and try for yourself. Is there anything i did wrong? I also tried this ecsact code, but with a rectangle instead of an ellipse and everything worked.

```auto
float gravity = 0;
float y = 180;

void setup(){
  size(640, 360);
  background(0);
}

 void draw(){
  ellipse(320, y, 10, 10);
  
  y = y + gravity;
  gravity = gravity + 0.4;
}

```

---

<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 9, 2019, 3:20pm UTC](https://discourse.processing.org/t/ellipse-not-moving/15351/2 "2019-11-09T15:20:52Z")

</div>

background (0); at start of draw

---

<div class="post-metadata">

**Author:** ![Tobias](https://avatars.discourse-cdn.com/v4/letter/t/c67d28/32.png) [@Tobias](https://discourse.processing.org/u/Tobias)\
**Post date:** [November 9, 2019, 7:02pm UTC](https://discourse.processing.org/t/ellipse-not-moving/15351/3 "2019-11-09T19:02:22Z")

</div>

Thanks, it worked, but i still dont get why the rectangle works anyway.

---

<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 9, 2019, 7:09pm UTC](https://discourse.processing.org/t/ellipse-not-moving/15351/4 "2019-11-09T19:09:35Z")

</div>

> [@Tobias](#):
>
> i still dont get why the rectangle works anyway.

you mean why the background (0); at start of draw solves the problem?

---

<div class="post-metadata">

**Author:** ![Tiemen](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/tiemen/32/5477_2.png) [@Tiemen](https://discourse.processing.org/u/Tiemen)\
**Post date:** [November 9, 2019, 7:31pm UTC](https://discourse.processing.org/t/ellipse-not-moving/15351/5 "2019-11-09T19:31:44Z")

</div>

I replaced `ellipse` with `rect` and the same issue occurs. Are you positive you didn’t accidently changed something?

---

<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 10, 2019, 1:46pm UTC](https://discourse.processing.org/t/ellipse-not-moving/15351/6 "2019-11-10T13:46:01Z")

</div>

Hi Tobias,

180 is the start position for y.

We add the gravity to y which is initially 0.

Since we increase gravity over time, the shape accelerates.

Normally though we add vy to y and vy gets changed by gravity - see [https://processing.org/examples/bouncybubbles.html](https://processing.org/examples/bouncybubbles.html)

gravity is constant here, as it is in real life
