# Resize shapes random

**URL:** https://discourse.processing.org/t/resize-shapes-random/29265
**Category:** Coding Questions
**Created:** [April 10, 2021, 6:33pm UTC](https://discourse.processing.org/t/resize-shapes-random/29265 "2021-04-10T18:33:06Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Panda](https://avatars.discourse-cdn.com/v4/letter/p/71c47a/32.png) [@Panda](https://discourse.processing.org/u/Panda)
#### Post date: [April 10, 2021, 6:33pm UTC](https://discourse.processing.org/t/resize-shapes-random/29265/1 "2021-04-10T18:33:06Z")

</div>

Is there a way to randomly resize shapes that are repeating?  
I have a simple window full of repeating rect(). Is there a way to throw in a random option, so that each repetition is randomly shrunk or enlarged? (Thus, randomly resized)  
My code:  
\</\>  
Timer timer;  
void setup() {  
size(450, 300);  
timer = new Timer(3000);  
timer.start();  
smooth();  
}  
void draw(){  
if(timer.isFinished()){  
background(random(255), random(255),random(255));  
timer.start();//restarts timer  
fill(10,15,247, 50);//transparecny set purposely to lightly mimic background fill  
for (int x = 20; x \< 420; x +=100)  
rect( x,50, 70, 30);  
for (int x = 20; x \< 420; x +=100)  
rect( x, 100, 70, 30);  
}  
}  
//timer class  
class Timer {  
int savedTime;  
int totalTime;

Timer(int tempTotalTime) {//timer started  
totalTime = tempTotalTime;//length of timer  
}  
void start() {  
savedTime = millis();//millis makes timer run smoother than sec  
}  
boolean isFinished() {  
int passedTime = millis() - savedTime;  
if (passedTime \> totalTime) {  
return true;  
} else {  
return false;  
}  
}  
}  
\</\>

Would I have to turn the shape into a class to do this?

---

<div class="post-metadata">

### Author: ![micuat](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/micuat/32/19407_2.png) [@micuat](https://discourse.processing.org/u/micuat)
#### Post date: [April 10, 2021, 7:59pm UTC](https://discourse.processing.org/t/resize-shapes-random/29265/2 "2021-04-10T19:59:19Z")

</div>

hi! please format your code using `</>` button!

> [@Guidelines—Asking Questions](https://discourse.processing.org/t/guidelines-asking-questions/2147):
>
> Summary (TL;DR) Ask complete questions to get better answers! Be specific. For example: I want to load an image. I tried using createImg() , and I expected the image to be on canvas, but what happened instead was the image showing up below the canvas. Isolate your problem and work in small steps. Share only the code directly related to your problem if it is part of a bigger project, and if something isn’t working, try the smallest code that could do the thing you want. Can we run your code to …
