Gestures

The Leap Motion software recognizes certain movement patterns as gestures which could indicate a user intent or command. The Leap Motion software reports gestures observed in a frame the in the same way that it reports other motion tracking data like fingers and hands. For each gesture observed, the Leap Motion software adds a Gesture object to the frame. You can get these Gesture objects from the Frame gestures list.

Gestures provide a higher level of abstraction for dealing with Leap Motion tracking data than observing the movement of individual fingers or tools over time. Note that gestures in the Leap Motion API are still lower-level than the gestures you might find in a windowing or user interface API. Gestures are not reported through events, rather they are reported through discrete Gesture objects added to each frame produced during the gesture’s lifetime.

The following movement patterns are recognized by the Leap Motion software:
  • Circle — A single finger tracing a circle.
  • Swipe — A long, linear movement of a finger.
  • Key Tap — A tapping movement by a finger as if tapping a keyboard key.
  • Screen Tap — A tapping movement by the finger as if tapping a vertical computer screen.

When the Leap Motion software first classifies a movement pattern as a gesture, it adds a Gesture object to the frame. If the gesture continues over time, the Leap Motion software adds updated Gesture objects to subsequent frame. Gesture objects refering to the same movement share the same ID value. The gestures Circle and Swipe are continuous. The Leap Motion software updates the progress of these gestures each frame. Taps are discrete gestures. The Leap Motion software reports each tap with a single Gesture object.

Important: before using gestures in your application, you must enable recognition for each gesture you intend to use. The Controller class has an enableGesture() method that you can use to enable recognition for the types of gestures you use.

Circle

The Leap Motion software recognizes the motion of a finger tracing a circle in space as a Circle gesture.

https://di4564baj7skl.cloudfront.net/documentation/v2/images/Leap_Gesture_Circle.png

A circle gesture with the forefinger.

You can make a circle with any finger or tool. Circle gestures are continuous. Once the gesture starts, the Leap Motion software will update the progress until the gesture ends. A circle gesture ends when the circling finger or tool departs from the circle locus or moves too slow.

See CircleGesture in the API reference for more information.

Swipe

The Leap Motion software recognizes a linear movement of a finger as a Swipe gesture.

https://di4564baj7skl.cloudfront.net/documentation/v2/images/Leap_Gesture_Swipe.png

A horizontal swipe gesture.

You can make a swipe gesture with any finger and in any direction. Swipe gestures are continuous. Once the gesture starts, the Leap Motion software will update the progress until the gesture ends. A swipe gesture ends when the finger changes directions or moves too slow.

See SwipeGesture in the API reference for more information.

Taps

The Leap Motion software recognizes two types of taps: the downward Key Tap and the forward Screen Tap.

Key Taps

The Leap Motion software recognizes a quick, downward tapping movement by a finger or tool as a Key Tap gesture.

https://di4564baj7skl.cloudfront.net/documentation/v2/images/Leap_Gesture_Tap.png

A key tap gesture with the forefinger.

You can make a key tap gesture by tapping downward as if pressing a piano key. Tap gestures are discrete. Only a single Gesture object is added per tap gesture.

See KeyTapGesture in the API reference for more information.

Screen Taps

The Leap Motion software recognizes a quick, forward tapping movement by a finger or tool as a Screen Tap gesture.

https://di4564baj7skl.cloudfront.net/documentation/v2/images/Leap_Gesture_Tap2.png

A screen tap gesture with the forefinger.

You can make a key tap gesture by tapping or pushing foward in space as if touching a vertical touch screen. Tap gestures are discrete. Only a single Gesture object is added per tap gesture.

See ScreenTapGesture in the API reference for more information.