swipes

Getting into LiveCode for iOS? Ask your questions here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
bdtrauma
Posts: 34
Joined: Fri Dec 24, 2010 11:37 pm

swipes

Post by bdtrauma »

Does anyone know if finger swipes to move from one card to another are supported in the iOS deployment or is that one of the features 'visual effects' that is not supported yet.

Thanks,

Bert
splash21
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 369
Joined: Sun Dec 19, 2010 1:10 am
Contact:

Re: swipes

Post by splash21 »

Try something like recording the mouse location on a touchStart then checking the horizontal distance moved on touchMove events. You can initiate the swipe when enough distance has been covered.

JC
LiveCode Development & Training : http://splash21.com
ctflatt
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 243
Joined: Sun Dec 06, 2009 12:24 am
Contact:

Re: swipes

Post by ctflatt »

splash21:

What would this code look like?

:Todd
splash21
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 369
Joined: Sun Dec 19, 2010 1:10 am
Contact:

Re: swipes

Post by splash21 »

Example stack attached - you can adjust the required timing and distance to initiate the swipe.
:D


P.S. I just checked touch messages (not mouse), so you'll need to run it in the simulator or on a device.
Attachments
swipe.livecode.zip
Swipe
(2.25 KiB) Downloaded 609 times
LiveCode Development & Training : http://splash21.com
bdtrauma
Posts: 34
Joined: Fri Dec 24, 2010 11:37 pm

Re: swipes

Post by bdtrauma »

Nice... this is exactly what I need. Great example. Thanks Splash21

Bert
ctflatt
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 243
Joined: Sun Dec 06, 2009 12:24 am
Contact:

Re: swipes

Post by ctflatt »

Most appreciated! Thanks for your time.
pshuster
Posts: 9
Joined: Thu Apr 19, 2012 11:22 pm

Re: swipes

Post by pshuster »

Your stack does exactly what I need. - it works great THANKS!!!!
Mag
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 802
Joined: Fri Nov 16, 2012 10:51 pm

Re: swipes

Post by Mag »

Hi splash21, thank you so much for the useful stack.

Anyway often the swipe is implemented in some cases (for example in iPhone Camera app) with the content that follow the fingers (a sort of grab) and, when a certain amount of movement is done or not:

1. the content item backs to original position or
2. go to the next item.

Somebody know how could be implemented it with LC? I would like to use it for browse photos.
Mag
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 802
Joined: Fri Nov 16, 2012 10:51 pm

Re: swipes

Post by Mag »

Ok, I created this code to simulate a bounce, maybe could be useful to some other

Code: Select all

on mouseUp
   put the first item of the loc of image 1 into a
   put the second item of the loc of image 1 into b
   
   move image 1 to (a+30,b) in 8 ticks
   move image 1 to (a,b) in 14 ticks
end mouseUp
Post Reply