Composed Gestures

Back to Tutorials

9. Simple Gestures 11. Hand Interaction 1 2  3  4  5  6  7  8  9  10  11  12  13  14  15  16



On the previous tutorial you've learned how to use ViiMUnitGesture with simple gestures. Now we will go through the composed gestures: the gestures that are made of a sequence of simple gestures. This example follows exactly the same logic from the Simple Gestures example, so if you haven't yet read that tutorial, we advise you to.

Just like in the previous example we have the same hand events and corresponding event listeners, but this time we set the gesture events and their event listener with the composed gestures, for example:

This line will basically tell the application to run the code in the backspaceHandler function, once the BACKSPACE gesture event has been triggered (a backspace gesture was detected).

The available gestures in this example are the click, double click, drag, backspace and enter. You perform a click when you close and open your hand in less than 1 second. A gesture is considered a double click when you make two consecutive clicks in less than 2 seconds. The drag event is fired when you close your hand and with it closed you move it until you open it again. To give you an idea on how to perform the ENTER gesture imagine you start dragging something (closing your hand), push it towards the sensor and finally release it (opening the hand). The BACKSPACE gesture is the same but instead of pushing to the sensor, you pull from the sensor.

Please refer to the gestures technical document for complete information on the available gestures and this unit's specifications.

The implementation of the handler functions for these events are just like in the simple example. Take the eventListener for the backspaceHandler for instance:

Again, this function will be called automatically once a backspace gesture is detected.

The update and draw functions are exactly the same as in the simple gestures example.

9. Simple Gestures 11. Hand Interaction 1 2  3  4  5  6  7  8  9  10  11  12  13  14  15  16

Back to Tutorials