You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to PlayN
Can anyone share an example of how to use the TriplePlay's Gesture package? I'm on 2.0-rc1. My use case is simple: user swipes through a series of still images. It's not clear to me how to wire this up.
Michael Bayne
unread,
Nov 15, 2015, 10:48:52 AM11/15/15
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
Can anyone share an example of how to use the TriplePlay's Gesture package? I'm on 2.0-rc1. My use case is simple: user swipes through a series of still images. It's not clear to me how to wire this up.
That code is a bit over-engineered (and under- in some ways) for the purpose of swiping through images. It aims to support 1 to 4 finger taps and swipes and to help mediate in situations where multiple gestures are in use and you have to figure out which one the user "means". It's also not designed to give useful feedback to the user, though in theory you could do that yourself in conjunction with the gesture system and things would mostly work.
So assuming you're just supporting one finger drag of images in a situation where you don't need to worry about whether the user is swiping horizontally versus vertically or potentially also tapping, I wouldn't even try to use this code. I'd just put a Pointer.Listener on the ImageLayer displaying your image and move the image to track the user's finger and then if they "release" the image close enough to the left or right side of the screen, or with sufficient +x or -x velocity, then move to the next image.
The Gesture director also won't help you with sliding the image back into place if the user slides part way but doesn't slide far or fast enough to trigger an image switch.
The code in ScreenSpace does exactly this (on screens instead of images), so it might be a good thing to look at. I even considered factoring that code out into some sort of reusable core that would make it easier to reuse for any situation where you're dragging things around that might snap back, but it ended up being so complicated even in this single use case that it wasn't clear how I could factor out anything useful that wouldn't end up being even more complicated and thus very unlikely to be used by anyone.
Unfortunately, all of these fancy animated gestures that are common on mobile these days are quite complicated to implement. If I had infinite free time, I'd spend some of it studying the APIs provided by iOS and Android to see if they managed to abstract away the complexity and provide a simple way to do physical animations.