Zoom in/out

Discussion and feedback on Construct 2

Post » Fri Oct 17, 2014 1:43 pm

Hello everyone i have question about how to zoom in/out in specific point like at mouse position ?
B
4
Posts: 2
Reputation: 204

Post » Fri Oct 17, 2014 1:55 pm

You can change the scale of a layer and use the ScrollTo behavior to set the focus.
ImageImageImageImageImage
B
19
S
5
G
1
Posts: 614
Reputation: 2,542

Post » Fri Oct 17, 2014 2:12 pm

i did it but i cant change speed of scrolling :(
B
4
Posts: 2
Reputation: 204

Post » Fri Oct 17, 2014 2:21 pm

Scrolling speed is very custom kind of thing. Your going to need to figure it out. however here is the basics.

startScale
endScale

EveryTick
If( layoutscale != endScale )
layoutscale = lerp( startScale, endScale, lerpValue between 0-1)

and for scrolling
My suggestion is to
make a camera target object
make a camera object. Attach ScrollTo behaviour to the camera object.

move the camera target object to where you want.

Evertick
if camera target is not overlapping camera object
cameraveObject.moveTowards XY of CameraTarget of speedInPixels * dt
B
90
S
18
G
9
Posts: 2,455
Reputation: 15,018

Post » Sat Oct 18, 2014 7:10 am

Magicam is a great plugin for doing all kinds of camera related movments. check it out in the plugins section
B
87
S
44
G
16
Posts: 1,002
Reputation: 17,932

Post » Sat Oct 18, 2014 10:11 am

Use a global variable Zoom.

Zoom = 0 ----- set layout scale to : lerp(layoutscale, 0.4, 1*dt) .... this zoom out
Zoom = 1 ----- set layout scale to : lerp(layoutscale, 1.5, 1*dt) ....... this zoom in
B
60
S
10
G
10
Posts: 1,013
Reputation: 9,155


Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 11 guests