How do I pinch zoom

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

  • 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

  • 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 <img src="{SMILIES_PATH}/icon_e_biggrin.gif" alt=":D" title="Very Happy" />

  • used some ideas from there

    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

  • 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?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • scirra.com/forum/viewtopic.php

    used some ideas from there

    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?

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)