a customized drag command
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
a customized drag command
Hi, I'm trying to write a script that:
1) determines the speed of a drag movement (already did, I think )
2) determines for how much time and space after the drag movement the computer/phone should keep moving the dragged object.
3) the speed of the Computer "after movement" will slow down gradually
this is in general, in the stack attached you can see and understand better.
Thanks!
1) determines the speed of a drag movement (already did, I think )
2) determines for how much time and space after the drag movement the computer/phone should keep moving the dragged object.
3) the speed of the Computer "after movement" will slow down gradually
this is in general, in the stack attached you can see and understand better.
Thanks!
- Attachments
-
- DragSpeed.zip
- (2.98 KiB) Downloaded 80 times
Samuele.
Re: a customized drag command
I'm not sure what you've achieved (using phone so not downloaded your stack) but if you open the "bouncy" stack sample from the "Resources" menu, at the bottom of the list in "Sample Projects", then you can pick this apart. It bounces around according to the initial speed of mouse drag, and slows down gradually.
Re: a customized drag command
Hi, I took a look at it, and the stack doesn't quite go in the direction I intended... or maybe it is but in a complicated way that it seems useless for only the thing I'm trying to achieve...
Samuele.
-
- Livecode Opensource Backer
- Posts: 9385
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: a customized drag command
I think it would be a good idea if one of the list administrators
merged this posting with the previous one on the same topic by
the same OP.
merged this posting with the previous one on the same topic by
the same OP.
Last edited by richmond62 on Wed Mar 30, 2022 11:56 am, edited 1 time in total.
-
- Livecode Opensource Backer
- Posts: 9385
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: a customized drag command
Baby Mathematics, AGAIN!
- Attachments
-
- Slow_Down_Gradually.livecode.zip
- Stack.
- (1.78 KiB) Downloaded 73 times
-
- Livecode Opensource Backer
- Posts: 9385
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: a customized drag command
LiveCode cannot decide anything, that is entirely up to the person who works with LiveCode.livecode will decide to work
Re: a customized drag command
Thank you for the stack, but when i put that code on my original stack it doesn't work because the line created has only 2 points
Thanks!
Thanks!
- Attachments
-
- DragSpeed_wannabe_gradually.zip
- (3.46 KiB) Downloaded 67 times
Samuele.
-
- Livecode Opensource Backer
- Posts: 9385
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: a customized drag command
Very, very funny indeed.the line created has only 2 points
The line in my stack has 50 points.
Make an effort to understand the code inside the GENERATE DOTTY LINE button, find where the field "POINTZ" is,
and then do some work instead of expecting to have everything delivered to you on a plate.
Code: Select all
on mouseUp
put empty into fld "POINTZ"
put 20 into LR
put 100 into UD
repeat until LR > 1000
put (LR & "," & UD & cr) after fld "POINTZ"
add 20 to LR
add 10 to UD
end repeat
set the points of grc "pp" to fld "POINTZ"
end mouseUp
(and it is just 'there' to look pretty):
Code: Select all
on mouseUp
set the moveSpeed to 2000
put 2000 into fastBALL
put 1 into POYNT
put line POYNT of fld "POINTZ" into LOKK
set the loc of grc "TOPKA" to LOKK
repeat until line POYNT of fld "POINTZ" is empty
add 1 to POYNT
put line POYNT of fld "POINTZ" into LOKK
move grc "TOPKA" to LOKK
subtract 40 from fastBALL
set the moveSpeed to fastBALL
end repeat
end mouseUp
Re: a customized drag command
hi, I understand the code of your stack, but the problem is that you create a line that goes in a random direction and therefore you can afford to create it with many points, but I in my stack am not trying to move the ball in a random direction but in the direction that the user dragged the ball and what I cannot understand is why the line created in my stack has only 2 points and therefore the trick you use in your stack to decrease the speed in every point of the line is not possible to do it in my ...richmond62 wrote: ↑Mon Apr 04, 2022 10:03 amVery, very funny indeed.the line created has only 2 points
The line in my stack has 50 points.
Make an effort to understand the code inside the GENERATE DOTTY LINE button
Thanks for the patience!
Samuele.
-
- Livecode Opensource Backer
- Posts: 9385
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: a customized drag command
If you know your start point and your end point it is relatively easy to generate a multi-point line (or list of intermediate points)
between them.
between them.
Re: a customized drag command
how? the line could be / going up OR / going down OR \ going up OR \ going down.
So i can't just add value
So i can't just add value
Samuele.
-
- Livecode Opensource Backer
- Posts: 9385
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: a customized drag command
It's a lovely Spring day here, so just got back from 90 minutes walk & a think as have to sort out 10 Ukrainian children tomorrow (i.e. integrate them into existing EFL classes), and am slightly nervous.
Going upstairs to mess around with LiveCode in about 45 minutes . . .
Going upstairs to mess around with LiveCode in about 45 minutes . . .
-
- Livecode Opensource Backer
- Posts: 9385
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: a customized drag command
There's a lot to be said for a walk . . .
ALL the code that matters is in the MAGIC button.
- Attachments
-
- MAGIC STUFF.livecode.zip
- Stack.
- (64.58 KiB) Downloaded 74 times
Re: a customized drag command
Hi , thanks, there is only a little thing, i don't understand why in my stack the Button i want to move goes from moving slowly to fast instead of the reverse as in your stack.
Thanks!Samuele.