Object disappear when shrink and grow by size

Use this template to make awesome bug reports:

Your username:
RoadOcean
What kind of device are you using?: (Also include iOS version, and Hopscotch version)
3.50.5 14.8
1 sentence description of the problem (I was doing _________, and then __________ happened): I was test grow and shrink and when I put them together. The object disappears

Steps that the Hopscotch team can take to reproduce my problem every time:

  1. Put a grow by 100
  2. Then put a shrink by 100

I expected this to happen: To be same size

But instead this happened: It disappear

Here’s a sweet screenshot:
Project

4 Likes

it’s a percentage value, so it shrinks by 100 percent of its size, so i believe this is intentional.

4 Likes

yes…to add on:

grow by percent + shrink by percent do not work the same as set size percent

if you have an object at size 100 and grow it by 100 percent, it will set size to:
100 * (1 + 1.00) = 200
but if you try to shrink by 100 after that, then this will happen:
200 * (0 + 0) = 0

in other words, those blocks grow/shrink based on the current size while set size is set off a fixed original size

5 Likes

yep, or i suggest using set width and height, bc those are based on the screen’s pixels i think.

4 Likes

this is not replying to your case (which i can tell you rn that is not a bug, read nobody’s post for more information), but just sharing a short documentation by @t1_hopscotch about how shrink and grow works in hopscotch:

4 Likes

Works As Intended.

Since grow by and shrink by use percentage value, shrinking by 100% will make the object shrink to 0% size, no matter the size before.

If you want to shrink it back to original size, use set size % to 100.

Or shrink by 50% to shrink it to half the size.

When using the formula, 200% - (100% * 200%) = 200% - 200% = 0%

200% - (50% * 200%) = 200% - 100% = 100%

So (current size%) - (x * (current size%)) = new size%

Just Realized my math error…

100 (\frac{\text{current size%} - \text{new size%}}{\text{current size%}}) = x This is how to figure out how much to shrink by to get the that new size from a set current size.

For grow by, it’s just (new size - current size)
(125 - 100) = 25

let new size% = 100%, let current size% = 125%

100 (\frac{\text{125} - \text{100}}{\text{125}}) = x, which = (25 / 125)*100 = 0.2 * 100 = 20 (x = 20)

5 Likes

I knew all that time in Algebra would pay off. I just did the “Do Undo” method to find x in the original formula done by t1_hopscotch. I had to move some things around, but I got through it…

x = the value placed in the parameter of the shrink by block.

I also found out shrink by -100 acts like grow by 100 very recently.

((50 - 100) / 50) * 100 = -1 * 100 = -100

3 Likes

So this is intentional from what your saying?

1 Like

Yeah – in fact, this behavior was why the set size block was added in the first place. (HS wanted a better way to set a specific size rather than relative adjustments).

Grow and shrink by design are relative to the current size, and the in-app description says it too I think

3 Likes

So for example my object size is 1000
If I shrink by 50
It will get 500?

That makes Soo much sense

3 Likes

Yep, that’s right

3 Likes

clive?

We know that this is intentional now

Yes Clive please

1 Like