# Svg scale start again when svg size is too big

**URL:** https://discourse.processing.org/t/svg-scale-start-again-when-svg-size-is-too-big/29580
**Category:** Processing
**Created:** [April 23, 2021, 2:23pm UTC](https://discourse.processing.org/t/svg-scale-start-again-when-svg-size-is-too-big/29580 "2021-04-23T14:23:29Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![yves](https://avatars.discourse-cdn.com/v4/letter/y/9e8a1a/32.png) [@yves](https://discourse.processing.org/u/yves)
#### Post date: [April 23, 2021, 2:23pm UTC](https://discourse.processing.org/t/svg-scale-start-again-when-svg-size-is-too-big/29580/1 "2021-04-23T14:23:29Z")

</div>

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

```auto
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();
   }
  
  
}

```

---

<div class="post-metadata">

### Author: ![josephh](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/josephh/32/210_2.png) [@josephh](https://discourse.processing.org/u/josephh)
#### Post date: [April 23, 2021, 11:12pm UTC](https://discourse.processing.org/t/svg-scale-start-again-when-svg-size-is-too-big/29580/2 "2021-04-23T23:12:12Z")

</div>

Hi @yves ,

Welcome to the forum! 😉

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?

---

<div class="post-metadata">

### Author: ![yves](https://avatars.discourse-cdn.com/v4/letter/y/9e8a1a/32.png) [@yves](https://discourse.processing.org/u/yves)
#### Post date: [April 24, 2021, 5:11am UTC](https://discourse.processing.org/t/svg-scale-start-again-when-svg-size-is-too-big/29580/3 "2021-04-24T05:11:18Z")

</div>

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
