Svg scale start again when svg size is too big

Hi everyone,
I’m new in processing dev, I have this code to scale a svg, I don’t know how to start again the scale when the svg go out the screen, like being at the original size and position .
Thank’s
Yves

PShape bot;
boolean kk= false;
Timer timer_tree;


void setup() {
  size(1900, 1000, P3D);
  // The file "bot1.svg" must be in the data folder
  // of the current sketch to load successfully
bot = loadShape("kk.svg");
  frameRate(30);
    timer_tree = new Timer(2000);
  timer_tree.start();
} 

void draw(){
  background(0);
if (timer_tree.isFinished()) {
pushMatrix();
bot.disableStyle();  // Ignore the colors in the SVG
  fill(255);    // Set the SVG fill to white
rotateY(-.5f);
   shapeMode(CENTER); // set shape origin to the center of the shape
 shape(bot, 280, 40); 
    bot.scale(1.01, 1.01, 1.01);  // Draw at coordinate (280, 40) at the default size 
   //println(bot.width);
    popMatrix();
   }
  
  
}

Hi @yves ,

Welcome to the forum! :wink:

Do you want to animate the scale of the SVG and if the SVG becomes bigger than the size of the window, you reset its scale?

Hi Josephh,
thank’s for the answer, yes that’s it.
like a loop, the scale becomes bigger and bigger, and when he’s bigger than the window, it starts at the coords and the original size and zoom again.
And I would like to make it for many shapes, what’s the best way to do that ?
thank’s again
Yves