How do I pinch zoom

Get help using Construct 2

Post » Fri May 30, 2014 11:53 am

Hi everyone,

Could anyone point me in the right direction in regards to implementing a pinch-to-zoom feature?

Can construct even support this behaviour?

Thanks!
B
13
S
6
Posts: 130
Reputation: 1,553

Post » Fri May 30, 2014 1:55 pm

mmmm Good question

I dont know if there is an easier way

but personally id use Two invisible helper sprites connected to the touch function

On touch spawn invisible helper sprite 1 at Touch pos X,Y and record this pos data in a Temporary variable
and then somehow detect touch 2 and spawn second sprite at second pos X,Y and record that data

then make an event loop or normal event to check to see if both sprites are on screen if so...
if so..
then check for "distance" movement between the two., x, y pos data ..if the "distance" is increasing ..zoom layout out
if its decreasing ..zoom layout in...

if no touch on the screen destroy sprites and clear any XY data stored

C2 does supports Multi touch which is what you want directly....you could read up it here..

https://www.scirra.com/manual/119/touch

Hope that gets you started somehow
When in doubt..or you are lost in a Zombie apocalypse or someone is giving you a hard time..Remember one thing..... Read the Construct 2 Manual..it will save your life.:)
B
35
S
13
G
8
Posts: 318
Reputation: 7,685

Post » Fri May 30, 2014 5:50 pm

Message: TMAJA can only post plain text URLS until they have 500 rep. 1 URLS modified. Why?
mystazsea wrote:mmmm Good question

I dont know if there is an easier way

but personally id use Two invisible helper sprites connected to the touch function

On touch spawn invisible helper sprite 1 at Touch pos X,Y and record this pos data in a Temporary variable
and then somehow detect touch 2 and spawn second sprite at second pos X,Y and record that data

then make an event loop or normal event to check to see if both sprites are on screen if so...
if so..
then check for "distance" movement between the two., x, y pos data ..if the "distance" is increasing ..zoom layout out
if its decreasing ..zoom layout in...

if no touch on the screen destroy sprites and clear any XY data stored

C2 does supports Multi touch which is what you want directly....you could read up it here..

https://www.scirra.com/manual/119/touch

Hope that gets you started somehow


Thanks mystazsea!

Yeah that's got me off to a great start - thank you very much for looking at my question :D
B
13
S
6
Posts: 130
Reputation: 1,553

Post » Sun Jul 13, 2014 5:07 am

viewtopic.php?t=67519&start=0
used some ideas from there
Image
it looks at the distance between touches when you start, and then when you move it zooms in or out depending if the gap is larger or smaller than on start
B
6
S
1
Posts: 51
Reputation: 502

Post » Sun Jul 13, 2014 1:08 pm

Hi!
Any idea on how to implement this to a situation where you'll possibly "touch" a drag-and-drop enabled sprite while doing the "pinch zoom".

I'm interested in adding zoom to my jigsaw project, but, as you can see in the jigsaw tutorial, touching the screen will most probably being interpreted as a piece drag-and-drop event. How could I get past it?
B
43
S
14
G
6
Posts: 132
Reputation: 9,115

Post » Sun May 10, 2015 10:39 pm

trultz wrote:https://www.scirra.com/forum/viewtopic.php?t=67519&start=0
used some ideas from there
Image
it looks at the distance between touches when you start, and then when you move it zooms in or out depending if the gap is larger or smaller than on start


Does this zoom in in the center or in any given point?
B
4
Posts: 3
Reputation: 206


Return to How do I....?

Who is online

Users browsing this forum: ajcoppersmith, blue visionary and 4 guests