# Resize rectangle

**URL:** <https://discourse.processing.org/t/resize-rectangle/33343>\
**Category:** Coding Questions\
**Tags:** homework\
**Created:** [November 5, 2021, 5:13pm UTC](https://discourse.processing.org/t/resize-rectangle/33343 "2021-11-05T17:13:46Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![stefanmz7](https://avatars.discourse-cdn.com/v4/letter/s/9dc877/32.png) [@stefanmz7](https://discourse.processing.org/u/stefanmz7)\
**Post date:** [November 5, 2021, 5:13pm UTC](https://discourse.processing.org/t/resize-rectangle/33343/1 "2021-11-05T17:13:46Z")

</div>

Hey,so I need to resize a rectangle when a condition is met. Can I do this? Is there a way to resize a rectangle that is drawn in the draw method() after the fact in an if statement? If something is true then resize the rectangle. Can I do this? Is there a function? I found scale but it doesn’t seem to do exactly what I want.

---

<div class="post-metadata">

**Author:** ![svan](https://avatars.discourse-cdn.com/v4/letter/s/82dd89/32.png) [@svan](https://discourse.processing.org/u/svan)\
**Post date:** [November 5, 2021, 6:11pm UTC](https://discourse.processing.org/t/resize-rectangle/33343/2 "2021-11-05T18:11:48Z")

</div>

Try making the width and height of the rectangle a variable. Then when the condition is met change the variables to whatever you want.

---

<div class="post-metadata">

**Author:** ![stefanmz7](https://avatars.discourse-cdn.com/v4/letter/s/9dc877/32.png) [@stefanmz7](https://discourse.processing.org/u/stefanmz7)\
**Post date:** [November 5, 2021, 6:16pm UTC](https://discourse.processing.org/t/resize-rectangle/33343/3 "2021-11-05T18:16:36Z")

</div>

hmm ok I haven’t thought about that

---

<div class="post-metadata">

**Author:** ![stefanmz7](https://avatars.discourse-cdn.com/v4/letter/s/9dc877/32.png) [@stefanmz7](https://discourse.processing.org/u/stefanmz7)\
**Post date:** [November 5, 2021, 6:47pm UTC](https://discourse.processing.org/t/resize-rectangle/33343/4 "2021-11-05T18:47:24Z")

</div>

UPDATE: I made it work by doing that and then teleporting it in the corner and also making the width and height 0 so it basically disappears,well it’s still there but it blends in with the corner and the ball will bounce from the corner anyway so that’s fine. Oh yeah,by the way I am making a brick breaker so I needed a way to remove the bricks as the ball hits them. Thanks a lot! That was a very simple solution that I should have figured out but my brain just turned off and I would have probably spent the whole night searching,so thanks a lot!
