# Adjusting window size AND shape size

**URL:** <https://discourse.processing.org/t/adjusting-window-size-and-shape-size/19025>\
**Category:** Coding Questions\
**Created:** [March 26, 2020, 5:10am UTC](https://discourse.processing.org/t/adjusting-window-size-and-shape-size/19025 "2020-03-26T05:10:59Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tina](https://avatars.discourse-cdn.com/v4/letter/t/48db29/32.png) [@Tina](https://discourse.processing.org/u/Tina)\
**Post date:** [March 26, 2020, 5:10am UTC](https://discourse.processing.org/t/adjusting-window-size-and-shape-size/19025/1 "2020-03-26T05:10:59Z")

</div>

I want to code my program so that regardless of what the window size is modified to, the shape (rectangle) will also change according to the new size. In other words, the rectangle size and position should adjust if the programmer changes the window size.

My rectangle is also moving down the screen at one pixel at a time (which takes around 10 seconds to reach the bottom from the top).

I have tried numerous ways but I still can’t figure out how to achieve this. Thank you for your help!!

This is my code so far:

```auto
int travel = 0;

void setup() {
  size(1280, 720);
}

void draw() {
  background(240, 240, 240);
  fill(255, 147, 79);
  rect(0, travel, 90, 90);
  travel = travel + 1;
}

```

---

<div class="post-metadata">

**Author:** ![matheplica](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/matheplica/32/21035_2.png) [@matheplica](https://discourse.processing.org/u/matheplica)\
**Post date:** [March 26, 2020, 7:07am UTC](https://discourse.processing.org/t/adjusting-window-size-and-shape-size/19025/2 "2020-03-26T07:07:16Z")

</div>

You should use [height](https://processing.org/reference/height.html) and [width](https://processing.org/reference/width.html)

---

<div class="post-metadata">

**Author:** ![Tina](https://avatars.discourse-cdn.com/v4/letter/t/48db29/32.png) [@Tina](https://discourse.processing.org/u/Tina)\
**Post date:** [March 27, 2020, 3:42am UTC](https://discourse.processing.org/t/adjusting-window-size-and-shape-size/19025/3 "2020-03-27T03:42:43Z")

</div>

I understand that, but how would I apply them?

---

<div class="post-metadata">

**Author:** ![matheplica](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/matheplica/32/21035_2.png) [@matheplica](https://discourse.processing.org/u/matheplica)\
**Post date:** [March 28, 2020, 12:28pm UTC](https://discourse.processing.org/t/adjusting-window-size-and-shape-size/19025/4 "2020-03-28T12:28:51Z")

</div>

```auto
rect(0, travel, width/14, height/8);

```
