# How do I Zoom in Layout, Zoom out Layer

0 favourites
• 10 posts
From the Asset Store
All popular touch mechanics - scrolling, zooming, swiping
• 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?

• 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...)

• yapiiiii - oh of course! So does that mean the final UI scale should be 0.83333 instead of 0.8?

• yes, or more exactly 1/1.2

• yapiiiii - great thank you!

• I don't get this. How do I write this math formula when I lerp the "UI" layer?

• like this:

lerp(minZoom, maxZoom, percentageBetweenThem)

like:

lerp(0.01,100,0.56) meaning 56% of the way between LayerScale 0.01 and 100.

• 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

• Ah, now that's a much easier and better way to do it - thanks!

• ## Try Construct 3

Develop games in your browser. Powerful, performant & highly capable.

Construct 3 users don't see these ads
• thanks! this helped me with my latest project.

• 10 posts