LeapJS API Reference
Class

Leap.SwipeGesture

Contents

class Leap.SwipeGesture extends Leap.Gesture

The SwipeGesture class represents a swiping motion of a finger or tool.

SwipeGesture

Swipe gestures are continuous.

Constructor Top

  SwipeGesture ()

Properties Top

Leap.Vector direction
Number duration inherited from Leap.Gesture
Array handIds inherited from Leap.Gesture
Number id inherited from Leap.Gesture
Array pointableIds inherited from Leap.Gesture
Leap.Vector position
Number speed
Leap.Vector startPosition
String state inherited from Leap.Gesture
String type inherited from Leap.Gesture

Constructor details Top

gesture.js at line 244
SwipeGesture ()

Constructs a new SwipeGesture object.

An uninitialized SwipeGesture object is considered invalid. Get valid instances of the SwipeGesture class from a Frame object.

Properties Detail Top

gesture.js at line 279
public Leap.Vector 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.

gesture.js at line 107
public Number duration

The elapsed duration of the recognized movement up to the frame containing this Gesture object, in microseconds.

The duration reported for the first Gesture in the sequence (with the start state) will typically be a small positive number since the movement must progress far enough for the Leap to recognize it as an intentional gesture.

Inherited from Leap.Gesture

gesture.js at line 87
public Array handIds

The list of hands associated with this Gesture, if any.

If no hands are related to this gesture, the list is empty.

Inherited from Leap.Gesture

gesture.js at line 75
public Number id

The gesture ID.

All Gesture objects belonging to the same recognized movement share the same ID value. Use the ID value with the Frame::gesture() method to find updates related to this Gesture object in subsequent frames.

Inherited from Leap.Gesture

gesture.js at line 97
public Array pointableIds

The list of fingers and tools associated with this Gesture, if any.

If no Pointable objects are related to this gesture, the list is empty.

Inherited from Leap.Gesture

gesture.js at line 270
public Leap.Vector position

The current swipe position within the Leap frame of reference, in mm.

gesture.js at line 292
public Number speed

The speed of the finger performing the swipe gesture in millimeters per second.

gesture.js at line 261
public Leap.Vector startPosition

The starting position within the Leap frame of reference, in mm.

gesture.js at line 121
public String state

The gesture ID.

Recognized movements occur over time and have a beginning, a middle, and an end. The 'state()' attribute reports where in that sequence this Gesture object falls.

Possible values for the state field are:

Inherited from Leap.Gesture

gesture.js at line 139
public String type

The gesture type.

Possible values for the type field are:

Inherited from Leap.Gesture