Pinch, drag and zoom

frariofrario Member Posts: 164
edited November -1 in Working with GS (Mac)
I was looking for a good solution, but none seemed to work for me. So I started from scratch, and here's how I did (works only on iphone):

http://gamesalad.com/game/6207

On my iphone 4 it works like a charm!

Comments

  • frariofrario Member Posts: 164
    Mhh... I'm new to GS, so I don't know exactly what the problem could be. Did you try downloading and opening on your computer?

    Or you can download the package here: http://goo.gl/psNxB
  • ChaserChaser Member Posts: 1,453
    I've tried to look at your file at both locations and nothing shows. Thanks for your efforts though
  • frariofrario Member Posts: 164
    Huh? Megaupload is also against me.

    I suppose the third time will be good.
    http://goo.gl/ADDwO

    :)
  • frariofrario Member Posts: 164
    How PINCH works:
    The answer was very simple. You want the image to zoom accordingly to distance from fingers, like if the image was glued to your fingertips. So the PROPORTION between the distance of fingers and the image size has to remain constant (I won't demonstrate this, since I'm not at school anymore).

    How do we pinchzoom?
    [New image width] = [previous image width]*[(updating finger distance)/(starting finger distance)]
    Easy, isn't it?

    How do we drag?
    [new position] = [(previous position x)+(updating finger x)-(starting finger x)], [(previous position y)+(updating finger y)-(starting finger y)]

    Et voilà, pinch, zoom and drag done the right way!
  • ChaserChaser Member Posts: 1,453
    Nice job! Thanks for the info
  • frariofrario Member Posts: 164
    You are welcome!
  • Alejandro93Alejandro93 Member Posts: 4
    hello frario.... how can i do it with camera?? when a scene is moving. like angry birds????
Sign In or Register to comment.