Hi, all.
I'm just getting started with LiveCode and very excited about the possibilities for iPad apps. I'm specifically looking to swipe from card to card (both horizontally and vertically, if possible) as is done in most iPad magazine apps to navigate from page to page.
I found "visual effect push right fast" which is pretty close, but there isn't any "snappiness" to it. Perhaps done with tweening...?
Also, is there a specific library available for iOS gestures? I'm sure I'll be looking for more of them, too.
Many thanks in advance.
Digitalcargo
iPad Gestures: Magazine-style Page Swipes, etc...
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- Posts: 2
- Joined: Thu Jun 02, 2011 7:00 pm
Re: iPad Gestures: Magazine-style Page Swipes, etc...
Hi,
I think there are some visual effects that you can use. Really ought to read the manual.
Kind regards,
Mark
I think there are some visual effects that you can use. Really ought to read the manual.
Kind regards,
Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
Re: iPad Gestures: Magazine-style Page Swipes, etc...
Yes, you can do it. You need to use a touchStart handler to store the initial touch location. Then in a touchEnd handler, compare the current location with the stored one. If the horizontal direction is more than so-many pixels (I've seen 10 as an example, but you may want more) then it is considered a swipe. At that point you use the "push left" or "push right" visual effects to move to the next card.
Here is a slightly modified excerpt from the teaching stack we used at the recent RevLive conference. It uses "mouse" handlers instead of "touch" handlers, mostly because they work on both desktop and mobile. You could use either one.
Here is a slightly modified excerpt from the teaching stack we used at the recent RevLive conference. It uses "mouse" handlers instead of "touch" handlers, mostly because they work on both desktop and mobile. You could use either one.
Code: Select all
## Handlers to detect swipe gestures
local hStart,hEnd,vStart
on mouseDown
# store coords for comparison in mouseUp later:
put the clickH into hStart
put the clickH into hEnd
put the clickV into vStart
end mouseDown
on mouseMove x, y
put x into hEnd
end mouseMove
on mouseRelease
mouseUp
end mouseRelease
on mouseUp
put hEnd - hStart into tDifference
if tDifference > 10 then
## Swipe right
-- change cards here with "push right"
else if tDifference < -10 then then
## Swipe left
-- change cards with "push left"
else
## Tap
-- if you need a tap gesture, the action goes here
end if
end mouseUp
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
-
- Posts: 2
- Joined: Thu Jun 02, 2011 7:00 pm
Re: iPad Gestures: Magazine-style Page Swipes, etc...
Thanks, Jacqueline! I'll give that a try... looks like exactly what I need.
digitalcargo
digitalcargo