![]() |
Leap Motion Java API Reference
0.8.0
|
The SwipeGesture class represents a swiping motion of a finger or tool. More...
Inherits com.leapmotion.leap.Gesture.
Public Member Functions | |
Vector | direction () |
The unit direction vector parallel to the swipe motion. | |
Pointable | pointable () |
The finger performing the swipe gesture. | |
Vector | position () |
The current position of the swipe. | |
float | speed () |
The swipe speed in mm/second. | |
Vector | startPosition () |
The position where the swipe began. | |
SwipeGesture (Gesture rhs) | |
Constructs a SwipeGesture object from an instance of the Gesture class. | |
![]() | |
long | duration () |
The elapsed duration of the recognized movement up to the frame containing this Gesture object, in microseconds. | |
float | durationSeconds () |
The elapsed duration in seconds. | |
boolean | equals (Gesture rhs) |
Compare Gesture object equality. | |
Frame | frame () |
The Frame containing this Gesture instance. | |
Gesture () | |
Constructs a new Gesture object. | |
Gesture (Gesture rhs) | |
Constructs a new copy of an Gesture object. | |
HandList | hands () |
The list of hands associated with this Gesture, if any. | |
int | id () |
The gesture ID. | |
boolean | isValid () |
Reports whether this Gesture instance represents a valid Gesture. | |
PointableList | pointables () |
The list of fingers and tools associated with this Gesture, if any. | |
Gesture.State | state () |
The gesture state. | |
String | toString () |
A string containing a brief, human-readable description of this Gesture. | |
Gesture.Type | type () |
The gesture type. | |
Static Public Member Functions | |
static Gesture.Type | classType () |
The swipe gesture type. | |
![]() | |
static Gesture | invalid () |
Returns an invalid Gesture object. | |
The SwipeGesture class represents a swiping motion of a finger or tool.
Important: To use swipe gestures in your application, you must enable recognition of the swipe gesture. You can enable recognition with:
Swipe gestures are continuous.
You can set the minimum length and velocity required for a movement to be recognized as a swipe using the config attribute of a connected Controller object. Use the following keys to configure swipe recognition:
Key string | Value type | Default value | Units |
---|---|---|---|
Gesture.Swipe.MinLength | float | 150 | mm |
Gesture.Swipe.MinVelocity | float | 1000 | mm/s |
The following example demonstrates how to set the swipe configuration parameters:
com.leapmotion.leap.SwipeGesture.SwipeGesture | ( | Gesture | rhs | ) |
Constructs a SwipeGesture object from an instance of the Gesture class.
rhs | The Gesture instance to specialize. This Gesture instance must be a SwipeGesture object. |
|
static |
The swipe gesture type.
Vector com.leapmotion.leap.SwipeGesture.direction | ( | ) |
The unit direction vector parallel to the swipe motion.
You can compare the components of the vector to classify the swipe as appropriate for your application. For example, if you are using swipes for two dimensional scrolling, you can compare the x and y values to determine if the swipe is primarily horizontal or vertical.
Pointable com.leapmotion.leap.SwipeGesture.pointable | ( | ) |
Vector com.leapmotion.leap.SwipeGesture.position | ( | ) |
The current position of the swipe.
float com.leapmotion.leap.SwipeGesture.speed | ( | ) |
The swipe speed in mm/second.