# Why circle disappears at y-coordinates ~ 250

**URL:** https://discourse.processing.org/t/why-circle-disappears-at-y-coordinates-250/42256
**Category:** Coding Questions
**Created:** [June 20, 2023, 8:55am UTC](https://discourse.processing.org/t/why-circle-disappears-at-y-coordinates-250/42256 "2023-06-20T08:55:19Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![helpME0](https://avatars.discourse-cdn.com/v4/letter/h/2acd7d/32.png) [@helpME0](https://discourse.processing.org/u/helpME0)
#### Post date: [June 20, 2023, 8:55am UTC](https://discourse.processing.org/t/why-circle-disappears-at-y-coordinates-250/42256/1 "2023-06-20T08:55:19Z")

</div>

```auto
void setup() {
  size(500,500);
  background(0);
}
void draw() {
  loop();
   float y=500+(-90*millis()/1000+(10*millis()*millis()/2/1000000));
   float D=25;
   float x = 0+15*millis()/1000;
   float yc = y;
   float xc=x;
     background(0);
     if (y >500) {
       yc = -y;
     }
     if (x >500) {
       xc = -x;
     }
  circle(xc, yc, D);
  print(millis());
  if (millis()/1000>100){noLoop();}
  
}

```

---

<div class="post-metadata">

### Author: ![appas](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/appas/32/18810_2.png) [@appas](https://discourse.processing.org/u/appas)
#### Post date: [June 20, 2023, 10:40am UTC](https://discourse.processing.org/t/why-circle-disappears-at-y-coordinates-250/42256/2 "2023-06-20T10:40:30Z")

</div>

Your y value jumps from 254.0 to -1891.0. This is because you call millis() twice. I replaced your code with

```auto
  float millis = millis();
  float y=500+(-90*millis/1000+(10*millis*millis/2/1000000));

```

Try that.

---

<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: [July 30, 2023, 12:38pm UTC](https://discourse.processing.org/t/why-circle-disappears-at-y-coordinates-250/42256/3 "2023-07-30T12:38:41Z")

</div>

Hello,

This was in my _Drafts_ and a late response… it may still be helpful to some.

> [@appas](#):
>
> This is because you call millis() twice

It is because the math is exceeding the maximum value of an integer at some point in the code:

[https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html](https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html)

This code shows what happens to `y1` when `millis()` (an integer) is greater than 14654:

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/3X/f/f/ff5541d31c360204641f9dc29466ff43b785f7f2.png)

The above code shows where the point of concern is in the code.

You are using `millis()/1000` for time.

Consider using this floating point division in your code along with floating point math throughout:

`float t = millis()/1000.0; // Result is floating point`

Use this if you intend to use _integer math_ with 1 sec increments:

`float t = millis()/1000; // Result is an integer`

Your code will look much cleaner and identifiable as the equation to a parabola:

`float y = 20*t*t -100*t+ 200;`

`:)`
