# Scale the whole screen content to the back

**URL:** <https://discourse.processing.org/t/scale-the-whole-screen-content-to-the-back/15712>\
**Category:** Coding Questions\
**Created:** [November 22, 2019, 10:49am UTC](https://discourse.processing.org/t/scale-the-whole-screen-content-to-the-back/15712 "2019-11-22T10:49:18Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![lumicon9](https://avatars.discourse-cdn.com/v4/letter/l/f475e1/32.png) [@lumicon9](https://discourse.processing.org/u/lumicon9)\
**Post date:** [November 22, 2019, 10:49am UTC](https://discourse.processing.org/t/scale-the-whole-screen-content-to-the-back/15712/1 "2019-11-22T10:49:18Z")

</div>

i want to scale the screen content slowly to the (pseudo)back, using a 2d scale (shrinking).  
here is what i have as start out;

```auto
int siz = 66;

 void setup(){
   size(800,600);
}
 
void draw(){
  ellipse((int)random(width), (int)random(height),siz,siz);
}

```

this constantly created content should scale (seemingly) backwards, endlessly as new objects are generated…

---

<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:** [November 22, 2019, 10:59am UTC](https://discourse.processing.org/t/scale-the-whole-screen-content-to-the-back/15712/2 "2019-11-22T10:59:24Z")

</div>

[https://processing.org/reference/scale\_.html](https://processing.org/reference/scale_.html)  
would be more easy, but only if centered,

\_\_

```auto
float zoom=100;
void setup(){}
void draw() {
  translate(width/2,height/2);
  circle(0,0,zoom);
  zoom*=0.95;
}

```

might be other way.

---

<div class="post-metadata">

**Author:** ![lumicon9](https://avatars.discourse-cdn.com/v4/letter/l/f475e1/32.png) [@lumicon9](https://discourse.processing.org/u/lumicon9)\
**Post date:** [November 22, 2019, 11:07am UTC](https://discourse.processing.org/t/scale-the-whole-screen-content-to-the-back/15712/3 "2019-11-22T11:07:24Z")

</div>

thanks for getting back to my question!  
well, i mean the animation;

- how to separate a certain object animation (shrinking) to generate them again and again to the stage.  
i’ve seen something like this using a PVector[] array which seemed great, but could get the syntax right…

---

<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:** [November 22, 2019, 11:21am UTC](https://discourse.processing.org/t/scale-the-whole-screen-content-to-the-back/15712/4 "2019-11-22T11:21:20Z")

</div>

not understand, but with

```auto
  zoom*=0.95;
  if ( zoom < 0.05 ) zoom = 100;

```

it runs again and again  
if that is what you call animation?

---

<div class="post-metadata">

**Author:** ![lumicon9](https://avatars.discourse-cdn.com/v4/letter/l/f475e1/32.png) [@lumicon9](https://discourse.processing.org/u/lumicon9)\
**Post date:** [November 22, 2019, 3:41pm UTC](https://discourse.processing.org/t/scale-the-whole-screen-content-to-the-back/15712/5 "2019-11-22T15:41:54Z")

</div>

> [@kll](#):
>
> float zoom=100; void setup(){} void draw() { translate(width/2,height/2); circle(0,0,zoom); zoom\*=0.95; }

this zoom\* is good either. thank you!

---

<div class="post-metadata">

**Author:** ![lumicon9](https://avatars.discourse-cdn.com/v4/letter/l/f475e1/32.png) [@lumicon9](https://discourse.processing.org/u/lumicon9)\
**Post date:** [November 22, 2019, 3:56pm UTC](https://discourse.processing.org/t/scale-the-whole-screen-content-to-the-back/15712/6 "2019-11-22T15:56:56Z")

</div>

how can i make each circle zoom animation from beginning to end?

```auto
float zoom=100;
int count;
void setup(){
  size(555,555);
}

void draw() {
  count+=1;
  
  if(count==10){
    elli((int)random(width),(int)random(height));
    count=0;
  }
}

void elli(int x, int y){
  //translate(width/2,height/2);
  ellipse(x,y,zoom,zoom);
  zoom*=0.95;
}

```
