Hi there,
this is a simplification of a longer and more complex code I'm working on...
let's say I have a rectangle with random size and I want to change the size of the sketch so that it equals the width of the rectangle + 10.
How do I do that?
The problem:
- void setup() {
- size(300,300);
- background(255);
- int recw = int(random(250,800));
- rect(10,10, recw, recw);
- width = recw+10;
- height = recw+10;
- }
- void draw() {
- }
1