# How do I Zoom in Layout, Zoom out Layer

Get help using Construct 2

### » Sat Jul 25, 2015 7:38 pm

I'm trying to do a layout zoom in while keeping the UI layer normal. I have tons of layers and every stage has different layers, so to avoid zooming in on 200 layers simultaneously I'm trying to do the following:

Zoom in Layout : LayoutScale+0.1*dt
Zoom out Layer "UI" : LayerScale("UI")-0.1*dt

if LayoutScale > 1.2
Set LayoutScale 1.2
Set Layer "UI" Scale to 0.8

While this looks...okay, sometimes it doesn't match up exactly at the end. Can anyone think of a better way to do this?
B
49
S
12
G
1
Posts: 551
Reputation: 4,408

### » Sat Jul 25, 2015 8:18 pm

that's only a maths problem:
at first, the scale of your layer "UI" is 1
then you multiply it by 1.2
then you multiply by 0.8
==> 1*1.2*0.8 = 0.96 different from 1 !

instead of multiplying by 0.8, you should multiply by 1/1.2 (ie 0.83333333...)
B
8
S
1
Posts: 76
Reputation: 628

### » Sun Jul 26, 2015 4:32 am

@yapiiiii - oh of course! So does that mean the final UI scale should be 0.83333 instead of 0.8?
B
49
S
12
G
1
Posts: 551
Reputation: 4,408

### » Sun Jul 26, 2015 11:14 am

yes, or more exactly 1/1.2
B
8
S
1
Posts: 76
Reputation: 628

### » Sun Jul 26, 2015 5:46 pm

@yapiiiii - great thank you!
B
49
S
12
G
1
Posts: 551
Reputation: 4,408

### » Wed May 03, 2017 6:02 pm

I don't get this. How do I write this math formula when I lerp the "UI" layer?
B
9
S
1
G
1
Posts: 42
Reputation: 1,213

### » Wed May 03, 2017 7:32 pm

like this:

lerp(minZoom, maxZoom, percentageBetweenThem)

like:

lerp(0.01,100,0.56) meaning 56% of the way between LayerScale 0.01 and 100.
https://www.ravenheart.ca/home
I don't check the forums much anymore, but I will receive an email for PMs.

"Someone once told me I bite off more than I can chew...

I told them I would rather choke on greatness than nibble on mediocrity."
B
23
S
6
G
1
Posts: 1,419
Reputation: 4,867

### » Wed May 03, 2017 8:47 pm

@Plowman

Alternatively, you could make the UI layer not scale at all when you scale the Layout by just setting it Scale Rate to 0 in the Layer properties
Find all the Construct 2 games that were on Steam Greenlight here
B
38
S
10
G
7
Posts: 501
Reputation: 7,129

### » Wed May 03, 2017 9:29 pm

Ah, now that's a much easier and better way to do it - thanks!
B
9
S
1
G
1
Posts: 42
Reputation: 1,213

### » Fri May 05, 2017 12:34 am

thanks! this helped me with my latest project.
Play Ball Walker App Store | Google Play | Amazon
B
39
S
6
Posts: 141
Reputation: 2,520