How to create drag gestures
I am looking for two formulas: 1. Get the distance from where touch is pressed and touch is released.
2. Get the distance from where touch is pressed to where touch is dragged, but not yet released.
I will be constraining these amounts to an actor: 1. when dragging constrain self width and height to touch.
2. When released set actor width and height to distance of drag.
Any help would be greatly appreciated
-PDS
2. Get the distance from where touch is pressed to where touch is dragged, but not yet released.
I will be constraining these amounts to an actor: 1. when dragging constrain self width and height to touch.
2. When released set actor width and height to distance of drag.
Any help would be greatly appreciated
-PDS
Answers
When touch is pressed,
save X1 to attribute
save Y2 to attribute
When touch is released
save X2 to attribute
save Y2 to attribute
magnitude((X2-X1),(Y2-Y1))
This formula could be used while the touch is active. Instead of using the release data, X2 & Y2 would be the touch data. (It's easier with a mouse, as there's only one touch point to worry about.)
I would like an actor's self.size.width to be constrained to this amount?
I know that I need to mess with the distancefrompouse attribute, but I can't quite wrap my head around it.
okay maybe I will......Extremely valuable! There wouldn't be this big a following without you.
-PoopD